I usually used PDO with new PDO('sqlite:test.log'); to write in Sqlite3 databases with PHP.
Now, for a performance comparison, I'd like to try using the SQLite3 PHP class :
$db = new SQLite3('test.db');
$db->query("CREATE TABLE IF NOT EXISTS log (a, b, d);");
$stmt = $db->prepare("INSERT INTO log VALUES (?, ?, ?);");
$stmt->execute(array("a", date("Y-m-d\TH:i:sO"), 123));
Unfortunately, after this code is executed, nothing seems to be written: SELECT * from log gives no row.
What's wrong in my code?
I also tried $db->commit(); or $db->query('COMMIT;') without success.
Context: I usually use PDO, but I noticed it takes ~ 50 ms for a simple 1) open of the DB, 2) add a row, 3) commit and close. So I was curious if it was any better with Sqlite3 class instead of PDO. Result: it's the same: ~ 50 ms.