Skip to content

Commit

Permalink
Merge pull request #818 from david-puglielli/connres-test-fixes
Browse files Browse the repository at this point in the history
Fixed output for sqlsrv connres tests
  • Loading branch information
david-puglielli authored Jul 20, 2018
2 parents 6f0f4b7 + 6ee8c44 commit bd34cab
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 98 deletions.
62 changes: 13 additions & 49 deletions test/functional/sqlsrv/connection_resiliency.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ $stmt6 = sqlsrv_query( $conn, "SELECT * FROM $tableName2" );
if( $stmt6 === false )
{
echo "Error in statement 6.\n";
print_r( sqlsrv_errors() );
$err = sqlsrv_errors();
if (strpos($err[0][0], '08S01')===false or
(strpos($err[0][2], 'TCP Provider:')===false and strpos($err[0][2], 'SMux Provider:')===false and strpos($err[0][2], 'Session Provider:')===false)) {
echo "Error: Wrong error message.\n";
print_r($err);
}
}
else
{
Expand Down Expand Up @@ -188,7 +193,12 @@ $stmt8 = sqlsrv_query( $conn, "SELECT * FROM $tableName2" );
if( $stmt8 === false )
{
echo "Error in statement 8.\n";
print_r( sqlsrv_errors() );
$err = sqlsrv_errors();
if (strpos($err[0][0], 'IMSSP')===false or
strpos($err[0][2], 'The connection cannot process this operation because there is a statement with pending results')===false) {
echo "Error: Wrong error message.\n";
print_r($err);
}
}
else
{
Expand All @@ -199,7 +209,7 @@ sqlsrv_close( $conn );
sqlsrv_close( $conn_break );

?>
--EXPECTREGEX--
--EXPECT--
Statement 1 successful.
16 rows in result set.
Statement 2 successful.
Expand All @@ -211,51 +221,5 @@ Statement 4 successful.
Statement 5 successful.
rows in result set.
Error in statement 6.
Array
\(
\[0\] => Array
\(
\[0\] => 08S01
\[SQLSTATE\] => 08S01
\[1\] => (10054|104)
\[code\] => (10054|104)
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746)
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746)
\)

\[1\] => Array
\(
\[0\] => 08S01
\[SQLSTATE\] => 08S01
\[1\] => (10054|104)
\[code\] => (10054|104)
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
\)

\)
Statement 7 successful.
Error in statement 8.
Array
\(
\[0\] => Array
\(
\[0\] => IMSSP
\[SQLSTATE\] => IMSSP
\[1\] => -44
\[code\] => -44
\[2\] => The connection cannot process this operation because there is a statement with pending results. To make the connection available for other queries, either fetch all results or cancel or free the statement. For more information, see the product documentation about the MultipleActiveResultSets connection option.
\[message\] => The connection cannot process this operation because there is a statement with pending results. To make the connection available for other queries, either fetch all results or cancel or free the statement. For more information, see the product documentation about the MultipleActiveResultSets connection option.
\)

\[1\] => Array
\(
\[0\] => HY000
\[SQLSTATE\] => HY000
\[1\] => 0
\[code\] => 0
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Connection is busy with results for another command
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Connection is busy with results for another command
\)

\)
32 changes: 7 additions & 25 deletions test/functional/sqlsrv/connection_resiliency_prepare_transact.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -167,40 +167,22 @@ else
else
{
echo "Statement not valid and rollback failed.\n";
print_r( sqlsrv_errors() );
$err = sqlsrv_errors();
if (strpos($err[0][0], '08S02')===false or
(strpos($err[0][2], 'TCP Provider:')===false and strpos($err[0][2], 'SMux Provider:')===false and strpos($err[0][2], 'Session Provider:')===false)) {
echo "Error: Wrong error message.\n";
print_r($err);
}
}
}

sqlsrv_close( $conn );
sqlsrv_close( $conn_break );
?>
--EXPECTREGEX--
--EXPECT--
Statement 1 prepared.
Statement 1 executed.
Transaction begun.
Transaction was committed.
Transaction begun.
Statement not valid and rollback failed.
Array
\(
\[0\] => Array
\(
\[0\] => 08S02
\[SQLSTATE\] => 08S02
\[1\] => (10054|-1)
\[code\] => (10054|-1)
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\](TCP Provider: An existing connection was forcibly closed by the remote host\.\n|SMux Provider: Physical connection is not usable \[xFFFFFFFF\]\. )
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\](TCP Provider: An existing connection was forcibly closed by the remote host\.\n|SMux Provider: Physical connection is not usable \[xFFFFFFFF\]\. )
\)

\[1\] => Array
\(
\[0\] => 08S02
\[SQLSTATE\] => 08S02
\[1\] => (10054|-1)
\[code\] => (10054|-1)
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Unable to open a logical session
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Unable to open a logical session
\)

\)
30 changes: 6 additions & 24 deletions test/functional/sqlsrv/connection_resiliency_timeouts.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@ $stmt1 = sqlsrv_query( $conn, "SELECT * FROM $tableName1" );
if( $stmt1 === false )
{
echo "Error in statement 1.\n";
print_r( sqlsrv_errors() );
$err = sqlsrv_errors();
if (strpos($err[0][0], '08S01')===false or
(strpos($err[0][2], 'TCP Provider:')===false and strpos($err[0][2], 'SMux Provider:')===false and strpos($err[0][2], 'Session Provider:')===false)) {
echo "Error: Wrong error message.\n";
print_r($err);
}
}
else
{
Expand Down Expand Up @@ -78,27 +83,4 @@ DropTables( $server, $uid, $pwd, $tableName1, $tableName2 )
?>
--EXPECTREGEX--
Error in statement 1.
Array
\(
\[0\] => Array
\(
\[0\] => 08S01
\[SQLSTATE\] => 08S01
\[1\] => (10054|104)
\[code\] => (10054|104)
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746)
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x68|Error code 0x2746)
\)

\[1\] => Array
\(
\[0\] => 08S01
\[SQLSTATE\] => 08S01
\[1\] => (10054|104)
\[code\] => (10054|104)
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
\)

\)
Statement 2 successful.

0 comments on commit bd34cab

Please sign in to comment.