mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
29 lines
586 B
PHP
29 lines
586 B
PHP
--TEST--
|
|
PDO_sqlite: Testing transaction
|
|
--SKIPIF--
|
|
<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?>
|
|
--FILE--
|
|
<?php
|
|
|
|
$db = new pdo('sqlite::memory:');
|
|
|
|
$db->beginTransaction();
|
|
|
|
$db->query('CREATE TABLE IF NOT EXISTS foobar (id INT AUTO INCREMENT, name TEXT)');
|
|
$db->commit();
|
|
|
|
$db->beginTransaction();
|
|
$db->query('INSERT INTO foobar VALUES (NULL, "PHP")');
|
|
$db->query('INSERT INTO foobar VALUES (NULL, "PHP6")');
|
|
$db->rollback();
|
|
|
|
$r = $db->query('SELECT COUNT(*) FROM foobar');
|
|
var_dump($r->rowCount());
|
|
|
|
|
|
$db->query('DROP TABLE foobar');
|
|
|
|
?>
|
|
--EXPECTF--
|
|
int(0)
|