-ffs-AbodyRulez Posted August 27, 2015 Posted August 27, 2015 local ID = dbExec(db, "SELECT LAST_INSERT_ROWID() FROM joinHistory") this returns false for me, even though the database isn't empty. i'm trying to create an auto_increment column, but just found out that sqlite doesn't support auto_increment, it's only supported by MySQL. any help?
JR10 Posted August 27, 2015 Posted August 27, 2015 SQLite supports auto-increment. A column declared "INTEGER PRIMARY KEY" will auto-increment. You can use last_insert_rowid() without specifying a table. SELECT LAST_INSERT_ROWID() Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
Jusonex Posted August 27, 2015 Posted August 27, 2015 Also, you can't use dbExec to get the ID. You'll have to use dbQuery + dbPoll as follows: local result = dbPoll(dbQuery(db, "SELECT LAST_INSERT_ROWID() AS `ID`"), -1) outputChatBox(result.ID) ("FROM joinHistory" isn't necessary according to the SQLite documentation btw)
JR10 Posted August 27, 2015 Posted August 27, 2015 I didn't even notice that he was using dbExec. dbExec never returns results, it only executes the given query. Business System viewtopic.php?f=108&t=35797 Notepad++ Syntax Highlighting & Auto Completion viewtopic.php?f=91&t=76726 SQLite Tutorial viewtopic.php?f=148&t=38203
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