From 18d26338ad3683b5977579e91aad432f161ed5c8 Mon Sep 17 00:00:00 2001 From: v-kaywon Date: Thu, 13 Apr 2017 13:00:54 -0700 Subject: [PATCH] change test description in pdo_transaction.phpt --- test/pdo_sqlsrv/pdo_transaction.phpt | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/test/pdo_sqlsrv/pdo_transaction.phpt b/test/pdo_sqlsrv/pdo_transaction.phpt index 9ea26f48..28d395ce 100644 --- a/test/pdo_sqlsrv/pdo_transaction.phpt +++ b/test/pdo_sqlsrv/pdo_transaction.phpt @@ -1,5 +1,6 @@ --TEST-- -starts a transaction, delete rows and rollback the transaction +starts a transaction, delete rows and rollback the transaction then +starts a transaction, delete rows and commit --SKIPIF-- --FILE-- @@ -9,14 +10,14 @@ starts a transaction, delete rows and rollback the transaction $conn = new PDO( "sqlsrv:Server=$serverName; Database = tempdb ", $username, $password); $conn->exec("IF OBJECT_ID('Table1', 'U') IS NOT NULL DROP TABLE Table1"); - $conn->exec("CREATE TABLE Table1(col1 CHARACTER(1), col2 CHARACTER(1)) "); + $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') "); + $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 but roll back $conn->beginTransaction(); - $rows = $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"); @@ -28,18 +29,18 @@ starts a transaction, delete rows and rollback the transaction //revert the inserts then commit $conn->beginTransaction(); - $rows = $conn->exec("delete from Table1 where col1 = 'a'"); + $rows = $conn->exec("DELETE FROM Table1 WHERE col1 = 'a'"); $conn->commit(); echo $rows." rows affected\n"; - $stmt = $conn->query("select * from Table1"); + $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 "); + $conn->exec("DROP TABLE Table1"); //free statement and connection $stmt = NULL;