From fc8433ac839e4840994a05ba4fb759c162384e92 Mon Sep 17 00:00:00 2001 From: v-dareck Date: Thu, 9 Feb 2017 16:41:39 -0800 Subject: [PATCH] Fix error message in close cursor. Change prepare to query in test. --- source/pdo_sqlsrv/pdo_stmt.cpp | 6 +++--- test/pdo_sqlsrv/pdo_267_closeCursor.phpt | 11 +++++------ 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/source/pdo_sqlsrv/pdo_stmt.cpp b/source/pdo_sqlsrv/pdo_stmt.cpp index 06a2cbca..d8b086a7 100644 --- a/source/pdo_sqlsrv/pdo_stmt.cpp +++ b/source/pdo_sqlsrv/pdo_stmt.cpp @@ -393,11 +393,11 @@ int pdo_sqlsrv_stmt_close_cursor(pdo_stmt_t *stmt TSRMLS_DC) try { - SQLSRV_ASSERT( stmt != NULL, "pdo_sqlsrv_stmt_next_rowset: pdo_stmt object was null" ); + SQLSRV_ASSERT( stmt != NULL, "pdo_sqlsrv_stmt_close_cursor: pdo_stmt object was null" ); sqlsrv_stmt* driver_stmt = reinterpret_cast( stmt->driver_data ); - SQLSRV_ASSERT( driver_stmt != NULL, "pdo_sqlsrv_stmt_next_rowset: driver_data object was null" ); + SQLSRV_ASSERT( driver_stmt != NULL, "pdo_sqlsrv_stmt_close_cursor: driver_data object was null" ); // to "close the cursor" means we make the statement ready for execution again. To do this, we // skip all the result sets on the current statement. @@ -415,7 +415,7 @@ int pdo_sqlsrv_stmt_close_cursor(pdo_stmt_t *stmt TSRMLS_DC) } catch( ... ) { - DIE( "pdo_sqlsrv_stmt_next_rowset: Unknown exception occurred while advanding to the next result set." ); + DIE( "pdo_sqlsrv_stmt_close_cursor: Unknown exception occurred while advancing to the next result set." ); } return 1; diff --git a/test/pdo_sqlsrv/pdo_267_closeCursor.phpt b/test/pdo_sqlsrv/pdo_267_closeCursor.phpt index 9668f19c..b49bdf20 100644 --- a/test/pdo_sqlsrv/pdo_267_closeCursor.phpt +++ b/test/pdo_sqlsrv/pdo_267_closeCursor.phpt @@ -27,18 +27,17 @@ try var_dump($ret); - // prepare two stmt, execute, and fetch, then closeCursor. + // use two stmt, execute, and fetch, then closeCursor. // use one with client side buffering. - $stmt1 = $conn->prepare("select 123 as 'IntCol'"); + $stmt1 = $conn->query("select 123 as 'IntCol'"); $stmt2 = $conn->prepare("select 'abc' as 'Charcol'", array(PDO::ATTR_CURSOR => PDO::CURSOR_SCROLL, PDO::SQLSRV_ATTR_CURSOR_SCROLL_TYPE => PDO::SQLSRV_CURSOR_BUFFERED)); - $stmt1->execute(); - $result = $stmt1->fetch(PDO::FETCH_NUM); + $result = $stmt1->fetch(PDO::FETCH_NUM); print_r($result[0]); echo "\n"; $ret = $stmt1->closeCursor(); var_dump($ret); - $stmt2->execute(); - $result = $stmt2->fetch(PDO::FETCH_NUM); + $stmt2->execute(); + $result = $stmt2->fetch(PDO::FETCH_NUM); print_r($result[0]); echo "\n"; $ret = $stmt2->closeCursor();