.:HyPeX:. Posted November 9, 2014 Share Posted November 9, 2014 Hey guys, i'm using a database to store stuff and i was wondering if it was possible to have a table inside another table in databases...? Greetz Link to comment
MTA Team botder Posted November 9, 2014 MTA Team Share Posted November 9, 2014 Do you mean something like toJSON? Link to comment
.:HyPeX:. Posted November 9, 2014 Author Share Posted November 9, 2014 No, not really, but i could use that too. What i meant is this (or something like it, should work for explainatory purpouses): local db = dbConnect("sqlite", "crap.db") local dbExec( db,"CREATE TABLE IF NOT EXISTS table_MyBootTable();") local dbExec( db,"CREATE TABLE IF NOT EXISTS IN table_MyBootTable table_SubTable(Column1, varchar);") Link to comment
MTA Team botder Posted November 10, 2014 MTA Team Share Posted November 10, 2014 Do you want to add a column to your first table or SELECT information from 2 tables in one query? Link to comment
Feche1320 Posted November 10, 2014 Share Posted November 10, 2014 Create a new table lol, dumb question Link to comment
.:HyPeX:. Posted November 10, 2014 Author Share Posted November 10, 2014 Do you want to add a column to your first table or SELECT information from 2 tables in one query? No, i want to add a table to the first table! @Feche1320 - It would be much easier to have a sub-array for my own purpouses Link to comment
Feche1320 Posted November 10, 2014 Share Posted November 10, 2014 Do you want to add a column to your first table or SELECT information from 2 tables in one query? No, i want to add a table to the first table! @Feche1320 - It would be much easier to have a sub-array for my own purpouses fromJSON and toJSON is what you are looking for.. -- Inserting to DB local table = { name = "Hypex", age = 23, ["eye_color"] = "white" } dbExec(yourdb, "UPDATE yourtable SET information = '" ..toJSON(table).. "'") -- Restoring from DB local qr = dbQuery("SELECT information FROM yourtable") local result = dbPoll(qr, -1) local table = fromJSON(result[1].information) That's a quick example Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now