ID:1811833
 
(See the best response by Mr_Goober.)
Hello, I was wondering what the basics were to setting up a database with BYOND games. I have many items I need to import and I thought using a database would save me memory when it comes to variables instead of hard-coding it in-game, which would take up space. Any help would be appreciated.

Best response
DM comes with built in functionality for SQLite databases. All you need to do is:
var/database/d = new("mydatabase.db")

This will create a new database (a new table if the file doesn't exist). A database query datum can also be created to grab data from the table using SQL syntax. Example from the reference:
var/database/db = new("mydb.db")
var/database/query/q = new("SELECT * FROM my_table WHERE name=?", usr.key)

if(q.Execute(db) && q.NextRow())
// returns a list such as list(name="MyName", score=123)
return q.GetRowData()
// no data found
return null