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