Test Failure Report for ext/pdo_odbc/tests/pdo_017.phpt ('ODBC PDO Common: transactions')
Script
1:
<?php 2: if (getenv('REDIR_TEST_DIR') === false) putenv('REDIR_TEST_DIR='.dirname(__FILE__) . '/../../pdo/tests/'); 3: require_once getenv('REDIR_TEST_DIR') . 'pdo_test.inc'; 4: $db = PDOTest::factory(); 5: 6: if ($db->getAttribute(PDO::ATTR_DRIVER_NAME) == 'mysql') { 7: require_once(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'mysql_pdo_test.inc'); 8: $suf = ' ENGINE=' . MySQLPDOTest::detect_transactional_mysql_engine($db); 9: } else { 10: $suf = ''; 11: } 12: 13: $db->exec('CREATE TABLE test(id INT NOT NULL PRIMARY KEY, val VARCHAR(10))'.$suf); 14: $db->exec("INSERT INTO test VALUES(1, 'A')"); 15: $db->exec("INSERT INTO test VALUES(2, 'B')"); 16: $db->exec("INSERT INTO test VALUES(3, 'C')"); 17: $delete = $db->prepare('DELETE FROM test'); 18: 19: function countRows($action) { 20: global $db; 21: $select = $db->prepare('SELECT COUNT(*) FROM test'); 22: $select->execute(); 23: $res = $select->fetchColumn(); 24: return "Counted $res rows after $action.\n"; 25: } 26: 27: echo countRows('insert'); 28: 29: $db->beginTransaction(); 30: $delete->execute(); 31: echo countRows('delete'); 32: $db->rollBack(); 33: 34: echo countRows('rollback'); 35: 36: $db->beginTransaction(); 37: $delete->execute(); 38: echo countRows('delete'); 39: $db->commit(); 40: 41: echo countRows('commit'); 42: 43: ?> 44:
Expected
Counted 3 rows after insert.
Counted 0 rows after delete.
Counted 3 rows after rollback.
Counted 0 rows after delete.
Counted 0 rows after commit.
Output
Counted 3 rows after insert.
Counted 0 rows after delete.
Counted 0 rows after rollback.
Counted 0 rows after delete.
Counted 0 rows after commit.
Diff
# original source file: ext/pdo/tests/pdo_017.phpt
003+ Counted 0 rows after rollback.
003- Counted 3 rows after rollback.
Generated at Sun, 19 May 2013 20:27:25 +0000 (5 days ago)
|