Piorun Posted July 27, 2013 Share Posted July 27, 2013 Srsly in the name of topic is everything so: What query i should use to get all tables in database? Link to comment
Castillo Posted July 27, 2013 Share Posted July 27, 2013 For SQLite, you can try with this query: local query = executeSQLQuery ( "SELECT * FROM sqlite_master WHERE type='table'" ) Link to comment
Piorun Posted July 28, 2013 Author Share Posted July 28, 2013 Ok one more i need - how to get list of columns in table? Link to comment
Castillo Posted July 28, 2013 Share 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". Link to comment
Piorun Posted July 29, 2013 Author Share 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? Link to comment
Castillo Posted July 29, 2013 Share Posted July 29, 2013 What does "num_affected_rows" return? Link to comment
Piorun Posted July 29, 2013 Author Share Posted July 29, 2013 3 - its number of rows in table. Link to comment
Castillo Posted July 29, 2013 Share 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. Link to comment
Piorun Posted July 29, 2013 Author Share Posted July 29, 2013 Yo - those codes aren't same? @EDIT Aaaaw ... pairs. Ok bro thanks. Link to comment
Castillo Posted July 29, 2013 Share Posted July 29, 2013 Did it work? or didn't test it yet? Link to comment
Piorun Posted July 29, 2013 Author Share Posted July 29, 2013 Forget to write - ofc its working but could you tell me what is difrence between pairs and ipairs? 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