Jump to content

SQL question


.:HyPeX:.

Recommended Posts

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
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! xD

@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 :P

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...