ID: 29476
Updated by: iliaa@php.net
Reported By: hugo_pl at users dot sourceforge dot net
-Status: Assigned
+Status: Closed
Bug Type: SQLite related
Operating System: *
PHP Version: 5.1.3RC3
Assigned To: iliaa
New Comment:
This bug has been fixed in CVS.
Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2006-04-11 11:52:24] sniper@php.net
Assigned to sqlite guru Ilia.
------------------------------------------------------------------------
[2006-04-09 00:10:09] nforbes@php.net
Same error with 5.1.2 (release). However, on 5.1.3-dev,
the script simply hangs. Tested using the above, posted by
jwellis.
------------------------------------------------------------------------
[2005-11-18 16:07:22] jwellis at carlalbert dot edu
This is still a problem in PHP 5.1.0RC5-dev.
here is my reproduction code:
----------------------------
$database_path = "sqlite_db1";
$db = new SQLiteDatabase($database_path);
// sqlite_db1 has a table called t1 with the colums id (int) and stuff
(text) //
$db->query("INSERT INTO t1 (stuff) VALUES ('something');", SQLITE_NUM,
$db_error);
print $db->changes() ." rows affected<br>\n";
//-----// This is the part that breaks it //-----//
$table_cols = $db->fetchColumnTypes("t1", SQLITE_ASSOC);
foreach($table_cols as $col => $type) {
print"\t$col: $type<br>\n";
}
//-------------------------------------------------//
$db->query("INSERT INTO t1 (stuff) VALUES ('something');", SQLITE_NUM,
$db_error);
print $db->changes() ." rows affected<br>\n";
------------------------------------------------------------------------
[2005-03-06 22:09:42] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
------------------------------------------------------------------------
[2004-08-25 06:56:48] hugo_pl at users dot sourceforge dot net
Hi
I think that this is a PHP bug, I made a better exemple to
show this bug:
<pre>
<?php
try {
$db = new SQLiteDatabase('./test.db');
$db->busyTimeout(1000);
// table exists?
$exists = $db->singleQuery('SELECT count(*) FROM
sqlite_master WHERE tbl_name=\'bugtest\'');
if (!$exists)
$db->query('CREATE TABLE bugtest (a, b, c,
d);');
// Without this line all runs Ok.
$db->fetchColumnTypes('bugtest');
$db->query('INSERT INTO bugtest VALUES (1, 2, 3,
4)');
echo 'Res: <br>';
print_r( $db->arrayQuery('SELECT * FROM bugtest',
SQLITE_ASSOC) );
}
catch (Exception $e)
{
echo 'Exception: ', $e->getMessage();
}
?>
The first time you run this script all appear to be Ok...
the insert query is executed, etc... but the second time
is displayed a message:
Warning: SQLiteDatabase::query() [function.query]:
database is locked in /home/hugo/public_html/phpbug.php on
line 16
Nothing is wrong with the script, if this message appear
something is wrong with PHP.... on windows the same bug
occur, then it is not a problem from SQLite or Apache
compiled by me under linux.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29476
--
Edit this bug report at http://bugs.php.net/?id=29476&edit=1