Current Status of El Choni's SQLite Library?

Everything else that doesn't fall into one of the other PB categories.
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Current Status of El Choni's SQLite Library?

Post 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?
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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...
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

I Learned a Valuable Lesson!!!

Post 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
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Because it's a bug (fixed in next version)

Regards,
El_Choni
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post by ebs »

El Choni,

Thanks for the fast reply, and for the fix!

Regards,
Eric
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

:D New SQLite? :D
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post 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,
El_Choni
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post by Karbon »

Sure!

Send anything over by email/IRC/PM
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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..)
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Yes, that's included in the new version. The only change your userlib has is that thing you mention.
El_Choni
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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.
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post 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,
El_Choni
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post 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
Karbon
PureBasic Expert
PureBasic Expert
Posts: 2010
Joined: Mon Jun 02, 2003 1:42 am
Location: Ashland, KY
Contact:

Post 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 :-)
-Mitchell
Check out kBilling for all your billing software needs!
http://www.k-billing.com
Code Signing / Authenticode Certificates (Get rid of those Unknown Publisher warnings!)
http://codesigning.ksoftware.net
ebs
Enthusiast
Enthusiast
Posts: 561
Joined: Fri Apr 25, 2003 11:08 pm

Post 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
Post Reply