[yunqa.de] Re: SQLite metadata

  • From: "Radovan Antloga" <radovan.antloga@xxxxxxxx>
  • To: <yunqa@xxxxxxxxxxxxx>
  • Date: Thu, 4 Jun 2009 09:45:48 +0200

Thank you Ralph !
You would probably add this to DISQLite3 to in next release.
I have done it already so I created new function:

function sqlite3_prepare(Db: sqlite3; const zSQL: PAnsiChar; nByte: integer;
 ppStmt: sqlite3_stmt_ptr; const pzTail: PPUtf8Char): Integer;
var
 Retries: integer;
begin
 Retries := 0;
 repeat
   Inc(Retries);
   Result := sqlite3_prepare_v2(DB, zSQL, nByte, ppStmt, pzTail);
 until (Retries > 1) or (Result <> SQLITE_SCHEMA);
end;

and replaced all sqlite3_prepare_v2 with new sqlite3_prepare.

Best Regards,
R.Antloga


----- Original Message ----- From: "Delphi Inspiration" <delphi@xxxxxxxx>
To: <yunqa@xxxxxxxxxxxxx>
Sent: 3. junij 2009 17:42
Subject: [yunqa.de] Re: SQLite metadata


At 12:50 01.06.2009, Radovan Antloga wrote:

I did add also that this can't be reproduced with sqlite3.exe.

I investigated further and found that sqlite3.exe encounters the same problem but works around it by calling sqlite3_prepare() a 2nd time after SQLITE_SCHEMA. I have appended http://www.sqlite.org/cvstrac/tktview?tn=3890 accordingly.

For DISQLite3 and Delphi, a similar workaround might look like this:

 Retries := 0;
 repeat
   Inc(Retries);
   e := sqlite3_prepare(Db2, 'select a from t', -1, @Stmt, nil);
 until (e <> SQLITE_SCHEMA) or (Retries > 1);

The full source code is in the attach.

Ralf


__________ Informacija od ESET NOD32 Antivirus, zbirka virusnih definicij 4129 (20090604) __________

To sporoèilo je preveril ESET NOD32 Antivirus.

http://www.eset.si



_______________________________________________
Delphi Inspiration mailing list
yunqa@xxxxxxxxxxxxx
//www.freelists.org/list/yunqa



Other related posts: