1--TEST--
2PDO_sqlite: Testing transaction
3--SKIPIF--
4<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
5--FILE--
6<?php
7
8$db = new PDO('sqlite::memory:');
9
10$db->beginTransaction();
11
12$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)');
13$db->commit();
14
15$db->beginTransaction();
16$db->query('INSERT INTO foobar VALUES (NULL, "PHP")');
17$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")');
18$db->rollback();
19
20$r = $db->query('SELECT COUNT(*) FROM foobar');
21var_dump($r->rowCount());
22
23
24$db->query('DROP TABLE foobar');
25
26?>
27--EXPECT--
28int(0)
29