Page 1 of 4

Current Status of El Choni's SQLite Library?

Posted: Mon May 03, 2004 5:53 pm
by ebs
I've looked through the message threads, but I'm not sure what the exact status of the SQLite library is.
I'm using PB 3.90 and the matching version of jaPBe.

I get nonsensical errors when executing simple SQL "INSERT" statements,
and my program crashes when running from the jaPBe IDE. I didn't have
any problems when using previous PB versions, including 3.81 (I think).

Should the SQLite library work with the current PB compiler version?

Posted: Mon May 03, 2004 6:18 pm
by Karbon
Yes, I'm using 3.90 + some beta libs (note, not the full 3.91 beta) and I use SQLite in several projects - no problems yet..

There are some problems if you open/use more than one SQLite DB, I think he is working on the new version now...

I Learned a Valuable Lesson!!!

Posted: Tue May 04, 2004 1:06 am
by ebs
I found out why I was getting SQLite errors and my program was crashing, so I want to share it with you!

My code looked like this (simplified):

Code: Select all

Person.s = "Smith, John"
SQLiteExec("INSERT INTO StatusTable VALUES('" + Person + "','OUT','')")
When I inserted "Debug Person" statements before and after the SQLiteExec call, I discovered that the variable Person had changed!

When I rewrote my code this way:

Code: Select all

Person.s = "Smith, John"
Ins.s = "INSERT INTO StatusTable VALUES('" + Person + "','OUT','')"
SQLiteExec(Ins)
all the problems went away!

I'm guessing that trying to concatenate the strings directly in the SQLiteExec call somehow overwrote the variable. Can anyone tell me exactly why this should/shouldn't work?

Eric

Posted: Tue May 04, 2004 1:20 am
by El_Choni
Because it's a bug (fixed in next version)

Regards,

Posted: Tue May 04, 2004 12:26 pm
by ebs
El Choni,

Thanks for the fast reply, and for the fix!

Regards,
Eric

Posted: Tue May 04, 2004 12:31 pm
by Karbon
:D New SQLite? :D

Posted: Tue May 04, 2004 1:03 pm
by El_Choni
Yes. I rewrote the whole thing, with the same syntax but bugfixed and threadsafe. However, I'm still at the point where it doesn't compile (some problems with Fasm macros). Then, testing will come, etc. I hope you'll offer yourselves as betatesters... ;)

Regards,

Posted: Tue May 04, 2004 1:05 pm
by Karbon
Sure!

Send anything over by email/IRC/PM

Posted: Tue May 04, 2004 1:11 pm
by Karbon
Remember that patched userlib you sent me to make sure that the SQLite DLL loading is the one passed to SQLiteInit()? Are those fixes/changes in the new version? That is very important to several of my projects (as I use modified SQLite libs..)

Posted: Tue May 04, 2004 1:36 pm
by El_Choni
Yes, that's included in the new version. The only change your userlib has is that thing you mention.

Posted: Sat May 08, 2004 11:25 am
by Karbon
Hey El, does the current lib return #SQLITE_BUSY properly? It doesn't seem to in my tests.. I'm trying to detect if anyone else is writing to the db before I allow the current user to. My initial method was to loop the exec procedure to test for #SQLITE_BUSY and if it found it to sleep for a few miliseconds and try again - it doesn't seem like #SQLITE_BUSY ever gets returned though.

Posted: Sat May 08, 2004 1:28 pm
by El_Choni
Yes, it returns errors from sqlite.dll. I've never received SQLITE_BUSY, probably because I never accessed a sqlite db concurrently.

Regards,

Posted: Thu Jun 10, 2004 8:05 pm
by ebs
El Choni,

Hello!

Any news about an updated version of your SQLite library?

I have one additional question for you to think about. I am trying to be able to detect if the network connection to the database is lost. I use code like the following (SQL is a string variable):

Code: Select all

If SQLiteGetTable(SQL) = 0
    ; success - do something
Else
    ; failure
    MessageRequester("Database Error", "Database connection lost!", #MB_ICONERROR|#MB_OK) 
EndIf
The funny part is that if I unplug my network cable, I DON'T get any error!

I will get an immediate error if I try to use:

Code: Select all

SQLiteExec(SQL)
when the network is disconnected, though.

Do you have any idea why no error occurs? I always use:

Code: Select all

SQLiteRemoveData()
after I'm done with a table, but I don't think that makes any difference.

Any help will be greatly appreciated!

Eric

Posted: Thu Jun 10, 2004 8:07 pm
by Karbon
Ebs: The network being disconnected would be like the hard drive that the database file was living on being ripped out while the database was still open - I'd expect an immediate error (if not a total crash) in that case :-)

Posted: Thu Jun 10, 2004 9:22 pm
by ebs
Ebs: The network being disconnected would be like the hard drive that the database file was living on being ripped out while the database was still open - I'd expect an immediate error (if not a total crash) in that case
Mitch,

I'm not sure that I'd expect an immediate error, but I certainly would expect one the next time I tried to retrieve data from the database! That's what puzzles me!

Eric