diff options
Diffstat (limited to 'ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt')
-rw-r--r-- | ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt b/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt new file mode 100644 index 0000000..2ff0acd --- /dev/null +++ b/ext/pdo_sqlite/tests/pdo_sqlite_lastinsertid.phpt @@ -0,0 +1,32 @@ +--TEST-- +PDO_sqlite: Testing lastInsertId() +--SKIPIF-- +<?php if (!extension_loaded('pdo_sqlite')) print 'skip not loaded'; ?> +--FILE-- +<?php + +$db = new pdo('sqlite::memory:'); +$db->query('CREATE TABLE IF NOT EXISTS foo (id INT AUTO INCREMENT, name TEXT)'); +$db->query('INSERT INTO foo VALUES (NULL, "PHP")'); +$db->query('INSERT INTO foo VALUES (NULL, "PHP6")'); +var_dump($db->query('SELECT * FROM foo')); +var_dump($db->errorInfo()); +var_dump($db->lastInsertId()); + +$db->query('DROP TABLE foo'); + +?> +--EXPECTF-- +object(PDOStatement)#2 (1) { + ["queryString"]=> + %string|unicode%(17) "SELECT * FROM foo" +} +array(3) { + [0]=> + %string|unicode%(5) "00000" + [1]=> + NULL + [2]=> + NULL +} +%string|unicode%(1) "2" |