At 19:50 29.05.2009, Radovan Antloga wrote: >I have 2 connections. First create table. > From second I try to read from that table. >I get no such table. > >If you try to do same test with sqlite3.exe >it works ok. What could be reason for this? Works fine here. See project attached (copy below). 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 {$IFDEF FastMM}FastMM4, {$ENDIF}Windows, DISQLite3Api; //------------------------------------------------------------------------------ var Db1, Db2: sqlite3; Stmt: sqlite3_stmt; begin DeleteFile('test.db3'); { Open 2 database connections. } sqlite3_check(sqlite3_open('test.db3', @Db1)); sqlite3_check(sqlite3_open('test.db3', @Db2)); { 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.
{ 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 {$IFDEF FastMM}FastMM4, {$ENDIF}Windows, DISQLite3Api; //------------------------------------------------------------------------------ var Db1, Db2: sqlite3; Stmt: sqlite3_stmt; begin DeleteFile('test.db3'); { Open 2 database connections. } sqlite3_check(sqlite3_open('test.db3', @Db1)); sqlite3_check(sqlite3_open('test.db3', @Db2)); { 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.