Annotation of embedaddon/php/ext/pdo_pgsql/tests/bug_49985.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Bug #49985 (pdo_pgsql prepare() re-use previous aborted transaction)
! 3: --SKIPIF--
! 4: <?php
! 5: if (!extension_loaded('pdo') || !extension_loaded('pdo_pgsql')) 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: $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
! 15:
! 16: $db->exec("CREATE TABLE test (a int PRIMARY KEY)");
! 17:
! 18: for ($i = 0; $i < 3; $i++) {
! 19: try {
! 20: $db->beginTransaction();
! 21: $stmt = $db->prepare("INSERT INTO test (a) VALUES (?)");
! 22: var_dump($stmt->execute(array(1)));
! 23: $db->commit();
! 24: } catch (Exception $e) {
! 25: echo trim(current(explode("\n", $e->getMessage())))."\n";
! 26: $db->rollback();
! 27: }
! 28: }
! 29:
! 30: ?>
! 31: --EXPECTF--
! 32: bool(true)
! 33: SQLSTATE[23505]: %s"test_pkey"
! 34: SQLSTATE[23505]: %s"test_pkey"
! 35:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>