Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unit tests #1486

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions source/pdo_sqlsrv/pdo_dbh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,7 +975,7 @@ zend_long pdo_sqlsrv_dbh_do(_Inout_ pdo_dbh_t *dbh, _In_ const zend_string *sql)
// since the user can give us a compound statement, we return the row count for the last set, and since the row count
// isn't guaranteed to be valid until all the results have been fetched, we fetch them all first.

if ( execReturn != SQL_NO_DATA && core_sqlsrv_has_any_result( driver_stmt )) {
if ( core_sqlsrv_has_any_result( driver_stmt )) {

SQLRETURN r = SQL_SUCCESS;

Expand All @@ -987,7 +987,6 @@ zend_long pdo_sqlsrv_dbh_do(_Inout_ pdo_dbh_t *dbh, _In_ const zend_string *sql)

} while ( r != SQL_NO_DATA );
}

// returning -1 forces PDO to return false, which signals an error occurred. SQLRowCount returns -1 for a number of cases
// naturally, so we override that here with no rows returned.
if( rows == -1 ) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ sets to PDO::SQLSRV_ATTR_DIRECT_QUERY
$conn->setAttribute(PDO::SQLSRV_ATTR_DIRECT_QUERY, true);

$tableName = 'pdo_direct_query';
$conn->query("DROP TABLE IF EXISTS $tableName");
$conn->query("CREATE TABLE $tableName ([c1_int] int, [c2_int] int)");

$v1 = 1;
Expand Down
4 changes: 3 additions & 1 deletion test/bvt/sqlsrv/msdn_sqlsrv_query_sqltype.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ if( $conn === false )
die( print_r( sqlsrv_errors(), true));
}

$d_sql = "delete from HumanResources.EmployeePayHistory where BusinessEntityId=6 and RateChangeDate='2005-06-07 00:00:00.000'";
$stmt = sqlsrv_query($conn, $d_sql);

/* Define the query. */
$tsql1 = "INSERT INTO HumanResources.EmployeePayHistory (BusinessEntityID,
RateChangeDate,
Expand Down Expand Up @@ -72,7 +75,6 @@ echo "Rate: ".$row['Rate']."\n";
echo "PayFrequency: ".$row['PayFrequency']."\n";

/* Revert the insert */
$d_sql = "delete from HumanResources.EmployeePayHistory where BusinessEntityId=6 and RateChangeDate='2005-06-07 00:00:00.000'";
$stmt = sqlsrv_query($conn, $d_sql);

/* Free statement and connection resources. */
Expand Down