SQLite_133 Lib: Close/Reopen

Everything else that doesn't fall into one of the other PB categories.
fgrimes
New User
New User
Posts: 2
Joined: Fri Sep 05, 2003 8:12 am

SQLite_133 Lib: Close/Reopen

Post by fgrimes »

I'm using El_Choni's (impressive!) SQLite_133 User Lib and I'm getting the following error when I call SQLiteGetTable after closing and reopening the database:

SQLiteGetTable error: library routine called out of sequence

To test I took the sample program, SQLite.pb, and added the code (see below) at the end of the program between the calls to SQLiteClose() and DeleteFile(DBName$). Same error.

Any ideas? I need to open/close/copy/delete databases in an app so any help would be appreciated.

Thanks...
Fergal

; ===================================

; reopen db...
DBHandle = SQLiteOpen(DBName$)
If DBHandle = 0
MessageRequester("SQLite Error", "SQLiteOpen error: " + SQLiteError(), #MB_IconError | #MB_OK)
EndIf

; handle is good...

Result = SQLiteGetTable("SELECT id, url, site, category FROM bookmarks WHERE category LIKE 'D%'")
If Result <> #SQLITE_OK
; gives error: library routine called out of sequence
MessageRequester("SQLite Error", "SQLiteGetTable error: "+SQLiteError(Result), #MB_IconError|#MB_OK)
EndIf

SQLiteClose()

; ===================================
fgrimes
New User
New User
Posts: 2
Joined: Fri Sep 05, 2003 8:12 am

RE: SQLite_133 Lib: Close/Reopen

Post by fgrimes »

OK... I see answer now:

DBIndex = 0

...

;reopen...
DBIndex + 1
DBHandle = SQLiteOpen(DBIndex, DBName$)
Post Reply