Moved error checking inside pdo connres tests
This commit is contained in:
parent
820bc3199e
commit
0f66c4848b
|
@ -161,7 +161,11 @@ try {
|
|||
echo $rowcount." rows in result set.\n";
|
||||
} catch (PDOException $e) {
|
||||
echo "Error executing statement 6.\n";
|
||||
print_r($e->getMessage());
|
||||
$err = $e->getMessage();
|
||||
if (strpos($err, 'SQLSTATE[08S02]')===false or (strpos($err, 'TCP Provider')===false and strpos($err, 'SMux Provider')===false)) {
|
||||
echo "Error: Wrong error message.\n";
|
||||
print_r($err);
|
||||
}
|
||||
}
|
||||
|
||||
unset($conn);
|
||||
|
@ -200,25 +204,28 @@ try {
|
|||
}
|
||||
} catch (PDOException $e) {
|
||||
echo "Error executing statement 8.\n";
|
||||
print_r($e->getMessage());
|
||||
$err = $e->getMessage();
|
||||
if (strpos($err, 'SQLSTATE[IMSSP]')===false or strpos($err, 'The connection cannot process this operation because there is a statement with pending results')===false) {
|
||||
echo "Error: Wrong error message.\n";
|
||||
print_r($err);
|
||||
}
|
||||
}
|
||||
|
||||
unset($conn);
|
||||
unset($conn_break);
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Statement 1 successful\.
|
||||
16 rows in result set\.
|
||||
Statement 2 successful\.
|
||||
9 rows in result set\.
|
||||
Statement 3 successful\.
|
||||
-1 rows in result set\.
|
||||
Statement 4 successful\.
|
||||
-1 rows in result set\.
|
||||
Statement 5 successful\.
|
||||
-1 rows in result set\.
|
||||
Error executing statement 6\.
|
||||
SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x20)Statement 7 successful\.
|
||||
Error executing statement 8\.
|
||||
SQLSTATE\[IMSSP\]: 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.
|
||||
--EXPECT--
|
||||
Statement 1 successful.
|
||||
16 rows in result set.
|
||||
Statement 2 successful.
|
||||
9 rows in result set.
|
||||
Statement 3 successful.
|
||||
-1 rows in result set.
|
||||
Statement 4 successful.
|
||||
-1 rows in result set.
|
||||
Statement 5 successful.
|
||||
-1 rows in result set.
|
||||
Error executing statement 6.
|
||||
Statement 7 successful.
|
||||
Error executing statement 8.
|
||||
|
|
|
@ -190,7 +190,12 @@ try
|
|||
}
|
||||
catch ( PDOException $e )
|
||||
{
|
||||
print_r( $e->getMessage() );
|
||||
echo "Transaction failed.\n";
|
||||
$err = $e->getMessage();
|
||||
if (strpos($err, 'SQLSTATE[08S02]')===false or (strpos($err, 'TCP Provider')===false and strpos($err, 'SMux Provider')===false)) {
|
||||
echo "Error: Wrong error message.\n";
|
||||
print_r($err);
|
||||
}
|
||||
}
|
||||
|
||||
// This try catch block prevents an Uncaught PDOException error that occurs
|
||||
|
@ -201,17 +206,20 @@ try
|
|||
}
|
||||
catch ( PDOException $e )
|
||||
{
|
||||
print_r( $e->getMessage() );
|
||||
$err = $e->getMessage();
|
||||
if (strpos($err, 'SQLSTATE[08S01]')===false or strpos($err, 'Communication link failure')===false) {
|
||||
echo "Error: Wrong error message.\n";
|
||||
print_r($err);
|
||||
}
|
||||
}
|
||||
|
||||
$conn_break = null;
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Statement 1 prepared\.
|
||||
Statement 1 executed\.
|
||||
Transaction begun\.
|
||||
Transaction was committed\.
|
||||
Transaction begun\.
|
||||
SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.|Error code 0x20)
|
||||
SQLSTATE\[08S01\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
|
||||
--EXPECT--
|
||||
Statement 1 prepared.
|
||||
Statement 1 executed.
|
||||
Transaction begun.
|
||||
Transaction was committed.
|
||||
Transaction begun.
|
||||
Transaction failed.
|
||||
|
|
|
@ -40,7 +40,11 @@ try
|
|||
catch( PDOException $e )
|
||||
{
|
||||
echo "Error executing statement 1.\n";
|
||||
print_r( $e->getMessage() );
|
||||
$err = $e->getMessage();
|
||||
if (strpos($err, 'SQLSTATE[08S02]')===false or (strpos($err, 'TCP Provider')===false and strpos($err, 'SMux Provider')===false)) {
|
||||
echo "Error: Wrong error message.\n";
|
||||
print_r($err);
|
||||
}
|
||||
}
|
||||
|
||||
$conn = null;
|
||||
|
@ -82,6 +86,6 @@ $conn_break = null;
|
|||
DropTables( $server, $uid, $pwd, $tableName1, $tableName2 );
|
||||
|
||||
?>
|
||||
--EXPECTREGEX--
|
||||
Error executing statement 1\.
|
||||
SQLSTATE\[08S02\]: \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]TCP Provider: (An existing connection was forcibly closed by the remote host\.\n|Error code 0x20 |SMux Provider: Physical connection is not usable \[xFFFFFFFF\]\. )Query successfully executed\.
|
||||
--EXPECT--
|
||||
Error executing statement 1.
|
||||
Query successfully executed.
|
||||
|
|
Loading…
Reference in a new issue