Bug in SQLite-Lib

Windows specific forum
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Bug in SQLite-Lib

Post by freedimension »

Help!!!
I'm using El Chonis sqlite-lib together with the sqlite.dll v.2.8.13
In this constellation it constantly refuses to close a database before opening a new one.
I've done an abbreviated version for testing purposes:

Code: Select all

InitSQLite()
DBName.s = "test.db"

DBHandle = SQLiteOpen(DBName)
Debug SQLiteClose()

DBHandle = SQLiteOpen(DBName)
Debug SQLiteError(SQLiteExec("CREATE TABLE test (a, b)"))
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Works fine here. I'll download 2.8.13 just to check this, thanks for reporting.

EDIT: SQLiteClose() returns 0, it's normal and doesn't mean it failed.
El_Choni
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

I played around a little and came to the conclusion that the problem isn't the closing of the DB but the use of the same DB_Index in subsequent calls to SQLiteOpen().
So a nice work around for my project is to increment the used DB_Index each time SQLiteOpen is called.

Otherwise the following code

Code: Select all

InitSQLite()
DBName.s = "test.db"
DBHandle = SQLiteOpen(1, DBName)
Debug SQLiteError(SQLiteGetTable("SELECT * FROM test"))
SQLiteClose(1)
DBHandle = SQLiteOpen(1, DBName)
Debug SQLiteError(SQLiteGetTable("SELECT * FROM test"))
End
returns
not an error
library routine called out of sequence
while the first debug is ok, the second is just queer.

This one though does the trick:

Code: Select all

InitSQLite()
DBName.s = "test.db"
DBHandle = SQLiteOpen(1, DBName)
Debug SQLiteError(SQLiteGetTable("SELECT * FROM test"))
SQLiteClose(1)
DBHandle = SQLiteOpen(2, DBName)
Debug SQLiteError(SQLiteGetTable("SELECT * FROM test"))
End
El_Choni
TailBite Expert
TailBite Expert
Posts: 1007
Joined: Fri Apr 25, 2003 6:09 pm
Location: Spain

Post by El_Choni »

Yep, bug. It's fixed in next version.
El_Choni
freedimension
Enthusiast
Enthusiast
Posts: 613
Joined: Tue May 06, 2003 2:50 pm
Location: Germany
Contact:

Post by freedimension »

I wanted you to know that I've found a way around, so it's ok for me if you need a little bit longer. So you don't have to have a bad conscience :D
Post Reply