Skip to content

Commit 8e82448

Browse files
committed
mysqli_report test cases for autocommit, commit, rollback and mysqli_stmt_attr_set
1 parent efc1858 commit 8e82448

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
@@ -49,6 +49,18 @@ require_once('skipifconnectfailure.inc');
4949
printf("[009] select_db should have failed\n");
5050
// 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
5151

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

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

80+
mysqli_multi_query($link, "SELECT 1; FOO;");
81+
mysqli_autocommit($link, true);
82+
mysqli_commit($link);
83+
mysqli_rollback($link);
84+
while(mysqli_more_results($link)) {
85+
mysqli_next_result($link);
86+
$res = mysqli_store_result($link);
87+
}
88+
mysqli_next_result($link);
89+
6890
/*
6991
Internal macro MYSQL_REPORT_STMT_ERROR
7092
*/
@@ -292,6 +314,16 @@ mysqli_kill(): Argument #2 ($process_id) must be greater than 0
292314
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
293315

294316
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
317+
318+
Warning: mysqli_autocommit(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
319+
320+
Warning: mysqli_commit(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
321+
322+
Warning: mysqli_rollback(): (%s/%d): Commands out of sync; you can't run this command now in %s on line %d
323+
324+
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
325+
326+
Warning: mysqli_stmt_attr_set(): (%s/%d): Not implemented in %s on line %d
295327
mysqli_kill(): Argument #2 ($process_id) must be greater than 0
296328

297329
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)