Trouble inserting data into an sqlite3 database
#7
(11-22-2015, 02:21 AM)PureTryOut Wrote: I'm not sure what really changed, but I can succesfully create tables and insert data now. My code however, is practically the same. I really don't know, but I guess fixedBig Grin

Anyways I managed to retrieve some data from the database, however it gives an error if the result is empty. So for example I have:
Code:
SELECT * FROM test WHERE test_id = ?

If the ID I'm asking for does not exist, then I get the following error:
Code:
[17:13:55] LUA: Plugins/Townvalds/database.lua:43: misuse of function
[17:13:55] Stack trace:
[17:13:55]   [C](-1): get_values
[17:13:55]   Plugins/Townvalds/database.lua(43): ExecuteStatement
[17:13:55]   Plugins/Townvalds/functions.lua(48): (no name)
[17:13:55] Stack trace end
[17:13:55] Error in plugin Townvalds calling function <callback>()

If the ID i'm asking for however does exist, then I have no problems whatsoever.
I'm using "stmt:get_values()" to retrieve the data from the query.

It's more of a general Lua question, but I'm guessing you guys will have a clueBig Grin

Try to use bind_names (http://lua.sqlite.org/index.cgi/doc/tip/...bind_names).
Reply
Thanks given by:


Messages In This Thread
RE: Trouble inserting data into an sqlite3 database - by DrMasik - 11-22-2015, 07:21 AM



Users browsing this thread: 1 Guest(s)