[yunqa.de] Re: schema error

  • From: Delphi Inspiration <delphi@xxxxxxxx>
  • To: yunqa@xxxxxxxxxxxxx
  • Date: Wed, 08 Jul 2009 13:04:21 +0200

At 08:53 08.07.2009, Radovan Antloga wrote:

>I have installed latest DISQLite3 version and found that
>problem with schema error still exist. I have fixed source
>with your suggestion but would like to know do you plan
>to include this fix in next release?

The SQLITE_SCHEMA problem we discussed earlier on this list was subsequently 
corrected in the SQLite core: http://www.sqlite.org/cvstrac/chngview?cn=6769.

Hence my proposed sqlite3_prepare_internal() wrapper is no longer needed and 
was not added to DISQLite3. I have attached the test project once more to this 
message, it runs just fine with DISQLite3 2.0.8. Similar code is also part of 
my regression tests.

If you still experience the problem, your might not have properly upgraded to 
DISQLite3 2.0.8. Please check the result of sqlite3_libversion() to make sure 
you are linking against the correct version. It should report 3.6.16 for 
DISQLite3 2.0.8.

Ralf  
{ Visit the DISQLite3 Internet site for latest information and updates:

    http://www.yunqa.de/delphi/

  Copyright (c) 2009 Ralf Junker, The Delphi Inspiration <delphi@xxxxxxxx>

------------------------------------------------------------------------------ }

program DISQLite3_Multiple_Connections;

{$APPTYPE CONSOLE}
{$I DI.inc}
{$I DISQLite3.inc}

uses
  FastMM4,
  Windows,
  DISQLite3Api;

//------------------------------------------------------------------------------

var
  Db1, Db2: sqlite3;
  Stmt: sqlite3_stmt;
begin
  WriteLn(sqlite3_libversion); // Must report 3.6.16 or later.

  DeleteFile('test.db3');

  { Open 2 database connections. }

  sqlite3_check(sqlite3_open('test.db3', @Db1));
  sqlite3_check(sqlite3_open('test.db3', @Db2));

  sqlite3_exec_fast(Db1, 'pragma synchronous=full');
  sqlite3_exec_fast(Db2, 'pragma synchronous=full');

  { Create table in connection 1. }

  sqlite3_exec_fast(Db1, 'create table t(a)');
  sqlite3_exec_fast(Db1, 'insert into t values (1)');
  sqlite3_exec_fast(Db1, 'insert into t values (2)');

  { Use connection 2 to read from table created in connection 1. }

  sqlite3_check(sqlite3_prepare(Db2, 'select a from t', -1, @Stmt, nil), Db2);

  while sqlite3_check(sqlite3_step(Stmt), Db2) = SQLITE_ROW do
    WriteLn(sqlite3_column_str(Stmt, 0));

  sqlite3_check(sqlite3_finalize(Stmt), Db2);

  { Cleanup. }

  sqlite3_check(sqlite3_close(Db2), Db2);
  sqlite3_check(sqlite3_close(Db1), Db1);

  sqlite3_shutdown;

  WriteLn;
  WriteLn('Done - Press ENTER to Exit');
  ReadLn;
end.

Other related posts: