#49518 [Com]: can't open encrypted sqlite3 database
| From: | wjzhhr at gmail dot com | Date: | Fri, 11 Sep 2009 00:45:24 +0000 |
| Subject: | #49518 [Com]: can't open encrypted sqlite3 database | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142235@lists.php.net to get a copy of this message | ||
ID: 49518
Comment by: wjzhhr at gmail dot com
Reported By: wjzhhr at gmail dot com
Status: Feedback
Bug Type: SQLite related
Operating System: windwos xp
PHP Version: 5.3.0
New Comment:
I use wxsqlite3-1.9.5 to create sqlite3 database, and the key is 1.
if I use sqlite3shell.exe open "x.db",the result will right.
I never use sqlite2,always use sqlite3.
Previous Comments:
------------------------------------------------------------------------
[2009-09-10 13:12:05] scottmac@php.net
Pretty sure wxSQLite is SQLite2 and you need wxSQLite3.
------------------------------------------------------------------------
[2009-09-10 09:58:52] sjoerd@php.net
Does it work when you supply the right encryption key as the third
parameter?
SQLite3::__construct ( string $filename [, int $flags [, string
$encryption_key ]] )
------------------------------------------------------------------------
[2009-09-10 08:15:49] wjzhhr at gmail dot com
Description:
------------
can't open encrypted database which created by wxSQLite.
<?php
$db = new SQLite3('x.db',SQLITE3_OPEN_READONLY,"1");
$db->exec("PRAGMA KEY='1'");
$result = $db->query('SELECT * FROM xxx');
var_dump($result->fetchArray());
?>
Warning: SQLite3::query(): Unable to prepare statement: 26, file is
encrypted or is not a database
Reproduce code:
---------------
---
From manual page: sqlite3.open
---
Expected result:
----------------
my table: CREATE TABLE xxx(iswho text,itimes int);
liming|1
xiaojie|2
two records.
Expected result:
array(4) {
[0]=>
string(6) "liming"
["iswho"]=>
string(6) "liming"
[1]=>
int(1)
["itimes"]=>
int(1)
}
Actual result:
--------------
Warning: SQLite3::query(): Unable to prepare statement: 26, file is
encrypted or is not a database
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49518&edit=1