04-08-2013, 06:31 AM
(04-08-2013, 06:07 AM)STR_Warrior Wrote: i have absolutly no idea how sqlite works i hope that when bearbin finishes his home plugin i know more how to use it. the debuggers plugin didn't realy work for me becouse i had absolutly no idea what it was doing
Hey to open/create a database do this
local TestDB, ErrCode, ErrMsg = sqlite3.open("test.sqlite");
test.sqlite = filename.
TestDB = dbhandler
ErrCode = code for when error happens.
ErrMsg = the msg of the error code.
if (TestDB ~= nil) then
Check if there was a actual db set, though errCode should be able to be used for this if errorcode > 0 asume there was a error i guess.
local Res = TestDB:exec(sql, ShowRow, 'UserData');
Res = result of a query you executed,
sql = the query you wish to execute, multiple query's at one time seems to be supported.
Though i asume only 1 select.
ShowRow function to return to for a SELECT query and thus the ShowRow function will be called with the results.
UserData i asume will hold the type of query you executed so you can identify what result for what query has been returned to the function.
TestDB:close();
Close the database connection/release the file.
On another note, normaly there are functions like flush etc to directly flush the data to file, instead of keeping it in memory until file is released aka Close is called.
I have not checked what functions this plugin contains so i wont go into detail about it.
The Debugging plugin should reveal a bit more info about then i just explained above.
Why you ain't getting it is beyond me as its quite basic code.
If as Xoft said, you don't know SQL you will have a bad time!
Learn some sql as its easy to learn and handy for future things you might wanna work with/create.