Hello John,
Thank you for your answer but I suspect this is not the reason for the
following cases:
1. I modified the code to check for the sqlite3_close return value and it
never fails; the error keeps happening though
2. If I remove completely the sqlite3_close statement, the error still
occurs
3. In my actual application, I don't open so many dbs: I open about 7 and I
do many transactions in each one (and do not close them until program exit).
4. The problem is related to this post:
http://www.mail-archive.com/sqlite-users@sqlite.org/msg15494.html My case is
exactly the same (although I cannot step into the c code to see what is
happening).
5. Why does the error goes away when I set 'PRAGMA synchronous = off;'?

I am afraid it is somehow related with the file handling routines and WinXP
but I don't have the slightest idea what to do: the problem is that this is
a really serious issue and, if it is not my fault, a show-stopper for winXP
usage of SQLITE3.

Costas


> -----Original Message-----
> From: John Stanton [mailto:[EMAIL PROTECTED]
> Sent: Κυριακή, 4 Ιουνίου 2006 4:05 πμ
> To: sqlite-users@sqlite.org
> Subject: Re: [sqlite] Random error SQLITE_CANTOPEN on Windows XP SP2 with
> sqlite3_exec
> 
> You don't test for an error on your close statement.  I suspect that the
> Sqlite databases are not being closed because activity is not finalized.
>     Your error pops up when you have a very large number of databases
open.
> JS
> 
> Costas Stergiou wrote:
> > Hello everyone,
> >
> > I lately came upon a very strange error that occurs at random times. I
> > managed to trace down and produce a small piece of code to reproduce it.
> >
> > I am using Delphi and the sqlite3.dll (latest) but I am sure that this
> error
> > is not related to something other than the engine. Here is a code that
> > produces this error (read almost like pseudo-code):
> >
> >
> >
> > var
> >
> >   i, j: Integer;
> >
> >   s: String;
> >
> >   db: pointer;
> >
> >   MSG: pchar;
> >
> > begin
> >
> >   for i:=1 to 30 do begin
> >
> >     s := 'testsqlite3_' + inttostr(i) + '.db3';
> >
> >     deletefile(s);
> >
> >   end;
> >
> >
> >
> >   for i:=1 to 30 do begin
> >
> >     s := 'testsqlite3_' + inttostr(i) + '.db3';
> >
> >     sqlite3_open(pchar(s), db);
> >
> >     //sql_exec(db, 'PRAGMA synchronous = off;');
> >
> >     Assert( sqlite3_exec(db, pchar('create table t1(i1 int, i2 int)'),
> nil,
> > nil, msg) = SQLITE_OK );
> >
> >     Assert( sqlite3_exec(db, pchar('create table t2(i1 int, i2 int)'),
> nil,
> > nil, msg) = SQLITE_OK );
> >
> >     sqlite3_close(db);
> >
> >   end;
> >
> > end;
> >
> >
> >
> > What I am doing here is just creating 20 test databases and creating 2
> > tables in each one of these. That's all.
> >
> > To repeat this error, the code above may need to be repeated some times
> > (some time it gives the error, some other it doesn't). Between
> invocations
> > of the code it would be good to wait 1 second (I put it on a form and
> > associate it with a button; then I press the button repeatedly until I
> get
> > the error, usually in 2-3 clicks).
> >
> >
> >
> > Now, if I uncomment the "PRAGMA synchronous=off" command, the error goes
> > away!
> >
> > Also, if I remove the second create table command, I have no problem
> again
> > (the problem is not associated with the 'create table command'
actually).
> >
> >
> >
> > Any help or insight on the above will be very valuable since I am
> completely
> > stack with it.
> >
> > Thanks,
> >
> > Costas
> >


Reply via email to