|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-04-30 16:41 UTC] simen at lunarlounge dot org
Description:
------------
The SQLite extension fail to detect when a database file isn't writable:
Warning: sqlite_query() [function.sqlite-query]: (null) in test.php on line 12
Reproduce code:
---------------
# touch test.sqlite
# chmod 0600 sqlite
# sqlite test.sqlite
> CREATE TABLE store (id INTEGER PRIMARY KEY, doc TEXT);
$db = sqlite_open('test.sqlite');
$sql = "INSERT INTO store (id, doc) VALUES (1, 'foo')";
$result = sqlite_query($db, $sql);
Expected result:
----------------
Warning: sqlite_query() [function.sqlite-query]: attempt to write a readonly database in test.php on line 12
Actual result:
--------------
Warning: sqlite_query() [function.sqlite-query]: (null) in test.php on line 12
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 03:00:02 2025 UTC |
Never occured to me that this could be a bug, does the OO API handle this? function connect(){ try { if ( !$this->db_handle = @sqlite_open($this->db_name, 0666, $err) ){ if ($this->db_handle===false){ throw new DBEx('0: Could not open/create db or directory'); } else { throw new DBEx(sqlite_last_error($this->db_handle).': '. sqlite_error_string(sqlite_last_error($this->db_handle))); } } else { return true; } } catch (DBEx $ex){ $ex->borkage(); return false; } }