Skip to content

Commit bd34cab

Browse files
Merge pull request #818 from david-puglielli/connres-test-fixes
Fixed output for sqlsrv connres tests
2 parents 6f0f4b7 + 6ee8c44 commit bd34cab

File tree

3 files changed

+26
-98
lines changed

3 files changed

+26
-98
lines changed

test/functional/sqlsrv/connection_resiliency.phpt

Lines changed: 13 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,12 @@ $stmt6 = sqlsrv_query( $conn, "SELECT * FROM $tableName2" );
144144
if( $stmt6 === false )
145145
{
146146
echo "Error in statement 6.\n";
147-
print_r( sqlsrv_errors() );
147+
$err = sqlsrv_errors();
148+
if (strpos($err[0][0], '08S01')===false or
149+
(strpos($err[0][2], 'TCP Provider:')===false and strpos($err[0][2], 'SMux Provider:')===false and strpos($err[0][2], 'Session Provider:')===false)) {
150+
echo "Error: Wrong error message.\n";
151+
print_r($err);
152+
}
148153
}
149154
else
150155
{
@@ -188,7 +193,12 @@ $stmt8 = sqlsrv_query( $conn, "SELECT * FROM $tableName2" );
188193
if( $stmt8 === false )
189194
{
190195
echo "Error in statement 8.\n";
191-
print_r( sqlsrv_errors() );
196+
$err = sqlsrv_errors();
197+
if (strpos($err[0][0], 'IMSSP')===false or
198+
strpos($err[0][2], 'The connection cannot process this operation because there is a statement with pending results')===false) {
199+
echo "Error: Wrong error message.\n";
200+
print_r($err);
201+
}
192202
}
193203
else
194204
{
@@ -199,7 +209,7 @@ sqlsrv_close( $conn );
199209
sqlsrv_close( $conn_break );
200210

201211
?>
202-
--EXPECTREGEX--
212+
--EXPECT--
203213
Statement 1 successful.
204214
16 rows in result set.
205215
Statement 2 successful.
@@ -211,51 +221,5 @@ Statement 4 successful.
211221
Statement 5 successful.
212222
rows in result set.
213223
Error in statement 6.
214-
Array
215-
\(
216-
\[0\] => Array
217-
\(
218-
\[0\] => 08S01
219-
\[SQLSTATE\] => 08S01
220-
\[1\] => (10054|104)
221-
\[code\] => (10054|104)
222-
\[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)
223-
\[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)
224-
\)
225-
226-
\[1\] => Array
227-
\(
228-
\[0\] => 08S01
229-
\[SQLSTATE\] => 08S01
230-
\[1\] => (10054|104)
231-
\[code\] => (10054|104)
232-
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
233-
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
234-
\)
235-
236-
\)
237224
Statement 7 successful.
238225
Error in statement 8.
239-
Array
240-
\(
241-
\[0\] => Array
242-
\(
243-
\[0\] => IMSSP
244-
\[SQLSTATE\] => IMSSP
245-
\[1\] => -44
246-
\[code\] => -44
247-
\[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.
248-
\[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.
249-
\)
250-
251-
\[1\] => Array
252-
\(
253-
\[0\] => HY000
254-
\[SQLSTATE\] => HY000
255-
\[1\] => 0
256-
\[code\] => 0
257-
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Connection is busy with results for another command
258-
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Connection is busy with results for another command
259-
\)
260-
261-
\)

test/functional/sqlsrv/connection_resiliency_prepare_transact.phpt

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -167,40 +167,22 @@ else
167167
else
168168
{
169169
echo "Statement not valid and rollback failed.\n";
170-
print_r( sqlsrv_errors() );
170+
$err = sqlsrv_errors();
171+
if (strpos($err[0][0], '08S02')===false or
172+
(strpos($err[0][2], 'TCP Provider:')===false and strpos($err[0][2], 'SMux Provider:')===false and strpos($err[0][2], 'Session Provider:')===false)) {
173+
echo "Error: Wrong error message.\n";
174+
print_r($err);
175+
}
171176
}
172177
}
173178

174179
sqlsrv_close( $conn );
175180
sqlsrv_close( $conn_break );
176181
?>
177-
--EXPECTREGEX--
182+
--EXPECT--
178183
Statement 1 prepared.
179184
Statement 1 executed.
180185
Transaction begun.
181186
Transaction was committed.
182187
Transaction begun.
183188
Statement not valid and rollback failed.
184-
Array
185-
\(
186-
\[0\] => Array
187-
\(
188-
\[0\] => 08S02
189-
\[SQLSTATE\] => 08S02
190-
\[1\] => (10054|-1)
191-
\[code\] => (10054|-1)
192-
\[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\]\. )
193-
\[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\]\. )
194-
\)
195-
196-
\[1\] => Array
197-
\(
198-
\[0\] => 08S02
199-
\[SQLSTATE\] => 08S02
200-
\[1\] => (10054|-1)
201-
\[code\] => (10054|-1)
202-
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Unable to open a logical session
203-
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Unable to open a logical session
204-
\)
205-
206-
\)

test/functional/sqlsrv/connection_resiliency_timeouts.phpt

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ $stmt1 = sqlsrv_query( $conn, "SELECT * FROM $tableName1" );
3333
if( $stmt1 === false )
3434
{
3535
echo "Error in statement 1.\n";
36-
print_r( sqlsrv_errors() );
36+
$err = sqlsrv_errors();
37+
if (strpos($err[0][0], '08S01')===false or
38+
(strpos($err[0][2], 'TCP Provider:')===false and strpos($err[0][2], 'SMux Provider:')===false and strpos($err[0][2], 'Session Provider:')===false)) {
39+
echo "Error: Wrong error message.\n";
40+
print_r($err);
41+
}
3742
}
3843
else
3944
{
@@ -78,27 +83,4 @@ DropTables( $server, $uid, $pwd, $tableName1, $tableName2 )
7883
?>
7984
--EXPECTREGEX--
8085
Error in statement 1.
81-
Array
82-
\(
83-
\[0\] => Array
84-
\(
85-
\[0\] => 08S01
86-
\[SQLSTATE\] => 08S01
87-
\[1\] => (10054|104)
88-
\[code\] => (10054|104)
89-
\[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)
90-
\[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)
91-
\)
92-
93-
\[1\] => Array
94-
\(
95-
\[0\] => 08S01
96-
\[SQLSTATE\] => 08S01
97-
\[1\] => (10054|104)
98-
\[code\] => (10054|104)
99-
\[2\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
100-
\[message\] => \[Microsoft\]\[ODBC Driver 1[1-9] for SQL Server\]Communication link failure
101-
\)
102-
103-
\)
10486
Statement 2 successful.

0 commit comments

Comments
 (0)