May 24, 2022, 02:04:07 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


SQLite

Started by billhsln, November 14, 2016, 02:45:00 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

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
When all else fails, get a bigger hammer.

LarryMc

Can't help you Bill because I always use the IWBasic dBase functions when I'm dealing with databases.  sorry
LarryMc
Larry McCaughn :)
Author of IWB+, Custom Button Designer library, Custom Chart Designer library, Snippet Manager, IWGrid control library, LM_Image control library

billhsln

Thats ok.  I usually use them too, was just trying to learn some thing new.

Bill
When all else fails, get a bigger hammer.

Rock Ridge Farm (Larry)

Do not know about Sqllite but in mysql somehing like die('Could not connect: ' . mysql_error()); works.

The other Larry


Brian

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

billhsln

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
When all else fails, get a bigger hammer.

Brian

Bill,

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

Brian

Brian

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