Annotation of embedaddon/php/ext/pdo_mysql/tests/last_insert_id.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: PDO MySQL auto_increment / last insert id
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded('pdo') || !extension_loaded('pdo_mysql')) die('skip not loaded');
! 6: require dirname(__FILE__) . '/config.inc';
! 7: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
! 8: PDOTest::skip();
! 9: ?>
! 10: --FILE--
! 11: <?php
! 12: require dirname(__FILE__) . '/../../../ext/pdo/tests/pdo_test.inc';
! 13: $db = PDOTest::test_factory(dirname(__FILE__) . '/common.phpt');
! 14:
! 15: print_r($db->query("CREATE TABLE test (id int auto_increment primary key, num int)"));
! 16:
! 17: print_r($db->query("INSERT INTO test (id, num) VALUES (23, 42)"));
! 18:
! 19: print_r($db->query("INSERT INTO test (num) VALUES (451)"));
! 20:
! 21: print_r($db->lastInsertId());
! 22: --EXPECT--
! 23: PDOStatement Object
! 24: (
! 25: [queryString] => CREATE TABLE test (id int auto_increment primary key, num int)
! 26: )
! 27: PDOStatement Object
! 28: (
! 29: [queryString] => INSERT INTO test (id, num) VALUES (23, 42)
! 30: )
! 31: PDOStatement Object
! 32: (
! 33: [queryString] => INSERT INTO test (num) VALUES (451)
! 34: )
! 35: 24
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>