diff --git a/test/pdo_sqlsrv/pdo_commit.phpt b/test/pdo_sqlsrv/pdo_commit.phpt deleted file mode 100644 index f44ffd36..00000000 --- a/test/pdo_sqlsrv/pdo_commit.phpt +++ /dev/null @@ -1,38 +0,0 @@ ---TEST-- -starts a transaction, delete rows and commit the transaction ---SKIPIF-- - ---FILE-- -exec("IF OBJECT_ID('Table1', 'U') IS NOT NULL DROP TABLE Table1"); - $conn->exec("CREATE TABLE Table1(col1 CHARACTER(1), col2 CHARACTER(1)) "); - - $ret = $conn->exec("insert into Table1(col1, col2) values('a', 'b') "); - $ret = $conn->exec("insert into Table1(col1, col2) values('a', 'c') "); - - //revert the inserts - $conn->beginTransaction(); - $rows = $conn->exec("delete from Table1 where col1 = 'a'"); - $conn->commit(); - echo $rows." rows affected\n"; - - $stmt = $conn->query("select * from Table1"); - if ( count( $stmt->fetchAll() ) == 0 ) - echo "Transaction committed successfully\n"; - else - echo "Transaction failed to commit\n"; - - //drop the created temp table - $conn->exec("DROP TABLE Table1 "); - - //free statement and connection - $stmt = NULL; - $conn = NULL; -?> ---EXPECT-- -2 rows affected -Transaction committed successfully \ No newline at end of file diff --git a/test/pdo_sqlsrv/pdo_rollback.phpt b/test/pdo_sqlsrv/pdo_transaction.phpt similarity index 62% rename from test/pdo_sqlsrv/pdo_rollback.phpt rename to test/pdo_sqlsrv/pdo_transaction.phpt index 2ef5d345..9ea26f48 100644 --- a/test/pdo_sqlsrv/pdo_rollback.phpt +++ b/test/pdo_sqlsrv/pdo_transaction.phpt @@ -14,9 +14,9 @@ starts a transaction, delete rows and rollback the transaction $ret = $conn->exec("insert into Table1(col1, col2) values('a', 'b') "); $ret = $conn->exec("insert into Table1(col1, col2) values('a', 'c') "); - //revert the inserts + //revert the inserts but roll back $conn->beginTransaction(); - $ret = $conn->exec("delete from Table1 where col1 = 'a'"); + $rows = $conn->exec("delete from Table1 where col1 = 'a'"); $conn->rollback(); $stmt = $conn->query("SELECT * FROM Table1"); @@ -25,14 +25,27 @@ starts a transaction, delete rows and rollback the transaction echo "Transaction rolled back successfully\n"; else echo "Transaction failed to roll back\n"; + + //revert the inserts then commit + $conn->beginTransaction(); + $rows = $conn->exec("delete from Table1 where col1 = 'a'"); + $conn->commit(); + echo $rows." rows affected\n"; + + $stmt = $conn->query("select * from Table1"); + if ( count( $stmt->fetchAll() ) == 0 ) + echo "Transaction committed successfully\n"; + else + echo "Transaction failed to commit\n"; //drop the created temp table $conn->exec("DROP TABLE Table1 "); //free statement and connection - $ret=NULL; $stmt = NULL; - $conn=NULL; + $conn = NULL; ?> --EXPECT-- -Transaction rolled back successfully \ No newline at end of file +Transaction rolled back successfully +2 rows affected +Transaction committed successfully \ No newline at end of file