Piorun Posted July 27, 2013 Posted July 27, 2013 Srsly in the name of topic is everything so: What query i should use to get all tables in database?
Castillo Posted July 27, 2013 Posted July 27, 2013 For SQLite, you can try with this query: local query = executeSQLQuery ( "SELECT * FROM sqlite_master WHERE type='table'" ) San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted July 28, 2013 Posted July 28, 2013 You're welcome. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Piorun Posted July 28, 2013 Author Posted July 28, 2013 Ok one more i need - how to get list of columns in table?
Castillo Posted July 28, 2013 Posted July 28, 2013 local query = executeSQLQuery ( "SELECT * FROM sqlite_master WHERE type='column' WHERE tablename = ?", "accounts" ) Try something like that, not sure if the table name column is "tablename". San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Piorun Posted July 29, 2013 Author Posted July 29, 2013 Another proble i have that i dont get any outputed message i dont know why: local query = dbQuery ( database, "SELECT * FROM characters" ) local result, num_affected_rows, errmsg = dbPoll ( query, -1 ) for _, row in ipairs(result) do for k, v in ipairs(row) do outputChatBox(tostring(k)..", "..tostring(v)) end end I have "something" in this table (3 rows are - i checked it using program) but nothing happen. Why?
Castillo Posted July 29, 2013 Posted July 29, 2013 What does "num_affected_rows" return? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Castillo Posted July 29, 2013 Posted July 29, 2013 local query = dbQuery ( database, "SELECT * FROM characters" ) local result, num_affected_rows, errmsg = dbPoll ( query, -1 ) for _, row in ipairs(result) do for k, v in pairs(row) do outputChatBox(tostring(k)..", "..tostring(v)) end end Try that. San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Piorun Posted July 29, 2013 Author Posted July 29, 2013 Yo - those codes aren't same? @EDIT Aaaaw ... pairs. Ok bro thanks.
Castillo Posted July 29, 2013 Posted July 29, 2013 Did it work? or didn't test it yet? San Andreas Utopia RPG (SAUR) Owner & Developer. Education is the most powerful weapon which you can use to change the world.
Piorun Posted July 29, 2013 Author Posted July 29, 2013 Forget to write - ofc its working but could you tell me what is difrence between pairs and ipairs?
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