Dennis,

From your description it sounds like you are using the Delphi wrapper listed
in the wiki as:

Delphi class for SQLite.
http://www.torry.net/db/direct/db_directsql/tsqlite.zip


Indeed. Actually, I'm using an OO wrapper around that library, TSQLiteDB (http://homepages.borland.com/torry/db/direct/db_directsql/tsqlite.zip). I've read through the code of the the wrapper, and the only time that the FDB (TSQLite object for TSQLiteDB) is destroyed is when the TSQLiteDB object is destroyed as well...
destructor TSQLiteDB.Destroy;
begin
FreeAndNil(FDb);
FreeAndNil(FData);
inherited Destroy;
end;


Here's my TEMPORARY TABLE code:
// DB is a TSQLiteDB created on FomCreate
DB.SQL:='CREATE TEMPORARY TABLE cname2cid(cid INTEGER,name VARCHAR(512));';
DB.ExecSQL;

DB.SQL:='SELECT id,firstname,lastname,business from customers;';
DB.Open;
//...
DB.Close;

As far as I can tell, cname2cid is created and then destroyed right away. It's created at the beginning of DB.ExecSQL, and then destroyed at the end of ExecSQL. BUT, reading the ExecSQL code, I see no place where FDB is destroyed:
procedure TSQLiteDB.ExecSQL;
begin
if FSQL <> '' then
FDb.Query(FSQL, nil);
end;


So I don't know what to make of it... Maybe I could make FDB public and manually access it, but actually getting TEMPORARY TABLEs to work with TSQLiteDB would be neat...

Thanks for all your help so far, any ideas about what's causing this? If not, guess I'll just go back and use TSQLite ;).

--
Taj

Reply via email to