1--TEST-- 2PDO_sqlite: Testing transaction 3--EXTENSIONS-- 4pdo_sqlite 5--FILE-- 6<?php 7 8$db = new PDO('sqlite::memory:'); 9$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_WARNING); 10 11$db->beginTransaction(); 12 13$db->query('CREATE TABLE test_pdo_sqlite_transaction (id INT AUTO INCREMENT, name TEXT)'); 14$db->commit(); 15 16$db->beginTransaction(); 17$db->query('INSERT INTO test_pdo_sqlite_transaction VALUES (NULL, "PHP"), (NULL, "PHP6")'); 18$db->rollback(); 19 20$r = $db->query('SELECT COUNT(*) FROM test_pdo_sqlite_transaction'); 21var_dump($r->rowCount()); 22 23$db->query('DROP TABLE test_pdo_sqlite_transaction'); 24 25?> 26--EXPECTF-- 27int(0) 28 29Warning: PDO::query(): SQLSTATE[HY000]: General error: 6 database table is locked in %s on line %d 30