Skip to content

Commit 95b7019

Browse files
committed
mysqli_report test cases for autocommit, commit, rollback and mysqli_stmt_attr_set
1 parent 0d16222 commit 95b7019

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

ext/mysqli/tests/mysqli_report.phpt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,18 @@ require_once('skipifconnectfailure.inc');
5050
printf("[009] select_db should have failed\n");
5151
// mysqli_store_result() and mysqli_use_result() cannot be tested, because one would need to cause an error inside the C function to test it
5252

53+
mysqli_multi_query($link, "SELECT 1; FOO;");
54+
mysqli_autocommit($link, true);
55+
mysqli_commit($link);
56+
mysqli_rollback($link);
57+
while(mysqli_more_results($link)) {
58+
mysqli_next_result($link);
59+
$res = mysqli_store_result($link);
60+
}
61+
mysqli_next_result($link);
62+
63+
$stmt = mysqli_prepare($link, "SELECT 1");
64+
mysqli_stmt_attr_set($stmt, MYSQLI_STMT_ATTR_CURSOR_TYPE, MYSQLI_CURSOR_TYPE_FOR_UPDATE);
5365

5466
// Check that none of the above would have caused any error messages if MYSQL_REPORT_ERROR would
5567
// not have been set. If that would be the case, the test would be broken.
@@ -66,6 +78,16 @@ require_once('skipifconnectfailure.inc');
6678
mysqli_real_query($link, "FOO");
6779
mysqli_select_db($link, "Oh lord, let this be an unknown database name");
6880

81+
mysqli_multi_query($link, "SELECT 1; FOO;");
82+
mysqli_autocommit($link, true);
83+
mysqli_commit($link);
84+
mysqli_rollback($link);
85+
while(mysqli_more_results($link)) {
86+
mysqli_next_result($link);
87+
$res = mysqli_store_result($link);
88+
}
89+
mysqli_next_result($link);
90+
6991
/*
7092
Internal macro MYSQL_REPORT_STMT_ERROR
7193
*/
@@ -293,6 +315,16 @@ mysqli_kill(): Argument #2 ($connection_id) must be greater than 0
293315
Warning: mysqli_prepare(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
294316

295317
Warning: mysqli_real_query(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
318+
319+
Warning: mysqli_autocommit(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
320+
321+
Warning: mysqli_commit(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
322+
323+
Warning: mysqli_rollback(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
324+
325+
Warning: mysqli_store_result(): (%s/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d
326+
327+
Warning: mysqli_stmt_attr_set(): (%s/%d): Not implemented in %s on line %d
296328
mysqli_kill(): Argument #2 ($connection_id) must be greater than 0
297329

298330
Warning: mysqli_stmt_prepare(): (%d/%d): You have an error in your SQL syntax; check the manual that corresponds to your %s server version for the right syntax to use near 'FOO' at line 1 in %s on line %d

0 commit comments

Comments
 (0)