IonicWind Software

IWBasic => Database => Topic started by: billhsln on November 14, 2016, 02:45:00 PM

Title: SQLite
Post by: billhsln on November 14, 2016, 02:45:00 PM
I noticed that in all the examples we have for SQLite, there does not seem to be much error checking.

Does sqlite3_open have an error condition?  Is it like the sqlite3_exec where a return of 0 is ok?  Are there other errors that can be returned for sqlite3_step other than 100 (End of File)?  In all the examples I have seen INSERT and DELETE are expected to always work, my experience has shown that that does not always happen.  Just wondering why so little error checking is done in the examples I have seen.

Thanks,
Bill
Title: Re: SQLite
Post by: LarryMc on November 14, 2016, 03:34:10 PM
Can't help you Bill because I always use the IWBasic dBase functions when I'm dealing with databases.  sorry
Title: Re: SQLite
Post by: billhsln on November 14, 2016, 11:29:03 PM
Thats ok.  I usually use them too, was just trying to learn some thing new.

Bill
Title: Re: SQLite
Post by: Rock Ridge Farm (Larry) on November 15, 2016, 05:56:44 AM
Do not know about Sqllite but in mysql somehing like die('Could not connect: ' . mysql_error()); works.

The other Larry

Title: Re: SQLite
Post by: Brian on November 15, 2016, 06:28:20 AM
Bill,

In one of my programs, I had this code:

   SETCURSOR win,@CSWAIT
IF SqliteVacuum(dbf)
   SqliteGetError(dbf,err)
   MESSAGEBOX win,err,"Database Cleanup...",16
   SqliteResetError(dbf)
ELSE
   MESSAGEBOX win,"Database Cleanup finished","Database Cleanup...",64
ENDIF
   SETCURSOR win,@CSARROW

Brian
Title: Re: SQLite
Post by: billhsln on November 15, 2016, 09:43:33 AM
What do the declares look like for the Vacuum, GetError and ResetError commands look like?

Also, since Vacuum looks like a newer command, do I need to update/replace the DLL or any other file?

Thanks,
Bill
Title: Re: SQLite
Post by: Brian on November 15, 2016, 12:49:03 PM
Bill,

I will have to dig a little for your answer - will be tomorrow now. Although I do believe
they are Sqlite3 calls

Brian
Title: Re: SQLite
Post by: Brian on November 16, 2016, 03:05:46 AM
Bill,

Not having much luck here, although according to the Sqlite pages, the latest version does
support VACUUM - https://www.sqlite.org/lang_vacuum.html

The Vacuum call looks a bit hairy to me! Couldn't find the GetError and ResetError calls, though

Brian