On Fri, Aug 03, 2007 at 06:42:39AM -0700, Joe Wilson wrote:

> Why do you think that the sqlite connection closes itself automatically?
> Did you examine the PHP wrapper code to verify it closes each connection
> in a timely fashion?

No, I read it months ago in some manual/tutorial - but cannot find it at the
moment to quote and/or give a link.

But making a simple try with a script which has just "sqlite_open" (then
some queries, or at least VACUUM) without closing "sqlite_close" shows, that
the tutorial was right. "lsof" doesn't show any lasting open connection after
such "improper" script has been run.

> Your trace seems to indicate it has 20 or so open 
> connections to the same database file in the same process.

I think, at last I've traced the problem:

One of the scripts doesn't make use out of database contents at all. But at
the beginning there was a simple check for database file presence, just to
let the user know, if there (from any reason) could be dbfile missing:

if ($dbhandle = sqlite_open("/path/to/database/dbfile.db", 0666, $sqliteerror)) 
{
  $result = sqlite_unbuffered_query($dbhandle, 'select something from 
some_table');
  sqlite_close($dbhandle);
} else {
  die($sqliteerror);
}


Yes, the "$result = ..." line can be omitted (it is now, anyway...), because
a successfull opening a database file is enough to check, whether the file
is present, or not (although without SELECT it may be any other database
file, with quite different tables).

My problem was caused by the fact, that there was a "SELECT" query, but
$result handle hasn't been processed any further. After commenting out the
"$result = ..." line there are no more "persistent" open database connections.


And the question: is it normal behaviour - or is it a bug in PHP-module?
I've got a feeling, that after "sqlite_close($dbhandle)" there should be
assumption, that the script will not use database anymore (until ev. next
"sqlite_open"), so all ev. other handles related to database contents should
be immediately removed.
-- 
                                pozdrawiam / regards

                                                Zbigniew Baniewski

-----------------------------------------------------------------------------
To unsubscribe, send email to [EMAIL PROTECTED]
-----------------------------------------------------------------------------

Reply via email to