Req #51295 [Asn]: SQLite3::busyTimeout not existing

From: Date: Mon, 07 Jun 2010 05:00:56 +0000
Subject: Req #51295 [Asn]: SQLite3::busyTimeout not existing
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-151142@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=51295&edit=1

 ID:               51295
 Updated by:       magicaltux@php.net
 Reported by:      magicaltux@php.net
 Summary:          SQLite3::busyTimeout not existing
 Status:           Assigned
 Type:             Feature/Change Request
 Package:          SQLite related
 Operating System: Linux Gentoo 2.6.33
 PHP Version:      5.3SVN-2010-03-14 (SVN)
 Assigned To:      scottmac

 New Comment:

Ok, I had some troubles to make a meaningful test for this bug (the php
function 
is just calling the equivalent sqlite function), but in the end I got
this.

http://ookoo.org/svn/snip/20100607_php_test_bug51295.php
(didn't manage
to 
attache this to this bug report, even renamed as .txt)

Anyway here it is. It forks, open a sqlite file and locks it, then the
other 
process will try to access it with a 1 second busyTimeout then dumps the
waited 
time and the result (should have failed with a 1 second delay with +/-
10ms)

Remaining steps includes converting this test to phpt and run it once to
get the 
"right" output (I'll need to check doc to find the right format for phpt
since 
it's been a while).


Previous Comments:
------------------------------------------------------------------------
[2010-03-14 08:29:39] magicaltux@php.net

Description:
------------
In SQLite3, method busyTimeout() is missing, and by default there is no
busy 
handler.

In old SQLite extension, a default timeout of 60 seconds was set, and a

busyTimeout() method was available to define the timeout.

I recently started with SQLite3 to have this kind of errors as load was
growing 
on SELECT statement:

Warning: SQLite3Stmt::execute(): Unable to execute statement: database
is locked

Some internet research showed that this could be fixed by setting a
different 
busy timeout, and I noticed PHP wasn't setting any on SQLite3.

While I'm unsure about setting a default busyTimeout on SQLite3 (it
currently 
have none, but PHP_5_3 is still young enough to change this kind of
behaviour) 
it should be at least possible to set one.

Patch to add a SQLite3::busyTimeout() method (same behaviour as old 
SQLite::busyTimeout() method, with the exception this one has a
true/false 
return value, while sqlite3_busy_timeout will always return SQLITE_OK,
it may 
change in the future).

The patch:

https://ookoo.org/svn/snip/php_5_3-sqlite3-busytimeout-method.patch



------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=51295&edit=1


Thread (6 messages)

« previous php.bugs (#151142) next »