]> granicus.if.org Git - php/commitdiff
Reindent ext/mysqli tests
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 25 Nov 2020 14:57:11 +0000 (15:57 +0100)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 25 Nov 2020 14:57:11 +0000 (15:57 +0100)
Reindent ext/mysqli tests on PHP-7.4, so they match with the
indentation on PHP-8.0. Otherwise merging test changes across
branches is very unpleasant.

290 files changed:
ext/mysqli/tests/002.phpt
ext/mysqli/tests/003.phpt
ext/mysqli/tests/004.phpt
ext/mysqli/tests/005.phpt
ext/mysqli/tests/006.phpt
ext/mysqli/tests/007.phpt
ext/mysqli/tests/008.phpt
ext/mysqli/tests/009.phpt
ext/mysqli/tests/010.phpt
ext/mysqli/tests/011.phpt
ext/mysqli/tests/012.phpt
ext/mysqli/tests/013.phpt
ext/mysqli/tests/014.phpt
ext/mysqli/tests/015.phpt
ext/mysqli/tests/019.phpt
ext/mysqli/tests/020.phpt
ext/mysqli/tests/021.phpt
ext/mysqli/tests/022.phpt
ext/mysqli/tests/023.phpt
ext/mysqli/tests/024.phpt
ext/mysqli/tests/025.phpt
ext/mysqli/tests/026.phpt
ext/mysqli/tests/029.phpt
ext/mysqli/tests/032.phpt
ext/mysqli/tests/036.phpt
ext/mysqli/tests/037.phpt
ext/mysqli/tests/038.phpt
ext/mysqli/tests/040.phpt
ext/mysqli/tests/041.phpt
ext/mysqli/tests/042.phpt
ext/mysqli/tests/043.phpt
ext/mysqli/tests/045.phpt
ext/mysqli/tests/046.phpt
ext/mysqli/tests/047.phpt
ext/mysqli/tests/048.phpt
ext/mysqli/tests/057.phpt
ext/mysqli/tests/058.phpt
ext/mysqli/tests/059.phpt
ext/mysqli/tests/060.phpt
ext/mysqli/tests/061.phpt
ext/mysqli/tests/065.phpt
ext/mysqli/tests/066.phpt
ext/mysqli/tests/067.phpt
ext/mysqli/tests/bug32405.phpt
ext/mysqli/tests/bug34810.phpt
ext/mysqli/tests/bug35103.phpt
ext/mysqli/tests/bug35517.phpt
ext/mysqli/tests/bug36745.phpt
ext/mysqli/tests/bug36949.phpt
ext/mysqli/tests/bug37090.phpt
ext/mysqli/tests/bug42378.phpt
ext/mysqli/tests/bug42548.phpt
ext/mysqli/tests/bug44897.phpt
ext/mysqli/tests/bug45289.phpt
ext/mysqli/tests/bug46614.phpt
ext/mysqli/tests/bug47050.phpt
ext/mysqli/tests/bug48909.phpt
ext/mysqli/tests/bug49027.phpt
ext/mysqli/tests/bug49442.phpt
ext/mysqli/tests/bug51605.phpt
ext/mysqli/tests/bug51647.phpt
ext/mysqli/tests/bug52891.phpt
ext/mysqli/tests/bug53503.phpt
ext/mysqli/tests/bug54221.phpt
ext/mysqli/tests/bug54674.phpt
ext/mysqli/tests/bug55283.phpt
ext/mysqli/tests/bug67839.phpt
ext/mysqli/tests/bug68077.phpt
ext/mysqli/tests/bug69899.phpt
ext/mysqli/tests/bug70384.phpt
ext/mysqli/tests/bug70949.phpt
ext/mysqli/tests/bug71863.phpt
ext/mysqli/tests/bug72701.phpt
ext/mysqli/tests/bug76386.phpt
ext/mysqli/tests/bug77956.phpt
ext/mysqli/tests/clean_table.inc
ext/mysqli/tests/connect.inc
ext/mysqli/tests/gracefull_fail_on_empty_result_set.phpt
ext/mysqli/tests/local_infile_tools.inc
ext/mysqli/tests/mysqli_affected_rows.phpt
ext/mysqli/tests/mysqli_affected_rows_oo.phpt
ext/mysqli/tests/mysqli_auth_pam.phpt
ext/mysqli/tests/mysqli_autocommit.phpt
ext/mysqli/tests/mysqli_autocommit_oo.phpt
ext/mysqli/tests/mysqli_begin_transaction.phpt
ext/mysqli/tests/mysqli_change_user_get_lock.phpt
ext/mysqli/tests/mysqli_change_user_insert_id.phpt
ext/mysqli/tests/mysqli_change_user_locks_temporary.phpt
ext/mysqli/tests/mysqli_change_user_new.phpt
ext/mysqli/tests/mysqli_change_user_old.phpt
ext/mysqli/tests/mysqli_change_user_oo.phpt
ext/mysqli/tests/mysqli_change_user_rollback.phpt
ext/mysqli/tests/mysqli_change_user_set_names.phpt
ext/mysqli/tests/mysqli_character_set.phpt
ext/mysqli/tests/mysqli_character_set_name_oo.phpt
ext/mysqli/tests/mysqli_class_mysqli_driver_reflection.phpt
ext/mysqli/tests/mysqli_class_mysqli_reflection.phpt
ext/mysqli/tests/mysqli_class_mysqli_result_reflection.phpt
ext/mysqli/tests/mysqli_class_mysqli_stmt_interface.phpt
ext/mysqli/tests/mysqli_class_mysqli_warning.phpt
ext/mysqli/tests/mysqli_class_mysqli_warning_reflection.phpt
ext/mysqli/tests/mysqli_commit.phpt
ext/mysqli/tests/mysqli_commit_oo.phpt
ext/mysqli/tests/mysqli_connect_attr.phpt
ext/mysqli/tests/mysqli_connect_oo_warnings.phpt
ext/mysqli/tests/mysqli_constants.phpt
ext/mysqli/tests/mysqli_data_seek.phpt
ext/mysqli/tests/mysqli_data_seek_oo.phpt
ext/mysqli/tests/mysqli_debug.phpt
ext/mysqli/tests/mysqli_debug_append.phpt
ext/mysqli/tests/mysqli_debug_control_string.phpt
ext/mysqli/tests/mysqli_debug_ini.phpt
ext/mysqli/tests/mysqli_debug_mysqlnd_control_string.phpt
ext/mysqli/tests/mysqli_debug_mysqlnd_only.phpt
ext/mysqli/tests/mysqli_disable_reads_from_master.phpt
ext/mysqli/tests/mysqli_enable_reads_from_master.phpt
ext/mysqli/tests/mysqli_expire_password.phpt
ext/mysqli/tests/mysqli_explain_metadata.phpt
ext/mysqli/tests/mysqli_fetch_all.phpt
ext/mysqli/tests/mysqli_fetch_all_oo.phpt
ext/mysqli/tests/mysqli_fetch_array_assoc.phpt
ext/mysqli/tests/mysqli_fetch_array_large.phpt
ext/mysqli/tests/mysqli_fetch_array_many_rows.phpt
ext/mysqli/tests/mysqli_fetch_array_oo.phpt
ext/mysqli/tests/mysqli_fetch_assoc.phpt
ext/mysqli/tests/mysqli_fetch_assoc_bit.phpt
ext/mysqli/tests/mysqli_fetch_assoc_no_alias_utf8.phpt
ext/mysqli/tests/mysqli_fetch_assoc_oo.phpt
ext/mysqli/tests/mysqli_fetch_assoc_zerofill.phpt
ext/mysqli/tests/mysqli_fetch_field.phpt
ext/mysqli/tests/mysqli_fetch_field_direct.phpt
ext/mysqli/tests/mysqli_fetch_field_direct_oo.phpt
ext/mysqli/tests/mysqli_fetch_field_flags.phpt
ext/mysqli/tests/mysqli_fetch_field_oo.phpt
ext/mysqli/tests/mysqli_fetch_field_types.phpt
ext/mysqli/tests/mysqli_fetch_fields.phpt
ext/mysqli/tests/mysqli_fetch_lengths.phpt
ext/mysqli/tests/mysqli_fetch_lengths_oo.phpt
ext/mysqli/tests/mysqli_fetch_object.phpt
ext/mysqli/tests/mysqli_fetch_object_no_constructor.phpt
ext/mysqli/tests/mysqli_fetch_object_no_object.phpt
ext/mysqli/tests/mysqli_fetch_object_oo.phpt
ext/mysqli/tests/mysqli_fetch_row.phpt
ext/mysqli/tests/mysqli_field_count.phpt
ext/mysqli/tests/mysqli_field_seek.phpt
ext/mysqli/tests/mysqli_field_tell.phpt
ext/mysqli/tests/mysqli_fork.phpt
ext/mysqli/tests/mysqli_free_result.phpt
ext/mysqli/tests/mysqli_get_charset.phpt
ext/mysqli/tests/mysqli_get_client_stats.phpt
ext/mysqli/tests/mysqli_get_client_stats_implicit_free.phpt
ext/mysqli/tests/mysqli_get_client_stats_off.phpt
ext/mysqli/tests/mysqli_get_client_stats_ps.phpt
ext/mysqli/tests/mysqli_get_client_stats_skipped.phpt
ext/mysqli/tests/mysqli_get_connection_stats.phpt
ext/mysqli/tests/mysqli_get_connection_stats_off.phpt
ext/mysqli/tests/mysqli_get_host_info.phpt
ext/mysqli/tests/mysqli_get_server_info.phpt
ext/mysqli/tests/mysqli_get_warnings.phpt
ext/mysqli/tests/mysqli_info.phpt
ext/mysqli/tests/mysqli_insert_id.phpt
ext/mysqli/tests/mysqli_insert_id_variation.phpt
ext/mysqli/tests/mysqli_insert_packet_overflow.phpt
ext/mysqli/tests/mysqli_kill.phpt
ext/mysqli/tests/mysqli_last_insert_id.phpt
ext/mysqli/tests/mysqli_max_links.phpt
ext/mysqli/tests/mysqli_more_results.phpt
ext/mysqli/tests/mysqli_multi_query.phpt
ext/mysqli/tests/mysqli_mysqlnd_read_timeout.phpt
ext/mysqli/tests/mysqli_mysqlnd_read_timeout_long.phpt
ext/mysqli/tests/mysqli_mysqlnd_read_timeout_zero.phpt
ext/mysqli/tests/mysqli_next_result.phpt
ext/mysqli/tests/mysqli_no_reconnect.phpt
ext/mysqli/tests/mysqli_num_fields.phpt
ext/mysqli/tests/mysqli_num_rows.phpt
ext/mysqli/tests/mysqli_options_init_command.phpt
ext/mysqli/tests/mysqli_options_int_and_float_native.phpt
ext/mysqli/tests/mysqli_pam_sha256.phpt
ext/mysqli/tests/mysqli_pam_sha256_public_key_ini.phpt
ext/mysqli/tests/mysqli_pam_sha256_public_key_option.phpt
ext/mysqli/tests/mysqli_pam_sha256_public_key_option_invalid.phpt
ext/mysqli/tests/mysqli_pconn_conn_multiple.phpt
ext/mysqli/tests/mysqli_pconn_disabled.phpt
ext/mysqli/tests/mysqli_pconn_kill.phpt
ext/mysqli/tests/mysqli_pconn_limits.phpt
ext/mysqli/tests/mysqli_pconn_max_links.phpt
ext/mysqli/tests/mysqli_pconn_reuse.phpt
ext/mysqli/tests/mysqli_pconn_twice.phpt
ext/mysqli/tests/mysqli_poll.phpt
ext/mysqli/tests/mysqli_poll_kill.phpt
ext/mysqli/tests/mysqli_poll_mixing_insert_select.phpt
ext/mysqli/tests/mysqli_poll_reference.phpt
ext/mysqli/tests/mysqli_prepare.phpt
ext/mysqli/tests/mysqli_query.phpt
ext/mysqli/tests/mysqli_query_iterators.phpt
ext/mysqli/tests/mysqli_query_stored_proc.phpt
ext/mysqli/tests/mysqli_query_unicode.phpt
ext/mysqli/tests/mysqli_real_connect.phpt
ext/mysqli/tests/mysqli_real_connect_pconn.phpt
ext/mysqli/tests/mysqli_real_escape_string_big5.phpt
ext/mysqli/tests/mysqli_real_escape_string_eucjpms.phpt
ext/mysqli/tests/mysqli_real_escape_string_euckr.phpt
ext/mysqli/tests/mysqli_real_escape_string_gb2312.phpt
ext/mysqli/tests/mysqli_real_escape_string_gbk.phpt
ext/mysqli/tests/mysqli_real_escape_string_sjis.phpt
ext/mysqli/tests/mysqli_real_escape_string_unicode.phpt
ext/mysqli/tests/mysqli_real_query.phpt
ext/mysqli/tests/mysqli_reap_async_query.phpt
ext/mysqli/tests/mysqli_reconnect.phpt
ext/mysqli/tests/mysqli_release_savepoint.phpt
ext/mysqli/tests/mysqli_report_new.phpt
ext/mysqli/tests/mysqli_report_wo_ps.phpt
ext/mysqli/tests/mysqli_result_invalid_mode.phpt
ext/mysqli/tests/mysqli_result_references.phpt
ext/mysqli/tests/mysqli_result_references_mysqlnd.phpt
ext/mysqli/tests/mysqli_rollback.phpt
ext/mysqli/tests/mysqli_savepoint.phpt
ext/mysqli/tests/mysqli_send_query.phpt
ext/mysqli/tests/mysqli_set_charset.phpt
ext/mysqli/tests/mysqli_sqlstate.phpt
ext/mysqli/tests/mysqli_ssl_set.phpt
ext/mysqli/tests/mysqli_stmt_affected_rows.phpt
ext/mysqli/tests/mysqli_stmt_attr_get.phpt
ext/mysqli/tests/mysqli_stmt_attr_get_prefetch.phpt
ext/mysqli/tests/mysqli_stmt_attr_set.phpt
ext/mysqli/tests/mysqli_stmt_big_prepare.phpt
ext/mysqli/tests/mysqli_stmt_bind_param.phpt
ext/mysqli/tests/mysqli_stmt_bind_param_call_user_func.phpt
ext/mysqli/tests/mysqli_stmt_bind_param_check_param_no_change.phpt
ext/mysqli/tests/mysqli_stmt_bind_param_many_columns.phpt
ext/mysqli/tests/mysqli_stmt_bind_param_references.phpt
ext/mysqli/tests/mysqli_stmt_bind_param_type_juggling.phpt
ext/mysqli/tests/mysqli_stmt_bind_result.phpt
ext/mysqli/tests/mysqli_stmt_bind_result_bit.phpt
ext/mysqli/tests/mysqli_stmt_bind_result_format.phpt
ext/mysqli/tests/mysqli_stmt_bind_result_references.phpt
ext/mysqli/tests/mysqli_stmt_bind_result_zerofill.phpt
ext/mysqli/tests/mysqli_stmt_close.phpt
ext/mysqli/tests/mysqli_stmt_data_seek.phpt
ext/mysqli/tests/mysqli_stmt_datatype_change.phpt
ext/mysqli/tests/mysqli_stmt_errno.phpt
ext/mysqli/tests/mysqli_stmt_error.phpt
ext/mysqli/tests/mysqli_stmt_execute.phpt
ext/mysqli/tests/mysqli_stmt_execute_stored_proc.phpt
ext/mysqli/tests/mysqli_stmt_execute_stored_proc_next_result.phpt
ext/mysqli/tests/mysqli_stmt_execute_stored_proc_out.phpt
ext/mysqli/tests/mysqli_stmt_fetch.phpt
ext/mysqli/tests/mysqli_stmt_fetch_bit.phpt
ext/mysqli/tests/mysqli_stmt_fetch_fields_win32_unicode.phpt
ext/mysqli/tests/mysqli_stmt_fetch_geom.phpt
ext/mysqli/tests/mysqli_stmt_field_count.phpt
ext/mysqli/tests/mysqli_stmt_free_result.phpt
ext/mysqli/tests/mysqli_stmt_get_result.phpt
ext/mysqli/tests/mysqli_stmt_get_result2.phpt
ext/mysqli/tests/mysqli_stmt_get_result_bit.phpt
ext/mysqli/tests/mysqli_stmt_get_result_field_count.phpt
ext/mysqli/tests/mysqli_stmt_get_result_geom.phpt
ext/mysqli/tests/mysqli_stmt_get_result_metadata.phpt
ext/mysqli/tests/mysqli_stmt_get_result_metadata_fetch_field.phpt
ext/mysqli/tests/mysqli_stmt_get_result_non_select.phpt
ext/mysqli/tests/mysqli_stmt_get_result_seek.phpt
ext/mysqli/tests/mysqli_stmt_get_result_types.phpt
ext/mysqli/tests/mysqli_stmt_get_warnings.phpt
ext/mysqli/tests/mysqli_stmt_init.phpt
ext/mysqli/tests/mysqli_stmt_insert_id.phpt
ext/mysqli/tests/mysqli_stmt_multires.phpt
ext/mysqli/tests/mysqli_stmt_num_rows.phpt
ext/mysqli/tests/mysqli_stmt_param_count.phpt
ext/mysqli/tests/mysqli_stmt_prepare.phpt
ext/mysqli/tests/mysqli_stmt_reset.phpt
ext/mysqli/tests/mysqli_stmt_result_metadata.phpt
ext/mysqli/tests/mysqli_stmt_result_metadata_sqltests.phpt
ext/mysqli/tests/mysqli_stmt_send_long_data.phpt
ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_libmysql.phpt
ext/mysqli/tests/mysqli_stmt_send_long_data_packet_size_mysqlnd.phpt
ext/mysqli/tests/mysqli_stmt_sqlstate.phpt
ext/mysqli/tests/mysqli_stmt_store_result.phpt
ext/mysqli/tests/mysqli_store_result.phpt
ext/mysqli/tests/mysqli_store_result_buffered_c.phpt
ext/mysqli/tests/mysqli_store_result_copy.phpt
ext/mysqli/tests/mysqli_thread_id.phpt
ext/mysqli/tests/mysqli_use_result.phpt
ext/mysqli/tests/mysqli_warning_count.phpt
ext/mysqli/tests/mysqli_warning_unclonable.phpt
ext/mysqli/tests/reflection_tools.inc
ext/mysqli/tests/skipif.inc
ext/mysqli/tests/skipifconnectfailure.inc
ext/mysqli/tests/skipifemb.inc
ext/mysqli/tests/skipifnotemb.inc
ext/mysqli/tests/table.inc

index 1c98577454b9d77960eb776e50c534ce959e4f3a..0a40da8589d819f29f3a65aa576018a419d7897c 100644 (file)
@@ -53,7 +53,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index c526dfbdffad5b0b593f2220d698cca25f54e717..426fb42114d18d50a177f54e6046a865797f78f8 100644 (file)
@@ -79,7 +79,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index e19d4c31194713cd0a3ba1bd7d1b94125d036bb1..13572babfd0386303cd8c13cd62e53bd091a9470 100644 (file)
@@ -57,7 +57,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index e1f5be989f10b71d8365edbc3f883788b645ccae..ff569211f7f2c012138402c37e18bdea79b12ac3 100644 (file)
@@ -47,7 +47,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index d60c52fbdebf358f152d9aaafecc0c05aed501ca..f5dd368b0c826895bf05173f8d7408a74b931113 100644 (file)
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 86c7fc2e57d8e13ac14034fb0ce563782e56582a..a2081264e53c6691cafeb593e036fe5a296a7d8f 100644 (file)
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index f36e524d11c52bea82fbbb4ede0e5e962de83e0b..6dfeaa505892f199f9cd38d43cb480aae49e2960 100644 (file)
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 906c0f027ba57fd97658ae8442e818bdf57203a6..2e24713f8999f5a8a4e52786c6057d27c91f3a5d 100644 (file)
@@ -2,12 +2,12 @@
 mysqli fetch bigint values (ok to fail with 4.1.x)
 --SKIPIF--
 <?php
-       if (PHP_INT_SIZE == 8) {
-               echo 'skip test valid only for 32bit systems';
-               exit;
-       }
-       require_once('skipif.inc');
-       require_once('skipifconnectfailure.inc');
+    if (PHP_INT_SIZE == 8) {
+        echo 'skip test valid only for 32bit systems';
+        exit;
+    }
+    require_once('skipif.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --FILE--
 <?php
@@ -85,10 +85,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch_uint"))
-       printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index b1712ca2a6464e65b2a922c4061589d8a59e3f72..49d68df90d745469548ef552362e21e5e5911a8d 100644 (file)
@@ -55,7 +55,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 1792fec6a26c1c3a27eb3fec8051ca35b7902726..878c5dea629513bd6846f6f9c43274fca5bec7eb 100644 (file)
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 2d8c6500ecfb086a2bd88a6c2679fbda77a580d3..d627e552639565ab86140bf334976b2f3223100d 100644 (file)
@@ -51,7 +51,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 21fd278489ed64339baeaf01d6505916cc38a263..d21d890b1dadd17630671c3c8d63620b1620cec1 100644 (file)
@@ -63,7 +63,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 576b337b57963dbe7befd30e1322cf14f8af0ac2..335fb6eba727b9223fe617a4388ecad194cc1ab2 100644 (file)
@@ -2,16 +2,16 @@
 mysqli autocommit/commit/rollback
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifconnectfailure.inc');
-       require_once("connect.inc");
+    require_once('skipif.inc');
+    require_once('skipifconnectfailure.inc');
+    require_once("connect.inc");
 
-       $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-       if (!$link)
-               die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+    if (!$link)
+        die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
-       if (!have_innodb($link))
-               die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    if (!have_innodb($link))
+        die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -78,7 +78,7 @@ mysqli autocommit/commit/rollback
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 Num_of_rows=1
index 0d2b44d7d3ea265259950b3dc8ea2107de668f3a..8901d1f175829721c019ddb420032c3f9897f963 100644 (file)
@@ -2,15 +2,15 @@
 mysqli autocommit/commit/rollback with innodb
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifconnectfailure.inc');
 
-       require_once('connect.inc');
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    require_once('connect.inc');
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
-       if (!have_innodb($link))
-               die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    if (!have_innodb($link))
+        die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -76,7 +76,7 @@ mysqli autocommit/commit/rollback with innodb
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 array(2) {
index 4688ff9f8a1257094f759290de00fdd7fdebba01..2f6276bdb6cb0b907b02b527cf9c2d951c720544 100644 (file)
@@ -62,7 +62,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS insert_read"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 57016de4b84bb84dc9b9116067076939423ec043..daa5708ab84a17584920d785a4118a63628c46a1 100644 (file)
@@ -74,7 +74,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index d9cf52eddcf58ed44317dc0ac350e1eae5dbe83c..d350907d934c7b665157e9cdc370efd6e0f2dfd8 100644 (file)
@@ -45,7 +45,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index fd8036fd1aa97dddae8c835e7b19aa81c5f6eea8..dbd290510567c329cb807f2840c831027834ebb3 100644 (file)
@@ -50,7 +50,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 17a8abce77ed2618e96daac62cba5f11315076af..b918aaeb674c49c098d2e879b41870e50a36cd0c 100644 (file)
@@ -59,7 +59,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 5294a24883f78c585fe7841b828497f8cb1263e0..d801324738046ec6742949dc656bf61c45a4e0fb 100644 (file)
@@ -59,7 +59,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 3b472f9513fce66235338ddf3f2cab6327f62722..f0d3cd5b7924b5cde370b75f7a1f0b8aca0faf79 100644 (file)
@@ -64,7 +64,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 51b2b774bbe62d41fa7eea2d5915a1e3376281d4..8d9d9140a63ef6379e8f7616e69a1d5b6db41a32 100644 (file)
@@ -51,7 +51,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index cf59999eaf0734aab27d7db59edad67b33324004..b2409e976be1fd51104e58f274022db84e7d333d 100644 (file)
@@ -33,7 +33,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS general_test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 27d8fb3fa542abc1d80e00893f97e8440313481d..5347a33f6879099152fede8d80755f02f5a66cd1 100644 (file)
@@ -33,7 +33,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS general_test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 919625c8cdd65578373b65ff10f1d54b6a08f0de..e0b5375ff733544ee922069b4a11e8bad0e51070 100644 (file)
@@ -2,12 +2,12 @@
 function test: mysqli_insert_id()
 --SKIPIF--
 <?php
-       if (PHP_INT_SIZE == 8) {
-               echo 'skip test valid only for 32bit systems';
-               exit;
-       }
-       require_once('skipif.inc');
-       require_once('skipifconnectfailure.inc');
+    if (PHP_INT_SIZE == 8) {
+        echo 'skip test valid only for 32bit systems';
+        exit;
+    }
+    require_once('skipif.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --FILE--
 <?php
@@ -49,7 +49,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS t036"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 5826a9834e72df5ae1b3d65428f7515c876257e7..dece211f0fdad1a509ae965423679bf1b064ed39 100644 (file)
@@ -39,7 +39,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 45b724ca3cde4c64986615a5e64a09162a4ceb72..f2fcbf69eed7a3339279129a2fa99ab6fca20e28 100644 (file)
@@ -39,7 +39,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index a860f30d815cb05f9282e4682524c7ba50bf8a55..1e9ec7c22bded431c4f5d7242588bc7e544cf6a9 100644 (file)
@@ -38,7 +38,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 86ddd6706916dc0a5948daf683cc9c4ccd252414..903277d8c8986e42ef7b929851f2e6e426476c5f 100644 (file)
@@ -29,7 +29,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index e84dfc2a103fb37d8a825f08e8d73e702fb82dd0..9fa55ce300d00b9fec285c2022bf38046b0c44df 100644 (file)
@@ -55,7 +55,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index daf79ebbe4eaae514a9adbe7a9747dfa15356c95..d13d55234132919b2117df72ed0cb4396c7c63cb 100644 (file)
@@ -47,7 +47,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_update"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 0b7b68239cdd73b26324cf2aab19ccc7e6a82c2c..7c357a54af420eb88baf19f0450e3b50564483f0 100644 (file)
@@ -2,21 +2,21 @@
 mysqli_stmt_bind_result (SHOW)
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       require_once("connect.inc");
-       $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+    require_once("connect.inc");
+    $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
-       mysqli_stmt_execute($stmt);
+    $stmt = mysqli_prepare($link, "SHOW VARIABLES LIKE 'port'");
+    mysqli_stmt_execute($stmt);
 
-       if (!$stmt->field_count) {
-               printf("skip SHOW command is not supported in prepared statements.");
-       }
-       $stmt->close();
-       mysqli_close($link);
+    if (!$stmt->field_count) {
+        printf("skip SHOW command is not supported in prepared statements.");
+    }
+    $stmt->close();
+    mysqli_close($link);
 ?>
 --FILE--
 <?php
index 8e4b8c3b2c09f97dd04392534c81e96b8e316351..3a7c2d9340b0847f76c6fd069fb7d1e62ff629be 100644 (file)
@@ -41,7 +41,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_affected"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index a89488fa58dcdd28a6707f0982374468c183d45f..14b0612d78190dd69a9c1007fd65ce998001d346 100644 (file)
@@ -52,7 +52,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_affected"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 9328e0e282eb80cad5935de4607b2b187f7d9f41..9df8005b3808a2c21939f28578b6484abd6fe648 100644 (file)
@@ -47,7 +47,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch_null"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index f4b60ecd4fc172ebd3bf3f7ccbbb9a9f93872d91..92f7e767d1c6185c7ede39e4c7d9bac5c4e23d1f 100644 (file)
@@ -69,7 +69,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_store_result"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index e839e7e64e4bca99e7079dd1862f7cb0d4ea2e90..d56ea507226b8ec7d39f824d9795a021fa9ac13a 100644 (file)
@@ -55,7 +55,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS mbind"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 0632553143f70549b032428154f08c38e1376735..3faf5b9332d4fbfb4d0f741275ec9139184dee80 100644 (file)
@@ -48,7 +48,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS mbind"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 9043dd7def036db39f0ae5e8ad9a05a479ec5ad4..0268339b3de960b6e98868d2fcaec67bddd3bb48 100644 (file)
@@ -49,7 +49,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 0da9c1c09d8becf0794c3cc27b5c8d8b65f6edf3..76a40c704e2bd6c6d8cb278480141f2caa678166 100644 (file)
@@ -5,15 +5,15 @@ local infile handler
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_set_local_infile_handler'))
-       die("skip - function not available.");
+    die("skip - function not available.");
 
 $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 if (!$link)
-       die(sprintf("skip Can't connect [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Can't connect [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 include_once("local_infile_tools.inc");
 if ($msg = check_local_infile_support($link, $engine))
-       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+    die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
 
 mysqli_close($link);
 ?>
@@ -21,45 +21,45 @@ mysqli_close($link);
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       function my_read($fp, &$buffer, $buflen, &$error) {
-               $buffer = strrev(fread($fp, $buflen));
-               return(strlen($buffer));
-       }
+    function my_read($fp, &$buffer, $buflen, &$error) {
+        $buffer = strrev(fread($fp, $buflen));
+        return(strlen($buffer));
+    }
 
-       /*** test mysqli_connect 127.0.0.1 ***/
-       $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+    /*** test mysqli_connect 127.0.0.1 ***/
+    $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       /* create temporary file */
-       $filename = __DIR__ . "061.csv";
-       $fp = fopen($filename, "w");
-       fwrite($fp, "foo;bar");
-       fclose($fp);
+    /* create temporary file */
+    $filename = __DIR__ . "061.csv";
+    $fp = fopen($filename, "w");
+    fwrite($fp, "foo;bar");
+    fclose($fp);
 
-       if (!mysqli_query($link,"DROP TABLE IF EXISTS t_061"))
-               printf("Cannot drop table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       if (!mysqli_query($link,"CREATE TABLE t_061 (c1 varchar(10), c2 varchar(10))"))
-               printf("Cannot create table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link,"DROP TABLE IF EXISTS t_061"))
+        printf("Cannot drop table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link,"CREATE TABLE t_061 (c1 varchar(10), c2 varchar(10))"))
+        printf("Cannot create table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
-               printf("Cannot load data: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
+        printf("Cannot load data: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       mysqli_set_local_infile_handler($link, "my_read");
-       if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
-               printf("Cannot load data using infile handler: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    mysqli_set_local_infile_handler($link, "my_read");
+    if (!mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE t_061 FIELDS TERMINATED BY ';'", mysqli_real_escape_string($link, $filename))))
+        printf("Cannot load data using infile handler: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if ($result = mysqli_query($link, "SELECT c1,c2 FROM t_061")) {
-               while (($row = mysqli_fetch_row($result))) {
-                       printf("%s-%s\n", $row[0], $row[1]);
-                       printf("%s-%s\n", gettype($row[0]), gettype($row[1]));
-               }
-               mysqli_free_result($result);
-       }
+    if ($result = mysqli_query($link, "SELECT c1,c2 FROM t_061")) {
+        while (($row = mysqli_fetch_row($result))) {
+            printf("%s-%s\n", $row[0], $row[1]);
+            printf("%s-%s\n", gettype($row[0]), gettype($row[1]));
+        }
+        mysqli_free_result($result);
+    }
 
-       mysqli_close($link);
-       unlink($filename);
-       print "done!";
+    mysqli_close($link);
+    unlink($filename);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 75c4b02a2942ce115c4ba318367e300e3e860895..8c11846a8fd4417eac69f022cd3ac27779021043 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_set_charset')) {
-       die('skip mysqli_set_charset() not available');
+    die('skip mysqli_set_charset() not available');
 }
 ?>
 --FILE--
index a337e038c17a89489a260d04d6f6a8f8d2c75088..0089210718abf5948e25560c5b1c1bbad4e54902 100644 (file)
@@ -37,7 +37,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index e36993bb6bd17790fd406a1a0b597e156355505a..1ab9ed53204c29dcfd3df73ce9aa63fc34e956aa 100644 (file)
@@ -2,20 +2,20 @@
 function test: nested selects (cursors)
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifconnectfailure.inc');
-       require_once("connect.inc");
+    require_once('skipif.inc');
+    require_once('skipifconnectfailure.inc');
+    require_once("connect.inc");
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die("skip Cannot connect to check required version");
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        die("skip Cannot connect to check required version");
 
-       /* skip cursor test for versions < 50004 */
-       if ((!$IS_MYSQLND && (mysqli_get_client_version() < 50009)) ||
-                       (mysqli_get_server_version($link) < 50009)) {
-                       die(sprintf("skip Client library doesn't support cursors (%s/%s)",
-                                       mysqli_get_client_version(), mysqli_get_server_version($link)));
-       }
-       mysqli_close($link);
+    /* skip cursor test for versions < 50004 */
+    if ((!$IS_MYSQLND && (mysqli_get_client_version() < 50009)) ||
+            (mysqli_get_server_version($link) < 50009)) {
+            die(sprintf("skip Client library doesn't support cursors (%s/%s)",
+                    mysqli_get_client_version(), mysqli_get_server_version($link)));
+    }
+    mysqli_close($link);
 ?>
 --FILE--
 <?php
@@ -71,8 +71,8 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 for ($i =0; $i < 3; $i++) {
-       if (!mysqli_query($link, sprintf("DROP TABLE IF EXISTS cursor%d", $i)))
-               printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link, sprintf("DROP TABLE IF EXISTS cursor%d", $i)))
+        printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 }
 
 mysqli_close($link);
index 0b3cad50ffd50b46a35431ddab95186483a98ac6..84ec9fd963c4031cd73b7d446e9c69947138daab 100644 (file)
@@ -38,7 +38,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_users"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index b56d1a5ac7cfcbc1fd2395458aeaf08799af46d1..ff7985e49b8b815caf4fb8fe41c94bbce847a5a7 100644 (file)
@@ -54,7 +54,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_warnings"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index fc3cad04c26d49124ad3f3906d2f7f6b6d544e31..fbd83fcf56afeae6ae42d770305bf77bc6e8ce03 100644 (file)
@@ -58,7 +58,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bint") || !mysqli_query($link, "DROP TABLE IF EXISTS test_buint"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 78b3206af4ef19b478f76e44932adda4217e275a..2a199a7a33686c453df4f220871142acd3f8e6ba 100644 (file)
@@ -41,7 +41,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS temp"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 7a630afdc55d8eaebcba106f0b1a140b898426bf..744985ab418b05e61794677f375d00f7b8c62de3 100644 (file)
@@ -9,19 +9,19 @@ require_once('skipifconnectfailure.inc');
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       /*** test mysqli_connect 127.0.0.1 ***/
-       $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+    /*** test mysqli_connect 127.0.0.1 ***/
+    $mysql = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
 
-       $mysql->query("DROP TABLE IF EXISTS litest");
-       $mysql->query("CREATE TABLE litest (a VARCHAR(20))");
+    $mysql->query("DROP TABLE IF EXISTS litest");
+    $mysql->query("CREATE TABLE litest (a VARCHAR(20))");
 
-       $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
-       var_dump($mysql->error);
+    $mysql->query("LOAD DATA LOCAL INFILE 'filenotfound' INTO TABLE litest");
+    var_dump($mysql->error);
 
-       $mysql->close();
-       printf("Done");
+    $mysql->close();
+    printf("Done");
 ?>
 --CLEAN--
 <?php
index 2b3cc4955b02f43d551b936a4f0db6e34d2d7f1d..d59ee81d90b360294d06671b2233453ae7809df4 100644 (file)
@@ -54,7 +54,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS my_time"))
-       printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index d24e0d4a7ffce94fedc8a04053b00dbffc33e59b..1af1c1f5a2c97ff11f0625e36be0247617b50f69 100644 (file)
@@ -5,7 +5,7 @@ Bug #37090 (mysqli_set_charset return code)
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_set_charset')) {
-       die('skip mysqli_set_charset() not available');
+    die('skip mysqli_set_charset() not available');
 }
 ?>
 --FILE--
index 1c75141306962a936374334587e1b624b4401dba..3b0638c840a546ce4048eadc7a36249c47f67849 100644 (file)
@@ -10,175 +10,175 @@ require_once('skipifconnectfailure.inc');
 memory_limit=83886080
 --FILE--
 <?php
-       require_once("connect.inc");
-
-       function create_table($link, $column, $min, $max, $engine, $offset) {
-
-               if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
-                       printf("[%03d] Cannot drop table test, [%d] %s\n",
-                               $offset,
-                               mysqli_errno($link), mysqli_error($link));
-                       return array();
-               }
-               print "$column\n";
-
-               $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
-                       $column, $engine);
-               if (!mysqli_query($link, $sql)) {
-                       printf("[%03d] Cannot create table test, [%d] %s\n",
-                               $offset + 1,
-                               mysqli_errno($link), mysqli_error($link));
-                       return array();
-               }
-
-               $values = array();
-               for ($i = 1; $i <= 100; $i++) {
-                       $col1 = mt_rand($min, $max);
-                       $values[$i] = $col1;
-                       $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
-                               $i, $col1);
-                       if (!mysqli_query($link, $sql)) {
-                               printf("[%03d] Cannot insert data, [%d] %s\n",
-                                       $offset + 2,
-                                       mysqli_errno($link), mysqli_error($link));
-                               return array();
-                       }
-               }
-
-               return $values;
-       }
-
-       function test_format($link, $format, $from, $order_by, $expected, $offset) {
-
-               if (!$stmt = mysqli_stmt_init($link)) {
-                       printf("[%03d] Cannot create PS, [%d] %s\n",
-                               $offset,
-                               mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-               print "$format\n";
-
-               if ($order_by)
-                       $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
-               else
-                       $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
-
-               if (!mysqli_stmt_prepare($stmt, $sql)) {
-                       printf("[%03d] Cannot prepare PS, [%d] %s\n",
-                               $offset + 1,
-                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                       return false;
-               }
-
-               if (!mysqli_stmt_execute($stmt)) {
-                       printf("[%03d] Cannot execute PS, [%d] %s\n",
-                               $offset + 2,
-                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                       return false;
-               }
-
-               if (!mysqli_stmt_store_result($stmt)) {
-                       printf("[%03d] Cannot store result set, [%d] %s\n",
-                               $offset + 3,
-                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                       return false;
-               }
-
-               if (!is_array($expected)) {
-
-                       $result = null;
-                       if (!mysqli_stmt_bind_result($stmt, $result)) {
-                               printf("[%03d] Cannot bind result, [%d] %s\n",
-                                       $offset + 4,
-                                       mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                               return false;
-                       }
-
-                       if (!mysqli_stmt_fetch($stmt)) {
-                               printf("[%03d] Cannot fetch result,, [%d] %s\n",
-                                       $offset + 5,
-                                       mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                               return false;
-                       }
-
-                       if ($result !== $expected) {
-                               printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
-                                       $offset + 6,
-                                       gettype($expected), $expected,
-                                       gettype($result), $result,
-                                       $format, $sql);
-                       }
-
-               } else {
-
-                       $order_by_col = $result = null;
-                       if (!is_null($order_by)) {
-                               if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
-                                       printf("[%03d] Cannot bind result, [%d] %s\n",
-                                               $offset + 7,
-                                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                                       return false;
-                               }
-                       } else {
-                               if (!mysqli_stmt_bind_result($stmt, $result)) {
-                                       printf("[%03d] Cannot bind result, [%d] %s\n",
-                                               $offset + 7,
-                                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                                       return false;
-                               }
-                       }
-
-                       foreach ($expected as $k => $v) {
-                               if (!mysqli_stmt_fetch($stmt)) {
-                                       break;
-                               }
-                               if ($result !== $v) {
-                                       printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
-                                               $offset + 8,
-                                               $k,
-                                               gettype($v), $v,
-                                               gettype($result), $result,
-                                               $order_by_col,
-                                               $format, $sql);
-                               }
-                       }
-
-               }
-
-               mysqli_stmt_free_result($stmt);
-               mysqli_stmt_close($stmt);
-
-               return true;
-       }
-
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot connect - [%d] %s\n",
-                       mysqli_connect_errno(),
-                       mysqli_connect_error());
-
-       /* create new table and select from it */
-       $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'FORMAT(col1, 0)', 'test', NULL, array(), 100);
-
-       $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 110);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
-
-       $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 130);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
-
-       $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 150);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
-
-       mysqli_close($link);
-       print "done!";
+    require_once("connect.inc");
+
+    function create_table($link, $column, $min, $max, $engine, $offset) {
+
+        if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+            printf("[%03d] Cannot drop table test, [%d] %s\n",
+                $offset,
+                mysqli_errno($link), mysqli_error($link));
+            return array();
+        }
+        print "$column\n";
+
+        $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
+            $column, $engine);
+        if (!mysqli_query($link, $sql)) {
+            printf("[%03d] Cannot create table test, [%d] %s\n",
+                $offset + 1,
+                mysqli_errno($link), mysqli_error($link));
+            return array();
+        }
+
+        $values = array();
+        for ($i = 1; $i <= 100; $i++) {
+            $col1 = mt_rand($min, $max);
+            $values[$i] = $col1;
+            $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
+                $i, $col1);
+            if (!mysqli_query($link, $sql)) {
+                printf("[%03d] Cannot insert data, [%d] %s\n",
+                    $offset + 2,
+                    mysqli_errno($link), mysqli_error($link));
+                return array();
+            }
+        }
+
+        return $values;
+    }
+
+    function test_format($link, $format, $from, $order_by, $expected, $offset) {
+
+        if (!$stmt = mysqli_stmt_init($link)) {
+            printf("[%03d] Cannot create PS, [%d] %s\n",
+                $offset,
+                mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+        print "$format\n";
+
+        if ($order_by)
+            $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
+        else
+            $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
+
+        if (!mysqli_stmt_prepare($stmt, $sql)) {
+            printf("[%03d] Cannot prepare PS, [%d] %s\n",
+                $offset + 1,
+                mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+            return false;
+        }
+
+        if (!mysqli_stmt_execute($stmt)) {
+            printf("[%03d] Cannot execute PS, [%d] %s\n",
+                $offset + 2,
+                mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+            return false;
+        }
+
+        if (!mysqli_stmt_store_result($stmt)) {
+            printf("[%03d] Cannot store result set, [%d] %s\n",
+                $offset + 3,
+                mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+            return false;
+        }
+
+        if (!is_array($expected)) {
+
+            $result = null;
+            if (!mysqli_stmt_bind_result($stmt, $result)) {
+                printf("[%03d] Cannot bind result, [%d] %s\n",
+                    $offset + 4,
+                    mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                return false;
+            }
+
+            if (!mysqli_stmt_fetch($stmt)) {
+                printf("[%03d] Cannot fetch result,, [%d] %s\n",
+                    $offset + 5,
+                    mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                return false;
+            }
+
+            if ($result !== $expected) {
+                printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
+                    $offset + 6,
+                    gettype($expected), $expected,
+                    gettype($result), $result,
+                    $format, $sql);
+            }
+
+        } else {
+
+            $order_by_col = $result = null;
+            if (!is_null($order_by)) {
+                if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
+                    printf("[%03d] Cannot bind result, [%d] %s\n",
+                        $offset + 7,
+                        mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                    return false;
+                }
+            } else {
+                if (!mysqli_stmt_bind_result($stmt, $result)) {
+                    printf("[%03d] Cannot bind result, [%d] %s\n",
+                        $offset + 7,
+                        mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                    return false;
+                }
+            }
+
+            foreach ($expected as $k => $v) {
+                if (!mysqli_stmt_fetch($stmt)) {
+                    break;
+                }
+                if ($result !== $v) {
+                    printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
+                        $offset + 8,
+                        $k,
+                        gettype($v), $v,
+                        gettype($result), $result,
+                        $order_by_col,
+                        $format, $sql);
+                }
+            }
+
+        }
+
+        mysqli_stmt_free_result($stmt);
+        mysqli_stmt_close($stmt);
+
+        return true;
+    }
+
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot connect - [%d] %s\n",
+            mysqli_connect_errno(),
+            mysqli_connect_error());
+
+    /* create new table and select from it */
+    $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'FORMAT(col1, 0)', 'test', NULL, array(), 100);
+
+    $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 110);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
+
+    $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 130);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
+
+    $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 150);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
+
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 8624250eb1a1693f3a60570531ddb8518df0e080..c6f18f30166b912f6d86985369fd34a326429acf 100644 (file)
@@ -6,10 +6,10 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 50000) {
-       die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --FILE--
index 948e4aaee7b38abd38bff613dce27649d12d7f87..b5cecd5685a41678515dd56cc739e63277fb3f4c 100644 (file)
@@ -5,16 +5,16 @@ Bug #44879 (failed to prepare statement)
 require_once('skipif.inc');
 
 if (!stristr(mysqli_get_client_info(), 'mysqlnd'))
-       die("skip: only available in mysqlnd");
+    die("skip: only available in mysqlnd");
 
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 50000) {
-       die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --FILE--
@@ -78,7 +78,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_query($link, "DROP PROCEDURE IF EXISTS p");
 
index 2ddacf4fdd2aed129e74f8be1ce2d327e528d515..974887276f606b44366de13d3200d914690abba3 100644 (file)
@@ -34,7 +34,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [004] [%s
index 9e7822271300be1611e447be929b5905bdc25e68..d301b87f6a7db2e2ee0f663b0f471d0039b1b58b 100644 (file)
@@ -5,7 +5,7 @@ Bug #46614 (Extended MySQLi class gives incorrect empty() result)
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 if (!defined("MYSQLI_ASYNC")) {
-       die("skip mysqlnd only");
+    die("skip mysqlnd only");
 }
 ?>
 --FILE--
index 0358802bac168fafe59472a01493bdc79bcb7144..c8e720a44c3144c1440b80dec6f620730bb3b466 100644 (file)
@@ -5,7 +5,7 @@ Bug #47050 (mysqli_poll() modifies improper variables)
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 if (!defined("MYSQLI_ASYNC")) {
-       die("skip mysqlnd only");
+    die("skip mysqlnd only");
 }
 ?>
 --FILE--
index ef46c97c6a5b126b55028e9795eb63c8ffe5b0e6..071f53dc7c607ea4fd09ad60f45cda2f922bd13e 100644 (file)
@@ -40,7 +40,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done
index 059d9865844ac4a6fb5fbe368fbfd927d4e3906d..0ff2f51935de579ba4df0d9970b048f7948bba92 100644 (file)
@@ -48,7 +48,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 array(1) {
index d9093f0347f2f92a534a7f16be47e8aec9c6a5f1..4c3fbcdb24bc87ad2d11c9f77c1c7fdb1f29613e 100644 (file)
@@ -7,12 +7,12 @@ require_once('skipifconnectfailure.inc');
 
 $link = mysqli_init();
 if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 }
 
 include_once("local_infile_tools.inc");
 if ($msg = check_local_infile_support($link, $engine))
-       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+    die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
 
 mysqli_close($link);
 ?>
@@ -22,87 +22,87 @@ mysqli.allow_persistent=1
 mysqli.max_persistent=1
 --FILE--
 <?php
-       include ("connect.inc");
-
-       $link = mysqli_init();
-       if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
-
-       if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
-               printf("[002] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       }
-
-       if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
-               printf("[003] Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       }
-
-       include("local_infile_tools.inc");
-       $file = create_standard_csv(4);
-
-       if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
-                       INTO TABLE test
-                       FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
-                       LINES TERMINATED BY '\n'",
-                       mysqli_real_escape_string($link, $file)))) {
-                       printf("[005] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
-       }
-
-       if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
-               printf("[006] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
-
-       $rows = array();
-       while ($row = mysqli_fetch_assoc($res)) {
-               var_dump($row);
-               $rows[] = $row;
-       }
-
-       mysqli_free_result($res);
-
-       mysqli_query($link, "DELETE FROM test");
-       mysqli_close($link);
-
-       if ($IS_MYSQLND) {
-               /*
-                       mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
-                       At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
-                       'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
-                       not consider it as a 'persistent' connection in a user sense, ext/mysqli will not appy max_persistent etc.
-                       Its only about malloc() vs. emalloc().
-
-                       However, the bug is about malloc() and efree(). You can make make mysqlnd use malloc() by either using
-                       pconnect or mysql_init() - so we should test pconnect as well..
-               */
-               $host = 'p:' . $host;
-               if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-                       printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-               }
-
-               /* bug happened during query processing */
-               if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
-                       INTO TABLE test
-                       FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
-                       LINES TERMINATED BY '\n'",
-                       mysqli_real_escape_string($link, $file)))) {
-                       printf("[008] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
-               }
-
-               /* we survived? that's good enough... */
-
-               if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
-                       printf("[009] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
-
-               $i = 0;
-               while ($row = mysqli_fetch_assoc($res)) {
-                       if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) {
-                               printf("[010] Wrong values, check manually!\n");
-                       }
-                       $i++;
-               }
-               mysqli_close($link);
-       }
-
-       print "done!";
+    include ("connect.inc");
+
+    $link = mysqli_init();
+    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
+
+    if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+        printf("[002] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    }
+
+    if (!mysqli_query($link, 'CREATE TABLE test(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
+        printf("[003] Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    }
+
+    include("local_infile_tools.inc");
+    $file = create_standard_csv(4);
+
+    if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+            INTO TABLE test
+            FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+            LINES TERMINATED BY '\n'",
+            mysqli_real_escape_string($link, $file)))) {
+            printf("[005] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+    }
+
+    if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
+        printf("[006] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+
+    $rows = array();
+    while ($row = mysqli_fetch_assoc($res)) {
+        var_dump($row);
+        $rows[] = $row;
+    }
+
+    mysqli_free_result($res);
+
+    mysqli_query($link, "DELETE FROM test");
+    mysqli_close($link);
+
+    if ($IS_MYSQLND) {
+        /*
+            mysqlnd makes a connection created through mysql_init()/mysqli_real_connect() always a 'persistent' one.
+            At this point 'persistent' is not to be confused with what a user calls a 'persistent' - in this case
+            'persistent' means that mysqlnd uses malloc() instead of emalloc(). nothing else. ext/mysqli will
+            not consider it as a 'persistent' connection in a user sense, ext/mysqli will not appy max_persistent etc.
+            Its only about malloc() vs. emalloc().
+
+            However, the bug is about malloc() and efree(). You can make make mysqlnd use malloc() by either using
+            pconnect or mysql_init() - so we should test pconnect as well..
+        */
+        $host = 'p:' . $host;
+        if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+            printf("[007] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+        }
+
+        /* bug happened during query processing */
+        if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+            INTO TABLE test
+            FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+            LINES TERMINATED BY '\n'",
+            mysqli_real_escape_string($link, $file)))) {
+            printf("[008] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+        }
+
+        /* we survived? that's good enough... */
+
+        if (!$res = mysqli_query($link, "SELECT * FROM test ORDER BY id"))
+            printf("[009] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+
+        $i = 0;
+        while ($row = mysqli_fetch_assoc($res)) {
+            if (($row['id'] != $rows[$i]['id']) || ($row['label'] != $rows[$i]['label'])) {
+                printf("[010] Wrong values, check manually!\n");
+            }
+            $i++;
+        }
+        mysqli_close($link);
+    }
+
+    print "done!";
 ?>
 --CLEAN--
 <?php
index c57a7b36d301942986546cbfbabfb06232c7d80d..c3238da289e864e837e1a4159c010fb4cf444eef 100644 (file)
@@ -12,30 +12,30 @@ mysqli.max_persistent = 0
 mysqli.reconnect = Off
 --FILE--
 <?php
-       include ("connect.inc");
+    include ("connect.inc");
 
-       $link = mysqli_init();
-       if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-               printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
-       mysqli_close($link);
-       echo "closed once\n";
+    $link = mysqli_init();
+    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
+    mysqli_close($link);
+    echo "closed once\n";
 
-       $link = mysqli_init();
-       if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-               printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
-       mysqli_close($link);
-       echo "closed twice\n";
+    $link = mysqli_init();
+    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
+    mysqli_close($link);
+    echo "closed twice\n";
 
-       $link = mysqli_init();
-       if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-               printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
-       mysqli_close($link);
-       echo "closed for third time\n";
+    $link = mysqli_init();
+    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+        printf("[003] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
+    mysqli_close($link);
+    echo "closed for third time\n";
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 closed once
index cd7ccf8017a4d8cdadccc067ea032e6fda216430..abcf5e4f0e43d3673ba41438e56de492fc5f4f18 100644 (file)
@@ -7,33 +7,33 @@ require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 
 if ($IS_MYSQLND && !extension_loaded("openssl"))
-       die("skip PHP streams lack support for SSL. mysqli is compiled to use mysqlnd which uses PHP streams in turn.");
+    die("skip PHP streams lack support for SSL. mysqli is compiled to use mysqlnd which uses PHP streams in turn.");
 
 if (!($link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
-       die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (false === strpos($link->host_info, 'TCP/IP'))
-       die(sprintf("skip SSL only supported on TCP/IP"));
+    die(sprintf("skip SSL only supported on TCP/IP"));
 
 $row = NULL;
 if ($res = $link->query('SHOW VARIABLES LIKE "have_ssl"')) {
-       $row = $res->fetch_row();
+    $row = $res->fetch_row();
 } else {
-       if ($link->errno == 1064 && ($res = $link->query("SHOW VARIABLES"))) {
-               while ($row = $res->fetch_row())
-                       if ($row[0] == 'have_ssl')
-                               break;
-       } else {
-               die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
-       }
+    if ($link->errno == 1064 && ($res = $link->query("SHOW VARIABLES"))) {
+        while ($row = $res->fetch_row())
+            if ($row[0] == 'have_ssl')
+                break;
+    } else {
+        die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+    }
 }
 
 
 if (empty($row))
-       die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
 
 if (($row[1] == 'NO') || ($row[1] == 'DISABLED'))
-       die(sprintf("skip MySQL has no SSL support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip MySQL has no SSL support, [%d] %s", $link->errno, $link->error));
 
 $link->close();
 ?>
index 22fcb735e33528e0647f60792ed145dedb14691b..8ea2e36f35d5e6e9489261ea9e7d2e715cadae1f 100644 (file)
@@ -5,7 +5,7 @@ Bug #52891 (Wrong data inserted with mysqli/mysqlnd when using bind_param,value
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 if (!$IS_MYSQLND) {
-       die("skip: test applies only to mysqlnd");
+    die("skip: test applies only to mysqlnd");
 }
 ?>
 --FILE--
@@ -100,16 +100,16 @@ if (!$IS_MYSQLND) {
 require_once('connect.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket);
+    printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket);
 }
 
 if (!mysqli_query($link, 'DROP TABLE IF EXISTS tuint')) {
-       printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 }
 
 if (!mysqli_query($link, 'DROP TABLE IF EXISTS tsint')) {
-       printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 }
 
 mysqli_close($link);
index fea62fde791a058665e0547073c4dae98963108c..0b187102f7550436f5c02f8322f25e39b6aa3a5d 100644 (file)
@@ -6,11 +6,11 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die("skip Cannot connect to MySQL");
+    die("skip Cannot connect to MySQL");
 
 include_once("local_infile_tools.inc");
 if ($msg = check_local_infile_support($link, $engine))
-       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+    die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
 
 mysqli_close($link);
 
@@ -19,33 +19,33 @@ mysqli_close($link);
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       if (!$link->query("DROP TABLE IF EXISTS test")) {
-               printf("[002] [%d] %s\n", $link->errno, $link->error);
-       }
+    if (!$link->query("DROP TABLE IF EXISTS test")) {
+        printf("[002] [%d] %s\n", $link->errno, $link->error);
+    }
 
-       if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
-               printf("[003] [%d] %s\n", $link->errno, $link->error);
-       }
+    if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+        printf("[003] [%d] %s\n", $link->errno, $link->error);
+    }
 
-       if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
-               printf("[004] Failed to create CVS file\n");
+    if (FALSE == file_put_contents('bug53503.data', "1\n2\n3\n"))
+        printf("[004] Failed to create CVS file\n");
 
-       if (!$link->query("SELECT 1 FROM DUAL"))
-               printf("[005] [%d] %s\n", $link->errno, $link->error);
+    if (!$link->query("SELECT 1 FROM DUAL"))
+        printf("[005] [%d] %s\n", $link->errno, $link->error);
 
-       if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
-               printf("[006] [%d] %s\n", $link->errno, $link->error);
-               echo "bug";
-       } else {
-               echo "done";
-       }
-       $link->close();
+    if (!$link->query("LOAD DATA LOCAL INFILE 'bug53503.data' INTO TABLE test")) {
+        printf("[006] [%d] %s\n", $link->errno, $link->error);
+        echo "bug";
+    } else {
+        echo "done";
+    }
+    $link->close();
 ?>
 --CLEAN--
 <?php
index eef4695327ca716c56b7d35dfd32bebc32d01c97..602ea68583abc497ff5ebb19b50937e6474d68b5 100644 (file)
@@ -12,34 +12,34 @@ mysqli.max_persistent = 0
 mysqli.reconnect = Off
 --FILE--
 <?php
-       include ("connect.inc");
+    include ("connect.inc");
 
-       $link = mysqli_init();
-       if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-               printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    $link = mysqli_init();
+    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       $create = "CREATE TEMPORARY TABLE IF NOT EXISTS t54221(a int)";
+    $create = "CREATE TEMPORARY TABLE IF NOT EXISTS t54221(a int)";
 
-       $query = "$create;$create;$create;";
-       if ($link->multi_query($query)) {
-               do {
-                       $sth = $link->store_result();
+    $query = "$create;$create;$create;";
+    if ($link->multi_query($query)) {
+        do {
+            $sth = $link->store_result();
 
-                       if ($link->warning_count) {
-                               $warnings = $link->get_warnings();
-                               if ($warnings) {
-                                       do {
-                                               echo "Warning: ".$warnings->errno.": ".$warnings->message."\n";
-                                       } while ($warnings->next());
-                               }
-                       }
-               } while ($link->more_results() && $link->next_result());
-       }
+            if ($link->warning_count) {
+                $warnings = $link->get_warnings();
+                if ($warnings) {
+                    do {
+                        echo "Warning: ".$warnings->errno.": ".$warnings->message."\n";
+                    } while ($warnings->next());
+                }
+            }
+        } while ($link->more_results() && $link->next_result());
+    }
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 Warning: 1050: Table 't54221' already exists
index e18eed7f99cb9467d452d66cd63d24a6fd45b407..b3c44be290d08e9cd72fefecd09346ffbec0cdc7 100644 (file)
@@ -12,19 +12,19 @@ mysqli.max_persistent = 0
 mysqli.reconnect = Off
 --FILE--
 <?php
-       include ("connect.inc");
+    include ("connect.inc");
 
-       $link = mysqli_init();
-       if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-               printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    $link = mysqli_init();
+    if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
+        printf("[002] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       $japanese_so = pack('H4', '835c');
-       $link->set_charset('sjis');
-       var_dump($link->real_escape_string($japanese_so) === $japanese_so);
-       mysqli_close($link);
+    $japanese_so = pack('H4', '835c');
+    $link->set_charset('sjis');
+    var_dump($link->real_escape_string($japanese_so) === $japanese_so);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 bool(true)
index 843400ff98d89d438e26c70f793de3113dd411d0..b0714aeaaae4d53e74fff50e9e56674f48ad4cc0 100644 (file)
@@ -7,33 +7,33 @@ require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 
 if ($IS_MYSQLND && !extension_loaded("openssl"))
-       die("skip PHP streams lack support for SSL. mysqli is compiled to use mysqlnd which uses PHP streams in turn.");
+    die("skip PHP streams lack support for SSL. mysqli is compiled to use mysqlnd which uses PHP streams in turn.");
 
 if (!($link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)))
-       die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Connect failed, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (false === strpos($link->host_info, 'TCP/IP'))
-       die(sprintf("skip SSL only supported on TCP/IP"));
+    die(sprintf("skip SSL only supported on TCP/IP"));
 
 $row = NULL;
 if ($res = $link->query('SHOW VARIABLES LIKE "have_ssl"')) {
-       $row = $res->fetch_row();
+    $row = $res->fetch_row();
 } else {
-       if ($link->errno == 1064 && ($res = $link->query("SHOW VARIABLES"))) {
-               while ($row = $res->fetch_row())
-                       if ($row[0] == 'have_ssl')
-                               break;
-       } else {
-               die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
-       }
+    if ($link->errno == 1064 && ($res = $link->query("SHOW VARIABLES"))) {
+        while ($row = $res->fetch_row())
+            if ($row[0] == 'have_ssl')
+                break;
+    } else {
+        die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+    }
 }
 
 
 if (empty($row))
-       die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Failed to test for MySQL SSL support, [%d] %s", $link->errno, $link->error));
 
 if (($row[1] == 'NO') || ($row[1] == 'DISABLED'))
-       die(sprintf("skip MySQL has no SSL support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip MySQL has no SSL support, [%d] %s", $link->errno, $link->error));
 
 $link->close();
 ?>
index f36c2bf6e76343acf6561c984bbddee2c0ce7eca..de33c4c4ed7cb39219046202208135e930999986 100644 (file)
@@ -2,63 +2,63 @@
 mysqli_float_handling - ensure 4 byte float is handled correctly
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --INI--
 precision=5
 --FILE--
 <?php
-       require('connect.inc');
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-               die();
-       }
+    require('connect.inc');
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+        die();
+    }
 
 
-       if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
-               printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+        printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
-       if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) {
-               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    if (!mysqli_query($link, "CREATE TABLE test(id INT PRIMARY KEY, fp4 FLOAT, fp8 DOUBLE) ENGINE = InnoDB")) {
+        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
-       // Insert via string to make sure the real floating number gets to the DB
-       if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) {
-               printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    // Insert via string to make sure the real floating number gets to the DB
+    if (!mysqli_query($link, "INSERT INTO test(id, fp4, fp8) VALUES (1, 9.9999, 9.9999)")) {
+        printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
-       if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) {
-               printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    if (!($stmt = mysqli_prepare($link, "SELECT id, fp4, fp8 FROM test"))) {
+        printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
-       $id = null;
-       $fp4 = null;
-       $fp8 = null;
+    $id = null;
+    $fp4 = null;
+    $fp8 = null;
 
-       if (!mysqli_stmt_bind_result($stmt, $id, $fp4, $fp8)) {
-               printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    if (!mysqli_stmt_bind_result($stmt, $id, $fp4, $fp8)) {
+        printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
-       if (!mysqli_stmt_execute($stmt)) {
-               printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    if (!mysqli_stmt_execute($stmt)) {
+        printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
 
-       if (!(mysqli_stmt_fetch($stmt))) {
-               printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die();
-       }
+    if (!(mysqli_stmt_fetch($stmt))) {
+        printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die();
+    }
 
-       print $id . ": " . $fp4 . ": " . $fp8 . "\n";
+    print $id . ": " . $fp4 . ": " . $fp8 . "\n";
 ?>
 --CLEAN--
 <?php
index 639603aa50a7612a1014e12b073cf761f74c190b..2be4fe97aa84a9e8a6fc471dd6535ef882e0b613 100644 (file)
@@ -5,14 +5,14 @@ Bug #68077 (LOAD DATA LOCAL INFILE / open_basedir restriction)
 require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 if (!$IS_MYSQLND) {
-       die("skip: test applies only to mysqlnd");
+    die("skip: test applies only to mysqlnd");
 }
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die("skip Cannot connect to MySQL");
+    die("skip Cannot connect to MySQL");
 
 include_once("local_infile_tools.inc");
 if ($msg = check_local_infile_support($link, $engine))
-       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+    die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
 
 mysqli_close($link);
 ?>
@@ -23,42 +23,42 @@ mysqli.max_persistent=1
 open_basedir=
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       ini_set("open_basedir", __DIR__);
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    ini_set("open_basedir", __DIR__);
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       if (!$link->query("DROP TABLE IF EXISTS test")) {
-               printf("[002] [%d] %s\n", $link->errno, $link->error);
-       }
+    if (!$link->query("DROP TABLE IF EXISTS test")) {
+        printf("[002] [%d] %s\n", $link->errno, $link->error);
+    }
 
-       if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
-               printf("[003] [%d] %s\n", $link->errno, $link->error);
-       }
+    if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+        printf("[003] [%d] %s\n", $link->errno, $link->error);
+    }
 
-       if (FALSE == file_put_contents(__DIR__ . '/bug53503.data', "1\n2\n3\n"))
-               printf("[004] Failed to create CVS file\n");
+    if (FALSE == file_put_contents(__DIR__ . '/bug53503.data', "1\n2\n3\n"))
+        printf("[004] Failed to create CVS file\n");
 
-       if (!$link->query("SELECT 1 FROM DUAL"))
-               printf("[005] [%d] %s\n", $link->errno, $link->error);
+    if (!$link->query("SELECT 1 FROM DUAL"))
+        printf("[005] [%d] %s\n", $link->errno, $link->error);
 
-       if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__)  . "/bug53503.data' INTO TABLE test")) {
-               printf("[006] [%d] %s\n", $link->errno, $link->error);
-               echo "bug\n";
-       } else {
-               echo "done\n";
-       }
+    if (!$link->query("LOAD DATA LOCAL INFILE '" . str_replace("\\", "/", __DIR__)  . "/bug53503.data' INTO TABLE test")) {
+        printf("[006] [%d] %s\n", $link->errno, $link->error);
+        echo "bug\n";
+    } else {
+        echo "done\n";
+    }
 
-       ini_set("open_basedir", __DIR__ . "/dummy");
-       if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) {
-               printf("[006] [%d] %s\n", $link->errno, $link->error);
-               echo "done\n";
-       } else {
-               echo "bug\n";
-       }
-       $link->close();
+    ini_set("open_basedir", __DIR__ . "/dummy");
+    if (!$link->query("LOAD DATA LOCAL INFILE '" . __DIR__ . "/bug53503.data' INTO TABLE test")) {
+        printf("[006] [%d] %s\n", $link->errno, $link->error);
+        echo "done\n";
+    } else {
+        echo "bug\n";
+    }
+    $link->close();
 ?>
 --CLEAN--
 <?php
index 6859b91c1317508997dc6691fcda8234182b357b..4de74270cd9d89a703f1b01658562af7c340a13a 100644 (file)
@@ -12,7 +12,7 @@ require_once __DIR__ . '/skipif.inc';
 require_once __DIR__ . '/skipifconnectfailure.inc';
 require_once __DIR__ . '/connect.inc';
 if (!$IS_MYSQLND) {
-       die('skip mysqlnd only');
+    die('skip mysqlnd only');
 }
 ?>
 --FILE--
index 0f062f0035081e42fa41637a7f87115a2a9f2f97..627b9ba256d8601e0a8b912c6900d13447fb96b2 100644 (file)
@@ -2,20 +2,20 @@
 mysqli_float_handling - ensure 4 byte float is handled correctly
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-       if (@$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               if ($link->server_version < 50709) {
-                       die("skip MySQL 5.7.9+ needed. Found [".
-                               intval(substr($link->server_version."", -5, 1)).
-                               ".".
-                               intval(substr($link->server_version."", -4, 2)).
-                               ".".
-                               intval(substr($link->server_version."", -2, 2)).
-                               "]");
-               }
-       }
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+    if (@$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        if ($link->server_version < 50709) {
+            die("skip MySQL 5.7.9+ needed. Found [".
+                intval(substr($link->server_version."", -5, 1)).
+                ".".
+                intval(substr($link->server_version."", -4, 2)).
+                ".".
+                intval(substr($link->server_version."", -2, 2)).
+                "]");
+        }
+    }
 ?>
 --FILE--
 <?php
@@ -56,7 +56,7 @@ mysqli_float_handling - ensure 4 byte float is handled correctly
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 OK
index dc7b20215200b26c0b33e67e4a1fe81c22fbe57d..c3b53bcf164e63085649ae74882f7310b8b7496c 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 if (!$IS_MYSQLND) {
-       die("skip mysqlnd only test");
+    die("skip mysqlnd only test");
 }
 ?>
 --FILE--
@@ -51,7 +51,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS bug70949"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 18465e996b92b76271d9f72015c48abaa9b11a38..1490f9fe9691f1e1fd6f415cec9968c2e21d4b4d 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 if (!$IS_MYSQLND) {
-       die("skip mysqlnd only test");
+    die("skip mysqlnd only test");
 }
 ?>
 --FILE--
index f0eb174172201a34da80a9bd7aaf6e41e568785e..e60d0ad65bcda3c90a9113df08248d44cd421473 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 
 if ("127.0.0.1" != $host && "localhost" != $host) {
-       die("skip require 127.0.0.1 connection");
+    die("skip require 127.0.0.1 connection");
 }
 
 ?>
index 2f5ded1de474c802e3bafbc8c11feac3e20aa0e0..4ec4124d0930a61a575a355e6130424c7c20c204 100644 (file)
@@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die("skip Cannot connect to check required version");
+    die("skip Cannot connect to check required version");
 
 /* Fractional seconds are supported with servers >= 5.6.4. */
 if (mysqli_get_server_version($link) < 50604) {
-       die(sprintf("skip Server doesn't support fractional seconds in timestamp (%s)", mysqli_get_server_version($link)));
+    die(sprintf("skip Server doesn't support fractional seconds in timestamp (%s)", mysqli_get_server_version($link)));
 }
 mysqli_close($link);
 ?>
index 6c752299d46890974ecb64e32ea1a8ad070e3d26..b1f3b1eb40356b7b4e4141717f28b4e98a55c435 100644 (file)
@@ -7,39 +7,39 @@ require_once('skipifconnectfailure.inc');
 
 $link = mysqli_init();
 if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 }
 
 require_once('local_infile_tools.inc');
 if ($msg = check_local_infile_support($link, $engine))
-       die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
+    die(sprintf("skip %s, [%d] %s", $msg, $link->errno, $link->error));
 
 ?>
 --INI--
 mysqli.allow_local_infile=0
 --FILE--
 <?php
-       require_once("connect.inc");
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
-       if (!$link->query("DROP TABLE IF EXISTS test")) {
-               printf("[002] [%d] %s\n", $link->errno, $link->error);
-       }
-       if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
-               printf("[003] [%d] %s\n", $link->errno, $link->error);
-       }
-       if (FALSE == file_put_contents('bug77956.data', "waa? meukee!"))
-               printf("[004] Failed to create CVS file\n");
-       if (!$link->query("SELECT 1 FROM DUAL"))
-               printf("[005] [%d] %s\n", $link->errno, $link->error);
-       if (!$link->query("LOAD DATA LOCAL INFILE 'bug77956.data' INTO TABLE test")) {
-               printf("[006] [%d] %s\n", $link->errno, $link->error);
-               echo "done";
-       } else {
-               echo "bug";
-       }
-       $link->close();
+    require_once("connect.inc");
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
+    if (!$link->query("DROP TABLE IF EXISTS test")) {
+        printf("[002] [%d] %s\n", $link->errno, $link->error);
+    }
+    if (!$link->query("CREATE TABLE test (dump1 INT UNSIGNED NOT NULL PRIMARY KEY) ENGINE=" . $engine)) {
+        printf("[003] [%d] %s\n", $link->errno, $link->error);
+    }
+    if (FALSE == file_put_contents('bug77956.data', "waa? meukee!"))
+        printf("[004] Failed to create CVS file\n");
+    if (!$link->query("SELECT 1 FROM DUAL"))
+        printf("[005] [%d] %s\n", $link->errno, $link->error);
+    if (!$link->query("LOAD DATA LOCAL INFILE 'bug77956.data' INTO TABLE test")) {
+        printf("[006] [%d] %s\n", $link->errno, $link->error);
+        echo "done";
+    } else {
+        echo "bug";
+    }
+    $link->close();
 ?>
 --CLEAN--
 <?php
index 86e5fcb37968e25d9b07a4096510c6547920ab6a..a3dc8b66debf11d84c551993ff33599175df4fe0 100644 (file)
@@ -2,12 +2,12 @@
 require_once('connect.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket);
+    printf("[clean] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket);
 }
 
 if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
-       printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[clean] Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 }
 
 mysqli_close($link);
index 6af574ad0f6df34e28cabd594d8230a0d2be6eb7..103ad6804c1107a709d5c7cd2abcf7c187014262 100644 (file)
 <?php
-       /*
-       Default values are "localhost", "root",
-       database "test" and empty password.
-       Change the MYSQL_TEST environment values
-       if you want to use another configuration
-       */
-
-       $driver    = new mysqli_driver;
-
-       $host      = getenv("MYSQL_TEST_HOST")     ?: "localhost";
-       $port      = getenv("MYSQL_TEST_PORT")     ?: 3306;
-       $user      = getenv("MYSQL_TEST_USER")     ?: "root";
-       $passwd    = getenv("MYSQL_TEST_PASSWD")   ?: "";
-       $db        = getenv("MYSQL_TEST_DB")       ?: "test";
-       $engine    = getenv("MYSQL_TEST_ENGINE")   ?: "InnoDB";
-       $socket    = getenv("MYSQL_TEST_SOCKET")   ?: null;
-       $skip_on_connect_failure  = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true;
-       $connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0;
-       if ($socket) {
-               ini_set('mysqli.default_socket', $socket);
-       }
-
-       /* Development setting: test experimal features and/or feature requests that never worked before? */
-       $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ?
-                               ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) :
-                               false;
-
-       $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
-
-       if (!function_exists('sys_get_temp_dir')) {
-               function sys_get_temp_dir() {
-
-                       if (!empty($_ENV['TMP']))
-                               return realpath( $_ENV['TMP'] );
-                       if (!empty($_ENV['TMPDIR']))
-                               return realpath( $_ENV['TMPDIR'] );
-                       if (!empty($_ENV['TEMP']))
-                               return realpath( $_ENV['TEMP'] );
-
-                       $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
-                       if ($temp_file) {
-                               $temp_dir = realpath(dirname($temp_file));
-                               unlink($temp_file);
-                               return $temp_dir;
-                       }
-                       return FALSE;
-               }
-       }
-
-       if (!function_exists('my_mysqli_connect')) {
-
-               /**
-               * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
-               *
-               * @param enable_env_flags Enable setting of connection flags through    env(MYSQL_TEST_CONNECT_FLAGS)?
-               */
-               function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
-                       global $connect_flags;
-
-                       $flags = $enable_env_flags? $connect_flags:0;
-                       if ($flags !== 0) {
-                               $link = mysqli_init();
-                               if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
-                                       $link = false;
-                       } else {
-                               $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-                       }
-
-                       return $link;
-               }
-
-               /**
-               * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
-               *
-               * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
-               */
-               function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) {
-                       global $connect_flags;
-
-                       if ($enable_env_flags)
-                               $flags = $flags | $connect_flags;
-
-                       return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
-               }
-
-               class my_mysqli extends mysqli {
-                       public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
-                               global $connect_flags;
-
-                               $flags = ($enable_env_flags) ? $connect_flags : 0;
-
-                               if ($flags !== false) {
-                                       parent::init();
-                                       $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags);
-                               } else {
-                                       parent::__construct($host, $user, $passwd, $db, $port, $socket);
-                               }
-                       }
-               }
-
-               function have_innodb($link) {
-                 if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) &&
-                               ($row = $res->fetch_row()) &&
-                               !empty($row)) {
-                               if ($row[1] == "DISABLED" || $row[1] == "NO") {
-                                       return false;
-                               }
-                               return true;
-                 } else {
-                               /* MySQL 5.6.1+ */
-                               if ($res = $link->query("SHOW ENGINES")) {
-                                       while ($row = $res->fetch_assoc()) {
-                                               if (!isset($row['Engine']) || !isset($row['Support']))
-                                                       return false;
-
-                                               if (('InnoDB' == $row['Engine']) &&
-                                                       (('YES' == $row['Support']) || ('DEFAULT' == $row['Support']))
-                                                       ) {
-                                                       return true;
-                                               }
-                                       }
-                                       return false;
-                               } else {
-                                       return false;
-                               }
-                 }
-                 return false;
-               }
-
-       } else {
-               printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
-       }
-
-       function handle_catchable_fatal($errno, $error, $file, $line) {
-               static $errcodes = array();
-               if (empty($errcodes)) {
-                       $constants = get_defined_constants();
-                       foreach ($constants as $name => $value) {
-                               if (substr($name, 0, 2) == "E_")
-                                       $errcodes[$value] = $name;
-                       }
-               }
-               printf("[%s] %s in %s on line %s\n",
-                       (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno,
-                        $error, $file, $line);
-
-               return true;
-       }
+    /*
+    Default values are "localhost", "root",
+    database "test" and empty password.
+    Change the MYSQL_TEST environment values
+    if you want to use another configuration
+    */
+
+    $driver    = new mysqli_driver;
+
+    $host      = getenv("MYSQL_TEST_HOST")     ?: "localhost";
+    $port      = getenv("MYSQL_TEST_PORT")     ?: 3306;
+    $user      = getenv("MYSQL_TEST_USER")     ?: "root";
+    $passwd    = getenv("MYSQL_TEST_PASSWD")   ?: "";
+    $db        = getenv("MYSQL_TEST_DB")       ?: "test";
+    $engine    = getenv("MYSQL_TEST_ENGINE")   ?: "InnoDB";
+    $socket    = getenv("MYSQL_TEST_SOCKET")   ?: null;
+    $skip_on_connect_failure  = getenv("MYSQL_TEST_SKIP_CONNECT_FAILURE") ?: true;
+    $connect_flags = (int)getenv("MYSQL_TEST_CONNECT_FLAGS") ?: 0;
+    if ($socket) {
+        ini_set('mysqli.default_socket', $socket);
+    }
+
+    /* Development setting: test experimal features and/or feature requests that never worked before? */
+    $TEST_EXPERIMENTAL = (in_array(getenv("MYSQL_TEST_EXPERIMENTAL"), array(0, 1))) ?
+                ((1 == getenv("MYSQL_TEST_EXPERIMENTAL")) ? true : false) :
+                false;
+
+    $IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
+
+    if (!function_exists('sys_get_temp_dir')) {
+        function sys_get_temp_dir() {
+
+            if (!empty($_ENV['TMP']))
+                return realpath( $_ENV['TMP'] );
+            if (!empty($_ENV['TMPDIR']))
+                return realpath( $_ENV['TMPDIR'] );
+            if (!empty($_ENV['TEMP']))
+                return realpath( $_ENV['TEMP'] );
+
+            $temp_file = tempnam(md5(uniqid(rand(), TRUE)), '');
+            if ($temp_file) {
+                $temp_dir = realpath(dirname($temp_file));
+                unlink($temp_file);
+                return $temp_dir;
+            }
+            return FALSE;
+        }
+    }
+
+    if (!function_exists('my_mysqli_connect')) {
+
+        /**
+        * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+        *
+        * @param enable_env_flags Enable setting of connection flags through   env(MYSQL_TEST_CONNECT_FLAGS)?
+        */
+        function my_mysqli_connect($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
+            global $connect_flags;
+
+            $flags = $enable_env_flags? $connect_flags:0;
+            if ($flags !== 0) {
+                $link = mysqli_init();
+                if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags))
+                    $link = false;
+            } else {
+                $link = mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+            }
+
+            return $link;
+        }
+
+        /**
+        * Whenever possible, please use this wrapper to make testing ot MYSQLI_CLIENT_COMPRESS (and potentially SSL) possible
+        *
+        * @param enable_env_flags Enable setting of connection flags through env(MYSQL_TEST_CONNECT_FLAGS)
+        */
+        function my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags = 0, $enable_env_flags = true) {
+            global $connect_flags;
+
+            if ($enable_env_flags)
+                $flags = $flags | $connect_flags;
+
+            return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags);
+        }
+
+        class my_mysqli extends mysqli {
+            public function __construct($host, $user, $passwd, $db, $port, $socket, $enable_env_flags = true) {
+                global $connect_flags;
+
+                $flags = ($enable_env_flags) ? $connect_flags : 0;
+
+                if ($flags !== false) {
+                    parent::init();
+                    $this->real_connect($host, $user, $passwd, $db, $port, $socket, $flags);
+                } else {
+                    parent::__construct($host, $user, $passwd, $db, $port, $socket);
+                }
+            }
+        }
+
+        function have_innodb($link) {
+          if (($res = $link->query("SHOW VARIABLES LIKE 'have_innodb'")) &&
+                ($row = $res->fetch_row()) &&
+                !empty($row)) {
+                if ($row[1] == "DISABLED" || $row[1] == "NO") {
+                    return false;
+                }
+                return true;
+          } else {
+                /* MySQL 5.6.1+ */
+                if ($res = $link->query("SHOW ENGINES")) {
+                    while ($row = $res->fetch_assoc()) {
+                        if (!isset($row['Engine']) || !isset($row['Support']))
+                            return false;
+
+                        if (('InnoDB' == $row['Engine']) &&
+                            (('YES' == $row['Support']) || ('DEFAULT' == $row['Support']))
+                            ) {
+                            return true;
+                        }
+                    }
+                    return false;
+                } else {
+                    return false;
+                }
+          }
+          return false;
+        }
+
+    } else {
+        printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n");
+    }
+
+    function handle_catchable_fatal($errno, $error, $file, $line) {
+        static $errcodes = array();
+        if (empty($errcodes)) {
+            $constants = get_defined_constants();
+            foreach ($constants as $name => $value) {
+                if (substr($name, 0, 2) == "E_")
+                    $errcodes[$value] = $name;
+            }
+        }
+        printf("[%s] %s in %s on line %s\n",
+            (isset($errcodes[$errno])) ? $errcodes[$errno] : $errno,
+             $error, $file, $line);
+
+        return true;
+    }
 ?>
index e37e22887a86bc7e5e662c15120eb0720af49388..35a9facd0667014131ac4e391b52d9e484211cb1 100644 (file)
@@ -27,7 +27,7 @@ require_once('skipifconnectfailure.inc');
 === DONE ===\r
 --CLEAN--\r
 <?php\r
-       require_once("clean_table.inc");\r
+    require_once("clean_table.inc");\r
 ?>\r
 --EXPECT--\r
 bool(false)\r
index af66d4c20c5a4e6727d1db28e47fadc1c9185d18..fef400d0a907fb99bed40b651371b1a3941b12d4 100644 (file)
 <?php
-       /* Utility function for mysqli_set_local_infile*.phpt tests */
-       function shutdown_clean($file) {
-               if ($file) {
-                       unlink($file);
-               }
-       }
-
-       function check_local_infile_support($link, $engine, $table_name = 'test') {
-
-               if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"'))
-                       return "Cannot check if Server variable 'local_infile' is set to 'ON'";
-
-               $row = mysqli_fetch_assoc($res);
-               mysqli_free_result($res);
-               if ('ON' != $row['Value'])
-                       return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']);
-
-               if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) {
-                       return "Failed to drop old test table";
-               }
-
-               if (!mysqli_query($link, $sql = sprintf('CREATE TABLE %s(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=%s',
-                       $table_name, $engine)))
-                       return "Failed to create test table: $sql";
-
-               $file = create_standard_csv(1, false);
-               if (!$file) {
-                       mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
-                       return "Cannot create CSV file";
-               }
-
-               if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
-                       INTO TABLE %s
-                       FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
-                       LINES TERMINATED BY '\n'",
-                       mysqli_real_escape_string($link, $file),
-                       $table_name))) {
-                         if (1148 == mysqli_errno($link)) {
-                                 mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
-                                 return "Cannot test LOAD DATA LOCAL INFILE, [1148] The used command is not allowed with this MySQL version";
-                         } else if ($link->errno) {
-                                 return $link->error;
-                         }
-               }
-               mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
-               return "";
-       }
-
-       function create_standard_csv($offset, $verbose = true) {
-               // create a CVS file
-               $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
-               if (!$fp = fopen($file, 'w')) {
-                       if ($verbose)
-                               printf("[%03d + 1] Cannot create CVS file '%s'\n", $offset, $file);
-                       return NULL;
-               } else {
-                       /* Looks ugly? No, handy if you have crashes... */
-                       register_shutdown_function("shutdown_clean", $file);
-               }
-
-               if (!fwrite($fp, "97;'x';\n") ||
-                       !fwrite($fp, "98;'y';\n") ||
-                       !fwrite($fp, "99;'z';\n")) {
-                       if ($verbose)
-                               printf("[%03d + 3] Cannot write CVS file '%s'\n", $offset, $file);
-                       return NULL;
-               }
-
-               fclose($fp);
-
-               if (!chmod($file, 0644)) {
-                       if ($verbose)
-                               printf("[%03d + 4] Cannot change the file perms of '%s' from 0600 to 0644, MySQL might not be able to read it\n",
-                                       $offset, $file);
-                       return NULL;
-               }
-               return $file;
-       }
-
-       function try_handler($offset, $link, $file, $handler, $expected = null) {
-
-               if ('default' == $handler) {
-                       mysqli_set_local_infile_default($link);
-               } else if (!mysqli_set_local_infile_handler($link, $handler)) {
-                       printf("[%03d] Cannot set infile handler to '%s'\n", $offset, $handler);
-                       return false;
-               }
-               printf("Callback set to '%s'\n", $handler);
-
-               if (!mysqli_query($link, sprintf("DELETE FROM test"))) {
-                       printf("[%03d] Cannot remove records, [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
-                       INTO TABLE test
-                       FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
-                       LINES TERMINATED BY '\n'",
-                       mysqli_real_escape_string($link, $file)))) {
-                       printf("[%03d] LOAD DATA failed, [%d] %s\n",
-                               $offset + 2,
-                               mysqli_errno($link), mysqli_error($link));
-               }
-
-               if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) {
-                       printf("[%03d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               if (!is_array($expected))
-                       return true;
-
-               foreach ($expected as $k => $values) {
-                       if (!$tmp = mysqli_fetch_assoc($res)) {
-                               printf("[%03d/%d] [%d] '%s'\n", $offset + 4, $k, mysqli_errno($link), mysqli_error($link));
-                               return false;
-                       }
-                       if ($values['id'] != $tmp['id']) {
-                               printf("[%03d/%d] Expecting %s got %s\n",
-                                       $offset + 5, $k,
-                                       $values['id'], $tmp['id']);
-                                       return false;
-                       }
-                       if ($values['label'] != $tmp['label']) {
-                               printf("[%03d/%d] Expecting %s got %s\n",
-                                       $offset + 6, $k,
-                                       $values['label'], $tmp['label']);
-                                       return false;
-                       }
-               }
-
-               if ($res && $tmp = mysqli_fetch_assoc($res)) {
-                       printf("[%03d] More results than expected!\n", $offset + 7);
-                       do {
-                               var_dump($tmp);
-                       } while ($tmp = mysqli_fetch_assoc($res));
-                       return false;
-               }
-
-               if ($res)
-                       mysqli_free_result($res);
-
-               return true;
-       }
+    /* Utility function for mysqli_set_local_infile*.phpt tests */
+    function shutdown_clean($file) {
+        if ($file) {
+            unlink($file);
+        }
+    }
+
+    function check_local_infile_support($link, $engine, $table_name = 'test') {
+
+        if (!$res = mysqli_query($link, 'SHOW VARIABLES LIKE "local_infile"'))
+            return "Cannot check if Server variable 'local_infile' is set to 'ON'";
+
+        $row = mysqli_fetch_assoc($res);
+        mysqli_free_result($res);
+        if ('ON' != $row['Value'])
+            return sprintf("Server variable 'local_infile' seems not set to 'ON', found '%s'", $row['Value']);
+
+        if (!mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name))) {
+            return "Failed to drop old test table";
+        }
+
+        if (!mysqli_query($link, $sql = sprintf('CREATE TABLE %s(id INT, label CHAR(1), PRIMARY KEY(id)) ENGINE=%s',
+            $table_name, $engine)))
+            return "Failed to create test table: $sql";
+
+        $file = create_standard_csv(1, false);
+        if (!$file) {
+            mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
+            return "Cannot create CSV file";
+        }
+
+        if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+            INTO TABLE %s
+            FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+            LINES TERMINATED BY '\n'",
+            mysqli_real_escape_string($link, $file),
+            $table_name))) {
+              if (1148 == mysqli_errno($link)) {
+                  mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
+                  return "Cannot test LOAD DATA LOCAL INFILE, [1148] The used command is not allowed with this MySQL version";
+              } else if ($link->errno) {
+                  return $link->error;
+              }
+        }
+        mysqli_query($link, sprintf('DROP TABLE IF EXISTS %s', $table_name));
+        return "";
+    }
+
+    function create_standard_csv($offset, $verbose = true) {
+        // create a CVS file
+        $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
+        if (!$fp = fopen($file, 'w')) {
+            if ($verbose)
+                printf("[%03d + 1] Cannot create CVS file '%s'\n", $offset, $file);
+            return NULL;
+        } else {
+            /* Looks ugly? No, handy if you have crashes... */
+            register_shutdown_function("shutdown_clean", $file);
+        }
+
+        if (!fwrite($fp, "97;'x';\n") ||
+            !fwrite($fp, "98;'y';\n") ||
+            !fwrite($fp, "99;'z';\n")) {
+            if ($verbose)
+                printf("[%03d + 3] Cannot write CVS file '%s'\n", $offset, $file);
+            return NULL;
+        }
+
+        fclose($fp);
+
+        if (!chmod($file, 0644)) {
+            if ($verbose)
+                printf("[%03d + 4] Cannot change the file perms of '%s' from 0600 to 0644, MySQL might not be able to read it\n",
+                    $offset, $file);
+            return NULL;
+        }
+        return $file;
+    }
+
+    function try_handler($offset, $link, $file, $handler, $expected = null) {
+
+        if ('default' == $handler) {
+            mysqli_set_local_infile_default($link);
+        } else if (!mysqli_set_local_infile_handler($link, $handler)) {
+            printf("[%03d] Cannot set infile handler to '%s'\n", $offset, $handler);
+            return false;
+        }
+        printf("Callback set to '%s'\n", $handler);
+
+        if (!mysqli_query($link, sprintf("DELETE FROM test"))) {
+            printf("[%03d] Cannot remove records, [%d] %s\n", $offset + 1, mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s'
+            INTO TABLE test
+            FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\''
+            LINES TERMINATED BY '\n'",
+            mysqli_real_escape_string($link, $file)))) {
+            printf("[%03d] LOAD DATA failed, [%d] %s\n",
+                $offset + 2,
+                mysqli_errno($link), mysqli_error($link));
+        }
+
+        if (!$res = mysqli_query($link, "SELECT id, label FROM test ORDER BY id")) {
+            printf("[%03d] [%d] %s\n", $offset + 3, mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        if (!is_array($expected))
+            return true;
+
+        foreach ($expected as $k => $values) {
+            if (!$tmp = mysqli_fetch_assoc($res)) {
+                printf("[%03d/%d] [%d] '%s'\n", $offset + 4, $k, mysqli_errno($link), mysqli_error($link));
+                return false;
+            }
+            if ($values['id'] != $tmp['id']) {
+                printf("[%03d/%d] Expecting %s got %s\n",
+                    $offset + 5, $k,
+                    $values['id'], $tmp['id']);
+                    return false;
+            }
+            if ($values['label'] != $tmp['label']) {
+                printf("[%03d/%d] Expecting %s got %s\n",
+                    $offset + 6, $k,
+                    $values['label'], $tmp['label']);
+                    return false;
+            }
+        }
+
+        if ($res && $tmp = mysqli_fetch_assoc($res)) {
+            printf("[%03d] More results than expected!\n", $offset + 7);
+            do {
+                var_dump($tmp);
+            } while ($tmp = mysqli_fetch_assoc($res));
+            return false;
+        }
+
+        if ($res)
+            mysqli_free_result($res);
+
+        return true;
+    }
 ?>
index 95c3bb342633a2290fd5de11bcaff40bdfd99669..7d90817769aeba8492d83ed43d9af7732f5912ad 100644 (file)
@@ -2,9 +2,9 @@
 mysqli_affected_rows()
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --FILE--
 <?php
@@ -129,7 +129,7 @@ mysqli_affected_rows()
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 7a6a5be99654bdfe752e4e5167ebdc200555d1f4..51c82de87e0725bbf4d7ab024dadd2995f263222 100644 (file)
@@ -2,9 +2,9 @@
 mysqli->affected_rows
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --FILE--
 <?php
@@ -108,7 +108,7 @@ mysqli->affected_rows
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 30d2da5675b03129574f47898f4c54ffd4cfdb5c..778e36f69c1feea4b1a5be594d09ae7b3cc86dca 100644 (file)
@@ -7,22 +7,22 @@ require_once('skipifemb.inc');
 require_once('connect.inc');
 
 if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 }
 
 if ($link->server_version < 50500)
-       die(sprintf("SKIP Needs MySQL 5.5 or newer, found MySQL %s\n", $link->server_info));
+    die(sprintf("SKIP Needs MySQL 5.5 or newer, found MySQL %s\n", $link->server_info));
 
 if (!$res = $link->query("SHOW PLUGINS"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 $have_pam = false;
 while ($row = $res->fetch_assoc()) {
-       if (isset($row['Name']) && ('mysql_clear_password' == $row['Name'])) {
-               $have_pam = true;
-               break;
-       }
+    if (isset($row['Name']) && ('mysql_clear_password' == $row['Name'])) {
+        $have_pam = true;
+        break;
+    }
 }
 $res->close();
 
@@ -34,52 +34,52 @@ mysqli_query($link, 'DROP USER pamtest');
 mysqli_query($link, 'DROP USER pamtest@localhost');
 
 if (!mysqli_query($link, 'CREATE USER pamtest@"%" IDENTIFIED WITH mysql_clear_password') ||
-       !mysqli_query($link, 'CREATE USER pamtest@"localhost" IDENTIFIED WITH mysql_clear_password')) {
-       printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
-       mysqli_close($link);
-       die("skip CREATE USER failed");
+    !mysqli_query($link, 'CREATE USER pamtest@"localhost" IDENTIFIED WITH mysql_clear_password')) {
+    printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
+    mysqli_close($link);
+    die("skip CREATE USER failed");
 }
 
 if (!$link->query("CREATE TABLE test (id INT)") || !$link->query("INSERT INTO test(id) VALUES (1)"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 
 
 if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pamtest@'%%'", $db)) ||
-       !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pamtest@'localhost'", $db))) {
-       printf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link));
-       mysqli_close($link);
-       die("skip GRANT failed");
+    !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pamtest@'localhost'", $db))) {
+    printf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link));
+    mysqli_close($link);
+    die("skip GRANT failed");
 }
 ?>
 --INI--
 max_execution_time=240
 --FILE--
 <?php
-       require_once('connect.inc');
-       require_once('table.inc');
+    require_once('connect.inc');
+    require_once('table.inc');
 
-       if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-       } else {
+    if (!$link = my_mysqli_connect($host, 'pamtest', 'pamtest', $db, $port, $socket)) {
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+    } else {
 
-         if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
-                 printf("[002] [%d] %s\n", $link->errno, $link->error);
+      if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+          printf("[002] [%d] %s\n", $link->errno, $link->error);
 
-         if (!$row = mysqli_fetch_assoc($res)) {
-                 printf("[003] [%d] %s\n", $link->errno, $link->error);
-         }
+      if (!$row = mysqli_fetch_assoc($res)) {
+          printf("[003] [%d] %s\n", $link->errno, $link->error);
+      }
 
-         if ($row['id'] != 1) {
-                 printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
-         }
+      if ($row['id'] != 1) {
+          printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+      }
 
-         $res->close();
-         $link->close();
-       }
+      $res->close();
+      $link->close();
+    }
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index ce470fce722328fef0961209003214c92d8628e4..96fd83885049572e1e72cc8dc6fa135f63dfe523 100644 (file)
@@ -2,18 +2,18 @@
 mysqli_autocommit()
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('connect.inc');
-       require_once('skipifconnectfailure.inc');
-
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               die(sprintf("skip Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket));
-       }
-
-       if (!have_innodb($link))
-               die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('connect.inc');
+    require_once('skipifconnectfailure.inc');
+
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        die(sprintf("skip Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket));
+    }
+
+    if (!have_innodb($link))
+        die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -141,7 +141,7 @@ mysqli_autocommit()
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 93ab10e605d8ac7c4f35020c86ceab731726bf76..80fd6c3039b05aed3366afabd9fb56c3b41354d4 100644 (file)
@@ -2,19 +2,19 @@
 mysqli->autocommit()
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-       require_once('connect.inc');
-
-       if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
-               printf("skip Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-               exit(1);
-       }
-
-       if (!have_innodb($link))
-               die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+    require_once('connect.inc');
+
+    if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket)) {
+        printf("skip Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+        exit(1);
+    }
+
+    if (!have_innodb($link))
+        die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -131,7 +131,7 @@ mysqli->autocommit()
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index e3c36a22867971b8198facafb11869d94ffb60b8..59c8277a5fd1f32c80b6e2c9fd6665d477834989 100644 (file)
@@ -8,10 +8,10 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -116,7 +116,7 @@ if (!have_innodb($link))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 NULL
index 4cc071d7ab6317559cf84250607662b34b8a734f..75d0930a83b0062c1c99745dbdc17720bea60e53 100644 (file)
@@ -11,87 +11,87 @@ die("skip - is the server still buggy?");
 max_execution_time=240
 --FILE--
 <?php
-       require_once('connect.inc');
-       require_once('table.inc');
+    require_once('connect.inc');
+    require_once('table.inc');
 
-       // We need this little hack to be able to re-run the test
-       $lock = 'phptest_' . mt_rand(0, 100000);
-       $thread_id = mysqli_thread_id($link);
+    // We need this little hack to be able to re-run the test
+    $lock = 'phptest_' . mt_rand(0, 100000);
+    $thread_id = mysqli_thread_id($link);
 
-       printf("Testing GET_LOCK()...\n");
+    printf("Testing GET_LOCK()...\n");
 
-       if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock)))
-               printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, sprintf('SELECT GET_LOCK("%s", 2) AS _ok', $lock)))
+        printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if ($row['_ok'] != 1)
-               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       else
-               printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id);
+    if ($row['_ok'] != 1)
+        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    else
+        printf("... lock '%s' acquired by thread %d\n", $lock, $thread_id);
 
-       mysqli_free_result($res);
+    mysqli_free_result($res);
 
 
-       // GET_LOCK("phptest") should be released
-       /* From the mysql_change_user documentation:
+    // GET_LOCK("phptest") should be released
+    /* From the mysql_change_user documentation:
 This command resets the state as if one had done a new connect. (See Section 25.2.13, “Controlling Automatic Reconnect Behavior”.) It always performs a ROLLBACK of any active transactions, closes and drops all temporary tables, and unlocks all locked tables. Session system variables are reset to the values of the corresponding global system variables. Prepared statements are released and HANDLER variables are closed. Locks acquired with GET_LOCK() are released. These effects occur even if the user didn't change.
-       */
-       mysqli_change_user($link, $user, $passwd, $db);
+    */
+    mysqli_change_user($link, $user, $passwd, $db);
 sleep(5);
-       $new_thread_id = mysqli_thread_id($link);
+    $new_thread_id = mysqli_thread_id($link);
 
-       printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
-       if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
-               printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("... calling IS_USED_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
+    if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
+        printf("[004] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if ($row['_ok'] != NULL)
-               printf("[006] Lock '%s' should have been released, [%d] %s\n",
-                       $lock,
-                       mysqli_errno($link), mysqli_error($link));
+    if ($row['_ok'] != NULL)
+        printf("[006] Lock '%s' should have been released, [%d] %s\n",
+            $lock,
+            mysqli_errno($link), mysqli_error($link));
 
-       printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
-       if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
-               printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("... calling IS_FREE_LOCK() on '%s' using thread '%d'\n", $lock, $new_thread_id);
+    if (!$res = mysqli_query($link, 'SELECT IS_FREE_LOCK("phptest") AS _ok'))
+        printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if ($row['_ok'] != 1)
-               printf("[009] Lock '%s' should have been released, [%d] %s\n",
-                       $lock,
-                       mysqli_errno($link), mysqli_error($link));
+    if ($row['_ok'] != 1)
+        printf("[009] Lock '%s' should have been released, [%d] %s\n",
+            $lock,
+            mysqli_errno($link), mysqli_error($link));
 
-       mysqli_free_result($res);
+    mysqli_free_result($res);
 
-       /* Ok, let's try a NEW connection and a NEW lock! */
-       mysqli_close($link);
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[010] Cannot open new connection, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
+    /* Ok, let's try a NEW connection and a NEW lock! */
+    mysqli_close($link);
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[010] Cannot open new connection, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
 
-       do {
-               $newlock = 'phptest_' . mt_rand(0, 100000);
-       } while ($lock == $newlock);
+    do {
+        $newlock = 'phptest_' . mt_rand(0, 100000);
+    } while ($lock == $newlock);
 
-       $new_thread_id = mysqli_thread_id($link);
-       printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id);
-       if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
-               printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    $new_thread_id = mysqli_thread_id($link);
+    printf("... calling IS_USED_LOCK() on '%s' using new connection with thread '%d'\n", $newlock, $new_thread_id);
+    if (!$res = mysqli_query($link, 'SELECT IS_USED_LOCK("phptest") AS _ok'))
+        printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if ($row['_ok'] != NULL)
-               printf("[013] Lock '%s' should have been released, [%d] %s\n",
-                       $lock,
-                       mysqli_errno($link), mysqli_error($link));
+    if ($row['_ok'] != NULL)
+        printf("[013] Lock '%s' should have been released, [%d] %s\n",
+            $lock,
+            mysqli_errno($link), mysqli_error($link));
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index d25e09b2f5be1a86609850d7987d629414920c28..960fd8dfea2eb9a87105fe83f6f5f9ec6fa5f1ac 100644 (file)
@@ -8,7 +8,7 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$IS_MYSQLND) {
-       die("skip Might hit known and open bugs http://bugs.mysql.com/bug.php?id=30472, http://bugs.mysql.com/bug.php?id=45184");
+    die("skip Might hit known and open bugs http://bugs.mysql.com/bug.php?id=30472, http://bugs.mysql.com/bug.php?id=45184");
 }
 ?>
 --FILE--
@@ -59,7 +59,7 @@ if (!$IS_MYSQLND) {
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index fa8c66f56b0dce15953b0e09a7c04cf7904651ff..a696743145052d41578484c3e96ffd163d4cf14e 100644 (file)
@@ -101,7 +101,7 @@ die("skip - is the server still buggy?");
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index e9ef937406937b1442bb575fbde4893213c0988d..47a80a288f1fc2ec4f2d178ca224c10471184ff2 100644 (file)
@@ -7,11 +7,11 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 
 if (mysqli_get_server_version($link) < 50600)
-       die("SKIP For MySQL >= 5.6.0");
+    die("SKIP For MySQL >= 5.6.0");
 ?>
 --FILE--
 <?php
index a077d9c4b62b5cf6c5dccb9b080551938fdc5926..18c5dd08afa2814dc446b958d18c47c8854baa32 100644 (file)
@@ -7,11 +7,11 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 
 if (mysqli_get_server_version($link) >= 50600)
-       die("SKIP For MySQL < 5.6.0");
+    die("SKIP For MySQL < 5.6.0");
 ?>
 --FILE--
 <?php
index 7707cca095f8a62d931d9874b90298e0cabd9937..00922a670bdd5f9e21671feea22ea5afff80041c 100644 (file)
@@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc');
 
 require_once('table.inc');
 if (!$IS_MYSQLND && (mysqli_get_server_version($link) < 50118 && mysqli_get_server_version($link) > 50100)) {
-       die("skip Your MySQL Server version has a known bug that will cause a crash");
+    die("skip Your MySQL Server version has a known bug that will cause a crash");
 }
 
 if (mysqli_get_server_version($link) >= 50600)
-       die("SKIP For MySQL < 5.6.0");
+    die("SKIP For MySQL < 5.6.0");
 ?>
 --FILE--
 <?php
index 1731abafef5cd298a1265145fbf144db78336f98..9422c4ed05c182fc317f4b4f6d01bf23a4a66d01 100644 (file)
@@ -7,10 +7,10 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -64,7 +64,7 @@ if (!have_innodb($link))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 614aa7a023743e7ae4ea204c3547dc808949179e..2c063af6330b3d88ac4af405772a80ea08fa2f08 100644 (file)
@@ -7,19 +7,19 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!$res = mysqli_query($link, 'SELECT version() AS server_version'))
-       die(sprintf("skip [%d] %s\n", mysqli_errno($link), mysqli_error($link)));
+    die(sprintf("skip [%d] %s\n", mysqli_errno($link), mysqli_error($link)));
 
 $tmp = mysqli_fetch_assoc($res);
 mysqli_free_result($res);
 $version = explode('.', $tmp['server_version']);
 if (empty($version))
-       die(sprintf("skip Cannot determine server version, we need MySQL Server 4.1+ for the test!"));
+    die(sprintf("skip Cannot determine server version, we need MySQL Server 4.1+ for the test!"));
 
 if ($version[0] <= 4 && $version[1] < 1)
-       die(sprintf("skip We need MySQL Server 4.1+ for the test!"));
+    die(sprintf("skip We need MySQL Server 4.1+ for the test!"));
 ?>
 --FILE--
 <?php
index 855141e40dd02b70ef15127f38f9457eaf8184e1..52371d78e8e6c0c00c186c9a9752e4940a29a148 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifconnectfailure.inc');
 require_once('skipifemb.inc');
 
 if (!function_exists('mysqli_set_charset')) {
-       die('skip mysqli_set_charset() not available');
+    die('skip mysqli_set_charset() not available');
 }
 ?>
 --FILE--
@@ -101,7 +101,7 @@ if (!function_exists('mysqli_set_charset')) {
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 5d303fd503dda9a3eacabbf2d0945b81ffc2ed08..562d8abefac7f1ac3cc55c80f4d49ea089590bf0 100644 (file)
@@ -2,9 +2,9 @@
 mysqli_chararcter_set_name(), mysql_client_encoding() [alias]
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --FILE--
 <?php
index 7b6c0a65d9cecbeb02a9d5b8236e3a38874c2011..3e0cd8a7c15b63a7a8accbd0e0f03d20eca688ea 100644 (file)
@@ -12,7 +12,7 @@ Most of the things which we test are covered by mysqli_class_*_interface.phpt.
 Those tests go into the details and are aimed to be a development tool, no more.
 */
 if (!$IS_MYSQLND)
-       die("skip Test has been written for the latest version of mysqlnd only");
+    die("skip Test has been written for the latest version of mysqlnd only");
 ?>
 --FILE--
 <?php
index 47beb1d79b3e526f812daaa9064b18e2c14a6b8d..149356ac05eb3d9b314bd0a3f1d64926621528ac 100644 (file)
@@ -12,7 +12,7 @@ Most of the things which we test are covered by mysqli_class_*_interface.phpt.
 Those tests go into the details and are aimed to be a development tool, no more.
 */
 if (!$IS_MYSQLND)
-       die("skip Test has been written for mysqlnd only");
+    die("skip Test has been written for mysqlnd only");
 
 ?>
 --FILE--
index b3b7759ace3008c9173f9878bc10381e575aa929..0383d704f6d126b7b0b777769749f54c8cbb1e8a 100644 (file)
@@ -13,7 +13,7 @@ Most of the things which we test are covered by mysqli_class_*_interface.phpt.
 Those tests go into the details and are aimed to be a development tool, no more.
 */
 if (!$IS_MYSQLND)
-       die("skip Test has been written for mysqlnd only");
+    die("skip Test has been written for mysqlnd only");
 ?>
 --FILE--
 <?php
index 8fc4583a4c9c1d8c4351a41db8035fa018d36c89..2adef27c3a4966a1a4197d01909eb66aad276149 100644 (file)
@@ -2,9 +2,9 @@
 Interface of the class mysqli_stmt
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 ?>
 --FILE--
 <?php
index 4d3c883e45161ab1dcb400cf51d9c5433a43736b..bdeee4903fbd7a860fb856ce1bc3643c08ce01e8 100644 (file)
@@ -8,7 +8,7 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$TEST_EXPERIMENTAL)
-       die("skip - experimental (= unsupported) feature");
+    die("skip - experimental (= unsupported) feature");
 ?>
 --FILE--
 <?php
@@ -91,7 +91,7 @@ if (!$TEST_EXPERIMENTAL)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: Wrong parameter count for mysqli_warning::mysqli_warning() in %s on line %d
index f57945e5895def3a79af4769415045a2bd608495..c2093353aaf48c743f153737705667eba1256013 100644 (file)
@@ -12,7 +12,7 @@ Most of the things which we test are covered by mysqli_class_*_interface.phpt.
 Those tests go into the details and are aimed to be a development tool, no more.
 */
 if (!$IS_MYSQLND)
-       die("skip Test has been written for mysqlnd only");
+    die("skip Test has been written for mysqlnd only");
 ?>
 --FILE--
 <?php
index 2fd3745d85fbd60ebc194921e90c4ab9957cde98..17a976f144873cac7a2873ea58e0f3be5da86601 100644 (file)
@@ -8,10 +8,10 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -71,7 +71,7 @@ if (!have_innodb($link))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 46069fd425f1f4fc9db9ed9cc092b6fd68d7690e..4b55ab3de159c8824443c18b7515e91a965e4860 100644 (file)
@@ -8,10 +8,10 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -98,7 +98,7 @@ if (!have_innodb($link))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli::commit(): Transaction name truncated. Must be only [0-9A-Za-z\-_=]+ in %s on line %d
index 96c79b1a6b7542caf157918150942ec6ec0684fb..97adfdcc5116130c2c03c46ae8a74a25708e72ab 100644 (file)
@@ -6,10 +6,10 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND)
-       die("skip: test applies only to mysqlnd");
+    die("skip: test applies only to mysqlnd");
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die("skip Cannot connect to the server");
+    die("skip Cannot connect to the server");
 
 /* skip test if the server version does not have session_connect_attrs table yet*/
 if (!$res = mysqli_query($link, "select count(*) as count from information_schema.tables where table_schema='performance_schema' and table_name='session_connect_attrs';"))
index 8204d0f1da210a4de27a765101d969a82c97a1f5..4b9d2096d085e2ce1dd22a3c43e80efc6e1d213a 100644 (file)
@@ -2,13 +2,13 @@
 new mysqli()
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-       if (!get_current_user())
-               die('skip: get_current_user() not supported');
-       if (stristr(mysqli_get_client_info(), 'mysqlnd'))
-               die("skip: test for libmysql (different error output when using php streams");
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+    if (!get_current_user())
+        die('skip: get_current_user() not supported');
+    if (stristr(mysqli_get_client_info(), 'mysqlnd'))
+        die("skip: test for libmysql (different error output when using php streams");
 ?>
 --FILE--
 <?php
index 1994a5ec963cb7cd30d4f194cb65f7ef2eb10137..b281a9c9c5dea0f81598135eb0b8a97b12753c4f 100644 (file)
@@ -10,234 +10,234 @@ require_once('skipifconnectfailure.inc');
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       require("connect.inc");
-       require("table.inc");
-
-       $php_version = (int)str_replace('.', '', PHP_VERSION);
-       $constants = get_defined_constants(true);
-       sort($constants);
-
-       $expected_constants = array(
-               'MYSQLI_READ_DEFAULT_GROUP'                     => true,
-               'MYSQLI_READ_DEFAULT_FILE'                      => true,
-               'MYSQLI_OPT_CONNECT_TIMEOUT'            => true,
-               'MYSQLI_OPT_LOCAL_INFILE'                       => true,
-               'MYSQLI_OPT_READ_TIMEOUT'                       => true,
-               'MYSQLI_INIT_COMMAND'                           => true,
-               'MYSQLI_CLIENT_SSL'                                     => true,
-               "MYSQLI_CLIENT_COMPRESS"                        => true,
-               "MYSQLI_CLIENT_INTERACTIVE"                     => true,
-               "MYSQLI_CLIENT_IGNORE_SPACE"            => true,
-               "MYSQLI_CLIENT_NO_SCHEMA"                       => true,
-               "MYSQLI_CLIENT_FOUND_ROWS"                      => true,
-               "MYSQLI_STORE_RESULT"                           => true,
-               "MYSQLI_USE_RESULT"                                     => true,
-               "MYSQLI_ASSOC"                                          => true,
-               "MYSQLI_NUM"                                            => true,
-               "MYSQLI_BOTH"                                           => true,
-               "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true,
-               "MYSQLI_NOT_NULL_FLAG"                          => true,
-               "MYSQLI_PRI_KEY_FLAG"                           => true,
-               "MYSQLI_UNIQUE_KEY_FLAG"                        => true,
-               "MYSQLI_MULTIPLE_KEY_FLAG"                      => true,
-               "MYSQLI_BLOB_FLAG"                                      => true,
-               "MYSQLI_UNSIGNED_FLAG"                          => true,
-               "MYSQLI_ZEROFILL_FLAG"                          => true,
-               "MYSQLI_AUTO_INCREMENT_FLAG"            => true,
-               "MYSQLI_TIMESTAMP_FLAG"                         => true,
-               "MYSQLI_SET_FLAG"                                       => true,
-               "MYSQLI_NUM_FLAG"                                       => true,
-               "MYSQLI_ENUM_FLAG"                                      => true,
-               "MYSQLI_BINARY_FLAG"                            => true,
-               "MYSQLI_PART_KEY_FLAG"                          => true,
-               "MYSQLI_GROUP_FLAG"                                     => true,
-               "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true,
-               "MYSQLI_SERVER_QUERY_NO_INDEX_USED"     => true,
-
-               "MYSQLI_TYPE_DECIMAL"                           => true,
-               "MYSQLI_TYPE_TINY"                                      => true,
-               "MYSQLI_TYPE_SHORT"                                     => true,
-               "MYSQLI_TYPE_LONG"                                      => true,
-               "MYSQLI_TYPE_FLOAT"                                     => true,
-               "MYSQLI_TYPE_DOUBLE"                            => true,
-               "MYSQLI_TYPE_NULL"                                      => true,
-               "MYSQLI_TYPE_TIMESTAMP"                         => true,
-               "MYSQLI_TYPE_LONGLONG"                          => true,
-               "MYSQLI_TYPE_INT24"                                     => true,
-               "MYSQLI_TYPE_DATE"                                      => true,
-               "MYSQLI_TYPE_TIME"                                      => true,
-               "MYSQLI_TYPE_DATETIME"                          => true,
-               "MYSQLI_TYPE_YEAR"                                      => true,
-               "MYSQLI_TYPE_NEWDATE"                           => true,
-               "MYSQLI_TYPE_ENUM"                                      => true,
-               "MYSQLI_TYPE_SET"                                       => true,
-               "MYSQLI_TYPE_TINY_BLOB"                         => true,
-               "MYSQLI_TYPE_MEDIUM_BLOB"                       => true,
-               "MYSQLI_TYPE_LONG_BLOB"                         => true,
-               "MYSQLI_TYPE_BLOB"                                      => true,
-               "MYSQLI_TYPE_VAR_STRING"                        => true,
-               "MYSQLI_TYPE_STRING"                            => true,
-               "MYSQLI_TYPE_CHAR"                                      => true,
-               "MYSQLI_TYPE_INTERVAL"                          => true,
-               "MYSQLI_TYPE_GEOMETRY"                          => true,
-               "MYSQLI_NO_DATA"                                        => true,
-               "MYSQLI_REPORT_INDEX"                           => true,
-               "MYSQLI_REPORT_STRICT"                          => true,
-               "MYSQLI_REPORT_ALL"                                     => true,
-               "MYSQLI_REPORT_ERROR"                           => true,
-               "MYSQLI_REPORT_OFF"                                     => true,
-               "MYSQLI_SET_CHARSET_NAME"                       => true,
-               "MYSQLI_SET_CHARSET_DIR"                        => true,
-               "MYSQLI_REFRESH_GRANT"                          => true,
-               "MYSQLI_REFRESH_LOG"                            => true,
-               "MYSQLI_REFRESH_TABLES"                         => true,
-               "MYSQLI_REFRESH_HOSTS"                          => true,
-               "MYSQLI_REFRESH_STATUS"                         => true,
-               "MYSQLI_REFRESH_THREADS"                        => true,
-               "MYSQLI_REFRESH_SLAVE"                          => true,
-               "MYSQLI_REFRESH_MASTER"                         => true,
-               "MYSQLI_DEBUG_TRACE_ENABLED"            => true,
-               "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true,
-               "MYSQLI_TRANS_START_READ_WRITE"         => true,
-               "MYSQLI_TRANS_START_READ_ONLY"          => true,
-               "MYSQLI_TRANS_COR_AND_CHAIN"            => true,
-               "MYSQLI_TRANS_COR_AND_NO_CHAIN"         => true,
-               "MYSQLI_TRANS_COR_RELEASE"                      => true,
-               "MYSQLI_TRANS_COR_NO_RELEASE"           => true,
-       );
-
-       /* depends on the build - experimental */
-       if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
-               $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true;
-       }
-
-       if ($IS_MYSQLND && defined('MYSQLI_STORE_RESULT_COPY_DATA')) {
-               $expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true;
-       }
-
-       if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) {
-               $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true;
-       }
-
-       if ($IS_MYSQLND) {
-               $version = 50007 + 1;
-               $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true;
-               $expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true;
-               $expected_constants['MYSQLI_ASYNC'] = true;
-
-               $expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true;
-       } else {
-               $version = mysqli_get_client_version();
-       }
-
-       if (($version > 51122 && $version < 60000) || ($version > 60003) || $IS_MYSQLND) {
-               $expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true;
-       }
-
-       /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
-       if ($version >= 50500 || $IS_MYSQLND) {
-               $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true;
-       }
-
-       if ($version >= 50033 || $IS_MYSQLND) {
-               $expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true;
-       }
-       if ($IS_MYSQLND) {
-               $expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true;
-       }
-
-       /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
-       if ($version >= 50606 || $IS_MYSQLND) {
-               $expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true;
-       }
-
-       if ($version > 50002) {
-               $expected_constants = array_merge($expected_constants, array(
-                       "MYSQLI_TYPE_NEWDECIMAL"        => true,
-                       "MYSQLI_TYPE_BIT"                       => true,
-               ));
-       }
-
-       if ($version > 50002 || $IS_MYSQLND) {
-               $expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true;
-       }
-
-       if ($version > 50003) {
-               $expected_constants = array_merge($expected_constants, array(
-                       "MYSQLI_STMT_ATTR_CURSOR_TYPE"          => true,
-                       "MYSQLI_CURSOR_TYPE_NO_CURSOR"          => true,
-                       "MYSQLI_CURSOR_TYPE_READ_ONLY"          => true,
-                       "MYSQLI_CURSOR_TYPE_FOR_UPDATE"         => true,
-                       "MYSQLI_CURSOR_TYPE_SCROLLABLE"         => true,
-               ));
-       }
-
-       if ($version > 50007) {
-               $expected_constants = array_merge($expected_constants, array(
-                       "MYSQLI_STMT_ATTR_PREFETCH_ROWS"        => true,
-               ));
-       }
-
-       if ($version > 50110 || $IS_MYSQLND) {
-               $expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true;
-       }
-
-       /* pretty dump test, but that is the best way to mimic mysql.c */
-       if (defined('MYSQLI_DATA_TRUNCATED'))
-               $expected_constants["MYSQLI_DATA_TRUNCATED"] = true;
-
-       if (defined('MYSQLI_SERVER_PS_OUT_PARAMS'))
-               $expected_constants["MYSQLI_SERVER_PS_OUT_PARAMS"] = true;
-
-       if (!$IS_MYSQLND) {
-               /* libmysql only */
-
-               /* are they available in all versions of ext/mysqli ?
-               ... no we must have removed them at some point - for BC, weakening the test
-               */
-               if (defined("MYSQLI_RPL_MASTER")) {
-                       $expected_constants["MYSQLI_RPL_MASTER"]        = true;
-                       $expected_constants["MYSQLI_RPL_SLAVE"]         = true;
-                       $expected_constants["MYSQLI_RPL_ADMIN"]         = true;
-               }
-       }
-
-       if ($IS_MYSQLND || (!$IS_MYSQLND && ($version > 50610))) {
-               /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */
-               $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
-               $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
-       }
-
-       if ($IS_MYSQLND) {
-               $expected_constants["MYSQLI_TYPE_JSON"] = true;
-       }
-
-       $unexpected_constants = array();
-
-       foreach ($constants as $group => $consts) {
-               foreach ($consts as $name => $value) {
-                       if (stristr($name, 'mysqli')) {
-                               $name = strtoupper($name);
-                               if (isset($expected_constants[$name])) {
-                                       unset($expected_constants[$name]);
-                               } else {
-                                       $unexpected_constants[$name] = $name;
-                               }
-                       }
-               }
-       }
-
-       if (!empty($unexpected_constants)) {
-               printf("Dumping list of unexpected constants\n");
-               var_dump($unexpected_constants);
-       }
-
-       if (!empty($expected_constants)) {
-               printf("Dumping list of missing constants\n");
-               var_dump($expected_constants);
-       }
-
-       print "done!";
+    require("connect.inc");
+    require("table.inc");
+
+    $php_version = (int)str_replace('.', '', PHP_VERSION);
+    $constants = get_defined_constants(true);
+    sort($constants);
+
+    $expected_constants = array(
+        'MYSQLI_READ_DEFAULT_GROUP'                    => true,
+        'MYSQLI_READ_DEFAULT_FILE'                     => true,
+        'MYSQLI_OPT_CONNECT_TIMEOUT'           => true,
+        'MYSQLI_OPT_LOCAL_INFILE'                      => true,
+        'MYSQLI_OPT_READ_TIMEOUT'                      => true,
+        'MYSQLI_INIT_COMMAND'                          => true,
+        'MYSQLI_CLIENT_SSL'                                    => true,
+        "MYSQLI_CLIENT_COMPRESS"                       => true,
+        "MYSQLI_CLIENT_INTERACTIVE"                    => true,
+        "MYSQLI_CLIENT_IGNORE_SPACE"           => true,
+        "MYSQLI_CLIENT_NO_SCHEMA"                      => true,
+        "MYSQLI_CLIENT_FOUND_ROWS"                     => true,
+        "MYSQLI_STORE_RESULT"                          => true,
+        "MYSQLI_USE_RESULT"                                    => true,
+        "MYSQLI_ASSOC"                                         => true,
+        "MYSQLI_NUM"                                           => true,
+        "MYSQLI_BOTH"                                          => true,
+        "MYSQLI_STMT_ATTR_UPDATE_MAX_LENGTH"=> true,
+        "MYSQLI_NOT_NULL_FLAG"                         => true,
+        "MYSQLI_PRI_KEY_FLAG"                          => true,
+        "MYSQLI_UNIQUE_KEY_FLAG"                       => true,
+        "MYSQLI_MULTIPLE_KEY_FLAG"                     => true,
+        "MYSQLI_BLOB_FLAG"                                     => true,
+        "MYSQLI_UNSIGNED_FLAG"                         => true,
+        "MYSQLI_ZEROFILL_FLAG"                         => true,
+        "MYSQLI_AUTO_INCREMENT_FLAG"           => true,
+        "MYSQLI_TIMESTAMP_FLAG"                                => true,
+        "MYSQLI_SET_FLAG"                                      => true,
+        "MYSQLI_NUM_FLAG"                                      => true,
+        "MYSQLI_ENUM_FLAG"                                     => true,
+        "MYSQLI_BINARY_FLAG"                           => true,
+        "MYSQLI_PART_KEY_FLAG"                         => true,
+        "MYSQLI_GROUP_FLAG"                                    => true,
+        "MYSQLI_SERVER_QUERY_NO_GOOD_INDEX_USED"=> true,
+        "MYSQLI_SERVER_QUERY_NO_INDEX_USED"    => true,
+
+        "MYSQLI_TYPE_DECIMAL"                          => true,
+        "MYSQLI_TYPE_TINY"                                     => true,
+        "MYSQLI_TYPE_SHORT"                                    => true,
+        "MYSQLI_TYPE_LONG"                                     => true,
+        "MYSQLI_TYPE_FLOAT"                                    => true,
+        "MYSQLI_TYPE_DOUBLE"                           => true,
+        "MYSQLI_TYPE_NULL"                                     => true,
+        "MYSQLI_TYPE_TIMESTAMP"                                => true,
+        "MYSQLI_TYPE_LONGLONG"                         => true,
+        "MYSQLI_TYPE_INT24"                                    => true,
+        "MYSQLI_TYPE_DATE"                                     => true,
+        "MYSQLI_TYPE_TIME"                                     => true,
+        "MYSQLI_TYPE_DATETIME"                         => true,
+        "MYSQLI_TYPE_YEAR"                                     => true,
+        "MYSQLI_TYPE_NEWDATE"                          => true,
+        "MYSQLI_TYPE_ENUM"                                     => true,
+        "MYSQLI_TYPE_SET"                                      => true,
+        "MYSQLI_TYPE_TINY_BLOB"                                => true,
+        "MYSQLI_TYPE_MEDIUM_BLOB"                      => true,
+        "MYSQLI_TYPE_LONG_BLOB"                                => true,
+        "MYSQLI_TYPE_BLOB"                                     => true,
+        "MYSQLI_TYPE_VAR_STRING"                       => true,
+        "MYSQLI_TYPE_STRING"                           => true,
+        "MYSQLI_TYPE_CHAR"                                     => true,
+        "MYSQLI_TYPE_INTERVAL"                         => true,
+        "MYSQLI_TYPE_GEOMETRY"                         => true,
+        "MYSQLI_NO_DATA"                                       => true,
+        "MYSQLI_REPORT_INDEX"                          => true,
+        "MYSQLI_REPORT_STRICT"                         => true,
+        "MYSQLI_REPORT_ALL"                                    => true,
+        "MYSQLI_REPORT_ERROR"                          => true,
+        "MYSQLI_REPORT_OFF"                                    => true,
+        "MYSQLI_SET_CHARSET_NAME"                      => true,
+        "MYSQLI_SET_CHARSET_DIR"                       => true,
+        "MYSQLI_REFRESH_GRANT"                         => true,
+        "MYSQLI_REFRESH_LOG"                           => true,
+        "MYSQLI_REFRESH_TABLES"                                => true,
+        "MYSQLI_REFRESH_HOSTS"                         => true,
+        "MYSQLI_REFRESH_STATUS"                                => true,
+        "MYSQLI_REFRESH_THREADS"                       => true,
+        "MYSQLI_REFRESH_SLAVE"                         => true,
+        "MYSQLI_REFRESH_MASTER"                                => true,
+        "MYSQLI_DEBUG_TRACE_ENABLED"           => true,
+        "MYSQLI_TRANS_START_WITH_CONSISTENT_SNAPSHOT" => true,
+        "MYSQLI_TRANS_START_READ_WRITE"                => true,
+        "MYSQLI_TRANS_START_READ_ONLY"         => true,
+        "MYSQLI_TRANS_COR_AND_CHAIN"           => true,
+        "MYSQLI_TRANS_COR_AND_NO_CHAIN"                => true,
+        "MYSQLI_TRANS_COR_RELEASE"                     => true,
+        "MYSQLI_TRANS_COR_NO_RELEASE"          => true,
+    );
+
+    /* depends on the build - experimental */
+    if ($IS_MYSQLND && defined('MYSQLI_OPT_INT_AND_FLOAT_NATIVE')) {
+        $expected_constants['MYSQLI_OPT_INT_AND_FLOAT_NATIVE'] = true;
+    }
+
+    if ($IS_MYSQLND && defined('MYSQLI_STORE_RESULT_COPY_DATA')) {
+        $expected_constants['MYSQLI_STORE_RESULT_COPY_DATA'] = true;
+    }
+
+    if ($IS_MYSQLND || defined('MYSQLI_REFRESH_BACKUP_LOG')) {
+        $expected_constants['MYSQLI_REFRESH_BACKUP_LOG'] = true;
+    }
+
+    if ($IS_MYSQLND) {
+        $version = 50007 + 1;
+        $expected_constants['MYSQLI_OPT_NET_CMD_BUFFER_SIZE'] = true;
+        $expected_constants['MYSQLI_OPT_NET_READ_BUFFER_SIZE'] = true;
+        $expected_constants['MYSQLI_ASYNC'] = true;
+
+        $expected_constants['MYSQLI_SERVER_PS_OUT_PARAMS'] = true;
+    } else {
+        $version = mysqli_get_client_version();
+    }
+
+    if (($version > 51122 && $version < 60000) || ($version > 60003) || $IS_MYSQLND) {
+        $expected_constants['MYSQLI_ON_UPDATE_NOW_FLAG'] = true;
+    }
+
+    /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
+    if ($version >= 50500 || $IS_MYSQLND) {
+        $expected_constants['MYSQLI_SERVER_QUERY_WAS_SLOW'] = true;
+    }
+
+    if ($version >= 50033 || $IS_MYSQLND) {
+        $expected_constants['MYSQLI_CLIENT_SSL_VERIFY_SERVER_CERT'] = true;
+    }
+    if ($IS_MYSQLND) {
+        $expected_constants['MYSQLI_CLIENT_SSL_DONT_VERIFY_SERVER_CERT'] = true;
+    }
+
+    /* First introduced in MySQL 6.0, backported to MySQL 5.5 */
+    if ($version >= 50606 || $IS_MYSQLND) {
+        $expected_constants['MYSQLI_SERVER_PUBLIC_KEY'] = true;
+    }
+
+    if ($version > 50002) {
+        $expected_constants = array_merge($expected_constants, array(
+            "MYSQLI_TYPE_NEWDECIMAL"   => true,
+            "MYSQLI_TYPE_BIT"                  => true,
+        ));
+    }
+
+    if ($version > 50002 || $IS_MYSQLND) {
+        $expected_constants['MYSQLI_NO_DEFAULT_VALUE_FLAG'] = true;
+    }
+
+    if ($version > 50003) {
+        $expected_constants = array_merge($expected_constants, array(
+            "MYSQLI_STMT_ATTR_CURSOR_TYPE"             => true,
+            "MYSQLI_CURSOR_TYPE_NO_CURSOR"             => true,
+            "MYSQLI_CURSOR_TYPE_READ_ONLY"             => true,
+            "MYSQLI_CURSOR_TYPE_FOR_UPDATE"            => true,
+            "MYSQLI_CURSOR_TYPE_SCROLLABLE"            => true,
+        ));
+    }
+
+    if ($version > 50007) {
+        $expected_constants = array_merge($expected_constants, array(
+            "MYSQLI_STMT_ATTR_PREFETCH_ROWS"   => true,
+        ));
+    }
+
+    if ($version > 50110 || $IS_MYSQLND) {
+        $expected_constants['MYSQLI_OPT_SSL_VERIFY_SERVER_CERT'] = true;
+    }
+
+    /* pretty dump test, but that is the best way to mimic mysql.c */
+    if (defined('MYSQLI_DATA_TRUNCATED'))
+        $expected_constants["MYSQLI_DATA_TRUNCATED"] = true;
+
+    if (defined('MYSQLI_SERVER_PS_OUT_PARAMS'))
+        $expected_constants["MYSQLI_SERVER_PS_OUT_PARAMS"] = true;
+
+    if (!$IS_MYSQLND) {
+        /* libmysql only */
+
+        /* are they available in all versions of ext/mysqli ?
+        ... no we must have removed them at some point - for BC, weakening the test
+        */
+        if (defined("MYSQLI_RPL_MASTER")) {
+            $expected_constants["MYSQLI_RPL_MASTER"]   = true;
+            $expected_constants["MYSQLI_RPL_SLAVE"]            = true;
+            $expected_constants["MYSQLI_RPL_ADMIN"]            = true;
+        }
+    }
+
+    if ($IS_MYSQLND || (!$IS_MYSQLND && ($version > 50610))) {
+        /* could be that MySQL/libmysql 5.6.9 had the flag already but it was no stable release */
+        $expected_constants["MYSQLI_OPT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
+        $expected_constants["MYSQLI_CLIENT_CAN_HANDLE_EXPIRED_PASSWORDS"] = true;
+    }
+
+    if ($IS_MYSQLND) {
+        $expected_constants["MYSQLI_TYPE_JSON"]        = true;
+    }
+
+    $unexpected_constants = array();
+
+    foreach ($constants as $group => $consts) {
+        foreach ($consts as $name => $value) {
+            if (stristr($name, 'mysqli')) {
+                $name = strtoupper($name);
+                if (isset($expected_constants[$name])) {
+                    unset($expected_constants[$name]);
+                } else {
+                    $unexpected_constants[$name] = $name;
+                }
+            }
+        }
+    }
+
+    if (!empty($unexpected_constants)) {
+        printf("Dumping list of unexpected constants\n");
+        var_dump($unexpected_constants);
+    }
+
+    if (!empty($expected_constants)) {
+        printf("Dumping list of missing constants\n");
+        var_dump($expected_constants);
+    }
+
+    print "done!";
 ?>
 --EXPECT--
 done!
index 9bc3b12f73ef76fe34048a81c85e6d639a61de6e..656ca8545bebc95152ecceee013318a34d40e30f 100644 (file)
@@ -65,7 +65,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
index 7fb14f095667f7237f1652fd4be4cffef22519ca..1940e1557c82e6fe7d7f4ebc5936ecb517d2c3c1 100644 (file)
@@ -74,7 +74,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_result::data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
index aa455d7f6ec37a8d19a0ae79663afc26a50a0e17..e405e3d8c7da25b7828f921dd9370821f4cb118f 100644 (file)
@@ -7,13 +7,13 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_debug'))
-       die("skip: mysqli_debug() not available");
+    die("skip: mysqli_debug() not available");
 
 if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
-       die("skip: can't say for sure if mysqli_debug works");
+    die("skip: can't say for sure if mysqli_debug works");
 
 if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
-       die("skip: debug functionality not enabled");
+    die("skip: debug functionality not enabled");
 ?>
 --FILE--
 <?php
@@ -63,7 +63,7 @@ if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 done%s
index 8c934eabacb611a114346c2b1b2741b2acb35083..13f5d26320c46e414cef41b506d63e6f8e01cea1 100644 (file)
@@ -7,16 +7,16 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_debug'))
-       die("skip: mysqli_debug() not available");
+    die("skip: mysqli_debug() not available");
 
 if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
-       die("skip: can't say for sure if mysqli_debug works");
+    die("skip: can't say for sure if mysqli_debug works");
 
 if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
-       die("skip: debug functionality not enabled");
+    die("skip: debug functionality not enabled");
 
 if (!$IS_MYSQLND)
-       die("SKIP Libmysql feature not sufficiently spec'd in MySQL C API documentation");
+    die("SKIP Libmysql feature not sufficiently spec'd in MySQL C API documentation");
 
 if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platforms");
 ?>
@@ -89,7 +89,7 @@ if (substr(PHP_OS, 0, 3) == 'WIN') die("skip this test is not for Windows platfo
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 done%s
index 42a802d81a9906ea8795ffd1f3880d8da1630af5..8c860acef7befc49439065c079b2d76f565da853 100644 (file)
@@ -7,16 +7,16 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_debug'))
-       die("skip: mysqli_debug() not available");
+    die("skip: mysqli_debug() not available");
 
 if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
-       die("skip: can't say for sure if mysqli_debug works");
+    die("skip: can't say for sure if mysqli_debug works");
 
 if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
-       die("skip: debug functionality not enabled");
+    die("skip: debug functionality not enabled");
 
 if (!$IS_MYSQLND)
-       die("SKIP Libmysql feature not sufficiently spec'd in MySQL C API documentation");
+    die("SKIP Libmysql feature not sufficiently spec'd in MySQL C API documentation");
 ?>
 --FILE--
 <?php
index f1a37bf8821ffc48bbda0d4eb733bc7724e95dc1..8bffedd8e5f85d49a15d96463e50049581896a10 100644 (file)
@@ -7,46 +7,46 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_debug'))
-       die("skip mysqli_debug() not available");
+    die("skip mysqli_debug() not available");
 
 if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
-       die("skip: can't say for sure if mysqli_debug works");
+    die("skip: can't say for sure if mysqli_debug works");
 
 if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
-       die("skip: debug functionality not enabled");
+    die("skip: debug functionality not enabled");
 
 require_once('connect.inc');
 if (!$IS_MYSQLND)
-       die("skip needs mysqlnd");
+    die("skip needs mysqlnd");
 
 if (!$fp = @fopen('/tmp/mysqli_debug_phpt.trace', 'w'))
-       die("skip PHP cannot create a file in /tmp/mysqli_debug_phpt");
+    die("skip PHP cannot create a file in /tmp/mysqli_debug_phpt");
 else
-       fclose($fp);
+    fclose($fp);
 @unlink("/tmp/mysqli_debug_phpt.trace");
 ?>
 --INI--
 mysqlnd.debug="t:O,/tmp/mysqli_debug_phpt.trace"
 --FILE--
 <?php
-       require_once('connect.inc');
-       require_once('table.inc');
+    require_once('connect.inc');
+    require_once('table.inc');
 
-       var_dump(ini_get('mysqlnd.debug'));
+    var_dump(ini_get('mysqlnd.debug'));
 
-       $trace_file = '/tmp/mysqli_debug_phpt.trace';
-       clearstatcache();
-       if (!file_exists($trace_file))
-               printf("[003] Trace file '%s' has not been created\n", $trace_file);
-       if (filesize($trace_file) < 50)
-               printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
-                       $trace_file,
-                       filesize($trace_file));
+    $trace_file = '/tmp/mysqli_debug_phpt.trace';
+    clearstatcache();
+    if (!file_exists($trace_file))
+        printf("[003] Trace file '%s' has not been created\n", $trace_file);
+    if (filesize($trace_file) < 50)
+        printf("[004] Trace file '%s' is very small. filesize() reports only %d bytes. Please check.\n",
+            $trace_file,
+            filesize($trace_file));
 
-       mysqli_close($link);
-       unlink($trace_file);
+    mysqli_close($link);
+    unlink($trace_file);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 string(32) "t:O,/tmp/mysqli_debug_phpt.trace"
index 3aa0f7cb89969ea7ea9a8a16ff5180ef6ca0a5b6..938d7205dc3a446b57602aba59e6723878039c0b 100644 (file)
@@ -7,16 +7,16 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_debug'))
-       die("skip: mysqli_debug() not available");
+    die("skip: mysqli_debug() not available");
 
 if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
-       die("skip: can't say for sure if mysqli_debug works");
+    die("skip: can't say for sure if mysqli_debug works");
 
 if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
-       die("skip: debug functionality not enabled");
+    die("skip: debug functionality not enabled");
 
 if (!$IS_MYSQLND)
-       die("SKIP Libmysql feature not sufficiently spec'd in MySQL C API documentation");
+    die("SKIP Libmysql feature not sufficiently spec'd in MySQL C API documentation");
 ?>
 --FILE--
 <?php
@@ -223,7 +223,7 @@ if (!$IS_MYSQLND)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [083][control string 'n:O,%smysqli_debug_phpt.trace'] Trace file has not been written.
index 333aaa10c033f86b9167cc11b07cc39a312961bf..8343a99048eb27c513c6d01347964fabadc021d0 100644 (file)
@@ -8,16 +8,16 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!function_exists('mysqli_debug'))
-       die("skip mysqli_debug() not available");
+    die("skip mysqli_debug() not available");
 
 if (!defined('MYSQLI_DEBUG_TRACE_ENABLED'))
-       die("skip: can't say for sure if mysqli_debug works");
+    die("skip: can't say for sure if mysqli_debug works");
 
 if (defined('MYSQLI_DEBUG_TRACE_ENABLED') && !MYSQLI_DEBUG_TRACE_ENABLED)
-       die("skip: debug functionality not enabled");
+    die("skip: debug functionality not enabled");
 
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only test");
+    die("skip mysqlnd only test");
 ?>
 --FILE--
 <?php
@@ -126,7 +126,7 @@ if (!$IS_MYSQLND)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 268bd619cbf345462813d2f5a26770efc695bd38..5f1c1b8b17420dedb2b95d909fab043c08549cbc 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_disable_reads_from_master')) {
-       die("skip mysqli_disable_reads_from_master() not available");
+    die("skip mysqli_disable_reads_from_master() not available");
 }
 ?>
 --FILE--
@@ -40,7 +40,7 @@ if (!function_exists('mysqli_disable_reads_from_master')) {
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_disable_reads_from_master(): Couldn't fetch mysqli in %s on line %d
index 17b4b37529ade27af40580c9279b8aca44d9cf0c..88da02bdc181e1227d6ae962a6a00f89e17617ea 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_enable_reads_from_master')) {
-       die("skip function mysqli_enable_reads_from_master() not available\n");
+    die("skip function mysqli_enable_reads_from_master() not available\n");
 }
 ?>
 --FILE--
index 679e210f92fa55c363ba45ae86feff213d147641..f193add0be248cedcef4f39e4bafd3fe2391e4e1 100644 (file)
@@ -7,45 +7,45 @@ require_once('skipifemb.inc');
 require_once('connect.inc');
 
 if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 }
 
 if ($link->server_version < 50610)
-       die(sprintf("SKIP Needs MySQL 5.6.10 or newer, found MySQL %s\n", $link->server_info));
+    die(sprintf("SKIP Needs MySQL 5.6.10 or newer, found MySQL %s\n", $link->server_info));
 
 if  (!$IS_MYSQLND && (mysqli_get_client_version() < 50610)) {
-       die(sprintf("SKIP Needs libmysql 5.6.10 or newer, found  %s\n", mysqli_get_client_version()));
+    die(sprintf("SKIP Needs libmysql 5.6.10 or newer, found  %s\n", mysqli_get_client_version()));
 }
 
 mysqli_query($link, 'DROP USER expiretest');
 mysqli_query($link, 'DROP USER expiretest@localhost');
 
 if (!mysqli_query($link, 'CREATE USER expiretest@"%"') ||
-       !mysqli_query($link, 'CREATE USER expiretest@"localhost"')) {
-       printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
-       mysqli_close($link);
-       die("skip CREATE USER failed");
+    !mysqli_query($link, 'CREATE USER expiretest@"localhost"')) {
+    printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
+    mysqli_close($link);
+    die("skip CREATE USER failed");
 }
 
 if (!mysqli_query($link, 'ALTER USER expiretest@"%" PASSWORD EXPIRE') ||
-       !mysqli_query($link, 'ALTER USER expiretest@"localhost" PASSWORD EXPIRE')) {
-       printf("skip Cannot modify second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
-       mysqli_close($link);
-       die("skip ALTER USER failed");
+    !mysqli_query($link, 'ALTER USER expiretest@"localhost" PASSWORD EXPIRE')) {
+    printf("skip Cannot modify second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
+    mysqli_close($link);
+    die("skip ALTER USER failed");
 }
 
 if (!$link->query("DROP TABLE IF EXISTS test") ||
-       !$link->query("CREATE TABLE test (id INT)") || !$link->query("INSERT INTO test(id) VALUES (1)"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    !$link->query("CREATE TABLE test (id INT)") || !$link->query("INSERT INTO test(id) VALUES (1)"))
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 
 
 if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%%'", $db)) ||
-       !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'localhost'", $db))) {
-       printf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link));
-       mysqli_close($link);
-       die("skip GRANT failed");
+    !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'localhost'", $db))) {
+    printf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link));
+    mysqli_close($link);
+    die("skip GRANT failed");
 }
 ?>
 --FILE--
@@ -118,9 +118,9 @@ if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO expiretest@'%
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
-       mysqli_query($link, 'DROP USER expiretest');
-       mysqli_query($link, 'DROP USER expiretest@localhost');
+    require_once("clean_table.inc");
+    mysqli_query($link, 'DROP USER expiretest');
+    mysqli_query($link, 'DROP USER expiretest@localhost');
 ?>
 --EXPECTF--
 Warning: mysqli%sconnect(): (HY000/1862): %s in %s on line %d
index 157559b340fd6dc4d819728315e978371d8732af..a6cad184104464d34434c1e5256f97ff2834b19c 100644 (file)
@@ -157,7 +157,7 @@ if (!$IS_MYSQLND)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index f9a7ee37704d96dda7f0ac69005baf365f318a22..27116b63a6508c64e156778bfbd4ef3d1961c7cb 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_fetch_all'))
-       die("skip: function only available with mysqlnd");
+    die("skip: function only available with mysqlnd");
 ?>
 --FILE--
 <?php
@@ -323,7 +323,7 @@ if (!function_exists('mysqli_fetch_all'))
 ?>
 --CLEAN--
 <?php
-       // require_once("clean_table.inc");
+    // require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [005]
index 9dac357ae1a23bcc2de18d29b14577024478f92e..02a6e15123200eaf591a1c76d2e838af2b708992 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_fetch_all'))
-       die("skip: function only available with mysqlnd");
+    die("skip: function only available with mysqlnd");
 ?>
 --FILE--
 <?php
@@ -305,7 +305,7 @@ if (!function_exists('mysqli_fetch_all'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [005]
index 4701926d6c92f926dc7669492f36e22304480b73..fe73d780f3279dde3227ce87a114f7b5f28cea1b 100644 (file)
@@ -29,7 +29,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 [002]
index 3c6a0f03f3b9fd86cc405f90c540e9a642fe2f38..59d56691263463b49879361fb06a035dcec5fd39 100644 (file)
@@ -9,155 +9,155 @@ require_once('skipifconnectfailure.inc');
 memory_limit=-1
 --FILE--
 <?php
-       require_once("connect.inc");
-
-       function mysqli_fetch_array_large($offset, $link, $package_size) {
-
-               /* we are aiming for maximum compression to test MYSQLI_CLIENT_COMPRESS */
-               $random_char = str_repeat('a', 255);
-               $sql = "INSERT INTO test(label) VALUES ";
-
-               while (strlen($sql) < ($package_size - 259))
-                       $sql .= sprintf("('%s'), ", $random_char);
-
-               $sql = substr($sql, 0, -2);
-               $len = strlen($sql);
-               assert($len < $package_size);
-
-               if (!@mysqli_query($link, $sql)) {
-                       if (1153 == mysqli_errno($link) || 2006 == mysqli_errno($link) || stristr(mysqli_error($link), 'max_allowed_packet'))
-                               /*
-                                       myslqnd - [1153] Got a packet bigger than 'max_allowed_packet' bytes
-                                       libmysql -[2006] MySQL server has gone away
-                               */
-                               return false;
-
-                       printf("[%03d + 1] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               /* buffered result set - let's hope we do not run into PHP memory limit... */
-               if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
-                       printf("[%03d + 2] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               while ($row = mysqli_fetch_assoc($res)) {
-                       if ($row['label'] != $random_char) {
-                               printf("[%03d + 3] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
-                                       $offset, $random_char, $row['label'], $len, mysqli_errno($link), mysqli_error($link));
-                               return false;
-                       }
-               }
-               mysqli_free_result($res);
-
-               if (!$stmt = mysqli_prepare($link, "SELECT id, label FROM test")) {
-                       printf("[%03d + 4] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               /* unbuffered result set */
-               if (!mysqli_stmt_execute($stmt)) {
-                       printf("[%03d + 5] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               $id = $label = NULL;
-               if (!mysqli_stmt_bind_result($stmt, $id, $label)) {
-                       printf("[%03d + 6] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               while (mysqli_stmt_fetch($stmt)) {
-                       if ($label != $random_char) {
-                               printf("[%03d + 7] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
-                                       $offset, $random_char, $label, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                               return false;
-                       }
-               }
-
-               mysqli_stmt_free_result($stmt);
-               mysqli_stmt_close($stmt);
-
-               return true;
-       }
-
-       function parse_memory_limit($limit) {
-
-               $val = trim($limit);
-               $last = strtolower($val[strlen($val)-1]);
-
-               switch($last) {
-                               // The 'G' modifier is available since PHP 5.1.0
-                               case 'g':
-                                       $val *= 1024;
-                               case 'm':
-                                       $val *= 1024;
-                               case 'k':
-                                       $val *= 1024;
-                               default:
-                                       break;
-       }
-                       return $val;
-       }
-
-
-       function test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, $flags = null) {
-
-               $link = mysqli_init();
-               if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) {
-                       printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-                       return false;
-               }
-
-               if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
-                       !mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label VARCHAR(255)) ENGINE = %s", $engine))) {
-                       printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               $package_size = 524288;
-               $offset = 3;
-               $limit = (ini_get('memory_limit') > 0) ? parse_memory_limit(ini_get('memory_limit')) : pow(2, 32);
-
-               /* try to respect php.ini but make run time a soft limit */
-               $max_runtime = (ini_get('max_execution_time') > 0) ? ini_get('max_execution_time') : 30;
-               set_time_limit(0);
-
-               do {
-                       if ($package_size > $limit) {
-                               printf("stop: memory limit - %s vs. %s\n", $package_size, $limit);
-                               break;
-                       }
-
-                       $start = microtime(true);
-                       if (!mysqli_fetch_array_large($offset++, $link, $package_size)) {
-                               printf("stop: packet size - %d\n", $package_size);
-                               break;
-                       }
-
-                       $duration = microtime(true) - $start;
-                       $max_runtime -= $duration;
-                       if ($max_runtime < ($duration * 3)) {
-                               /* likely the next iteration will not be within max_execution_time */
-                               printf("stop: time limit - %2.2fs\n", $max_runtime);
-                               break;
-                       }
-
-                       $package_size += $package_size;
-
-               } while (true);
-
-
-               mysqli_close($link);
-               return true;
-       }
-
-
-       test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, null);
-       test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, MYSQLI_CLIENT_COMPRESS);
-       print "done!";
+    require_once("connect.inc");
+
+    function mysqli_fetch_array_large($offset, $link, $package_size) {
+
+        /* we are aiming for maximum compression to test MYSQLI_CLIENT_COMPRESS */
+        $random_char = str_repeat('a', 255);
+        $sql = "INSERT INTO test(label) VALUES ";
+
+        while (strlen($sql) < ($package_size - 259))
+            $sql .= sprintf("('%s'), ", $random_char);
+
+        $sql = substr($sql, 0, -2);
+        $len = strlen($sql);
+        assert($len < $package_size);
+
+        if (!@mysqli_query($link, $sql)) {
+            if (1153 == mysqli_errno($link) || 2006 == mysqli_errno($link) || stristr(mysqli_error($link), 'max_allowed_packet'))
+                /*
+                    myslqnd - [1153] Got a packet bigger than 'max_allowed_packet' bytes
+                    libmysql -[2006] MySQL server has gone away
+                */
+                return false;
+
+            printf("[%03d + 1] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        /* buffered result set - let's hope we do not run into PHP memory limit... */
+        if (!$res = mysqli_query($link, "SELECT id, label FROM test")) {
+            printf("[%03d + 2] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        while ($row = mysqli_fetch_assoc($res)) {
+            if ($row['label'] != $random_char) {
+                printf("[%03d + 3] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
+                    $offset, $random_char, $row['label'], $len, mysqli_errno($link), mysqli_error($link));
+                return false;
+            }
+        }
+        mysqli_free_result($res);
+
+        if (!$stmt = mysqli_prepare($link, "SELECT id, label FROM test")) {
+            printf("[%03d + 4] len = %d, [%d] %s\n", $offset, $len, mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        /* unbuffered result set */
+        if (!mysqli_stmt_execute($stmt)) {
+            printf("[%03d + 5] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        $id = $label = NULL;
+        if (!mysqli_stmt_bind_result($stmt, $id, $label)) {
+            printf("[%03d + 6] len = %d, [%d] %s, [%d] %s\n", $offset, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt), mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        while (mysqli_stmt_fetch($stmt)) {
+            if ($label != $random_char) {
+                printf("[%03d + 7] Wrong results - expecting '%s' got '%s', len = %d, [%d] %s\n",
+                    $offset, $random_char, $label, $len, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                return false;
+            }
+        }
+
+        mysqli_stmt_free_result($stmt);
+        mysqli_stmt_close($stmt);
+
+        return true;
+    }
+
+    function parse_memory_limit($limit) {
+
+        $val = trim($limit);
+        $last = strtolower($val[strlen($val)-1]);
+
+        switch($last) {
+                // The 'G' modifier is available since PHP 5.1.0
+                case 'g':
+                    $val *= 1024;
+                case 'm':
+                    $val *= 1024;
+                case 'k':
+                    $val *= 1024;
+                default:
+                    break;
+        }
+            return $val;
+    }
+
+
+    function test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, $flags = null) {
+
+        $link = mysqli_init();
+        if (!my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $flags)) {
+            printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+            return false;
+        }
+
+        if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
+            !mysqli_query($link, sprintf("CREATE TABLE test(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, label VARCHAR(255)) ENGINE = %s", $engine))) {
+            printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        $package_size = 524288;
+        $offset = 3;
+        $limit = (ini_get('memory_limit') > 0) ? parse_memory_limit(ini_get('memory_limit')) : pow(2, 32);
+
+        /* try to respect php.ini but make run time a soft limit */
+        $max_runtime = (ini_get('max_execution_time') > 0) ? ini_get('max_execution_time') : 30;
+        set_time_limit(0);
+
+        do {
+            if ($package_size > $limit) {
+                printf("stop: memory limit - %s vs. %s\n", $package_size, $limit);
+                break;
+            }
+
+            $start = microtime(true);
+            if (!mysqli_fetch_array_large($offset++, $link, $package_size)) {
+                printf("stop: packet size - %d\n", $package_size);
+                break;
+            }
+
+            $duration = microtime(true) - $start;
+            $max_runtime -= $duration;
+            if ($max_runtime < ($duration * 3)) {
+                /* likely the next iteration will not be within max_execution_time */
+                printf("stop: time limit - %2.2fs\n", $max_runtime);
+                break;
+            }
+
+            $package_size += $package_size;
+
+        } while (true);
+
+
+        mysqli_close($link);
+        return true;
+    }
+
+
+    test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, null);
+    test_fetch($host, $user, $passwd, $db, $port, $socket, $engine, MYSQLI_CLIENT_COMPRESS);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index d372ef5574119a8dfb7f41232031cd0a350f0cfa..29412521ce164d593cacd63c7ea3073af76917d7 100644 (file)
@@ -109,7 +109,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index b0e223496056ddabcd05005b6e347e83f4660366..634ee963581e5f1b19b65d730d06a7a419b2aef7 100644 (file)
@@ -278,7 +278,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [005]
index 6b98b5f51c7423fcc02e2b6740a66775701d0631..6ae91ad74a284221a4748be93d2db9e2bfed3994 100644 (file)
@@ -69,7 +69,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [005]
index 586bfb03b3cf764c36db15d70dd0f4089c91a9a4..2e45def22707bdf641f4f09a7466a47a86033862 100644 (file)
@@ -2,18 +2,18 @@
 mysqli_fetch_assoc() - BIT
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       require_once('connect.inc');
-       require_once('table.inc');
-       if (mysqli_get_server_version($link) < 50003)
-               // b'001' syntax not supported before 5.0.3
-               die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
-       if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
-               // better don't trust libmysql before 5.0.3
-               die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
+    require_once('connect.inc');
+    require_once('table.inc');
+    if (mysqli_get_server_version($link) < 50003)
+        // b'001' syntax not supported before 5.0.3
+        die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
+    if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
+        // better don't trust libmysql before 5.0.3
+        die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
 ?>
 --FILE--
 <?php
@@ -111,7 +111,7 @@ mysqli_fetch_assoc() - BIT
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index fdbf222df82f3d9a562d43d4dd69bc158db8b2c8..af535a803fc89c69006036f016d374bd221d7ed0 100644 (file)
@@ -2,36 +2,36 @@
 mysqli_fetch_assoc() - utf8
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-       require_once("connect.inc");
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+    require_once("connect.inc");
 
-       if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die("skip Cannot connect to server to check charsets");
+    if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        die("skip Cannot connect to server to check charsets");
 
-       if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'UTF8'"))
-               die("skip Cannot run SHOW CHARACTER SET to check charsets");
+    if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'UTF8'"))
+        die("skip Cannot run SHOW CHARACTER SET to check charsets");
 
-       if (!$tmp = mysqli_fetch_assoc($res))
-               die("skip Looks like UTF8 is not available on the server");
+    if (!$tmp = mysqli_fetch_assoc($res))
+        die("skip Looks like UTF8 is not available on the server");
 
-       if (strtolower($tmp['Charset']) !== 'utf8')
-               die("skip Not sure if UTF8 is available, canceling the test");
+    if (strtolower($tmp['Charset']) !== 'utf8')
+        die("skip Not sure if UTF8 is available, canceling the test");
 
-       mysqli_free_result($res);
+    mysqli_free_result($res);
 
-       if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'UCS2'"))
-               die("skip Cannot run SHOW CHARACTER SET to check charsets");
+    if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'UCS2'"))
+        die("skip Cannot run SHOW CHARACTER SET to check charsets");
 
-       if (!$tmp = mysqli_fetch_assoc($res))
-               die("skip Looks like UCS2 is not available on the server");
+    if (!$tmp = mysqli_fetch_assoc($res))
+        die("skip Looks like UCS2 is not available on the server");
 
-       if (strtolower($tmp['Charset']) !== 'ucs2')
-               die("skip Not sure if UCS2 is available, canceling the test");
+    if (strtolower($tmp['Charset']) !== 'ucs2')
+        die("skip Not sure if UCS2 is available, canceling the test");
 
-       mysqli_free_result($res);
-       mysqli_close($link);
+    mysqli_free_result($res);
+    mysqli_close($link);
 ?>
 --FILE--
 <?php
index e4f6465176f1bd676b557e947dd448e9fdc68a23..d06d6d5705d3c70199da9bbce6becd93c24d3980 100644 (file)
@@ -56,7 +56,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [005]
index 551877e8002377508184ca324142868c033368a8..e5e0fdf4d9ab2c8ef439dc6e14c5ec0dd05d7c99 100644 (file)
@@ -72,7 +72,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 684795a48ef63b97a8d58842bedcfb7b8843e17f..4c6276ddf80445b53c2f0209faeed5b22be69f6e 100644 (file)
@@ -84,7 +84,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 object(stdClass)#%d (13) {
index be883ef625440d3be54f6927c454fd6bec98126d..4ed1bef8a194f22a34a1c32d90201c41a272537c 100644 (file)
@@ -42,7 +42,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
index c240050e172ffec1ea038a6962bcbeb267735c9c..98440079d55780fb3f905359ee82efc29aec64b0 100644 (file)
@@ -51,7 +51,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_result::fetch_field_direct(): Field offset is invalid for resultset in %s on line %d
index 169c5d653f6b0af11fefb63adc76aa0035bc25b3..4eb2d007dd38edf5d1f297a036e2de487a057168 100644 (file)
@@ -8,10 +8,10 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+        die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (mysqli_get_server_version($link) < 50041)
-       die("skip: Due to many MySQL Server differences, the test requires 5.0.41+");
+    die("skip: Due to many MySQL Server differences, the test requires 5.0.41+");
 
 mysqli_close($link);
 ?>
@@ -220,7 +220,7 @@ mysqli_close($link);
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 2293c9581a8f5a5b1b99a91a2c6035ecb64da776..eb5d37922e1cdb4f2b50014942bbce9c20d76e1b 100644 (file)
@@ -67,7 +67,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 object(stdClass)#%d (13) {
index 31661bdda2bf1b53c1783868dc06c3290015449c..6b8248e02d98739671a722ed51985f920d706644 100644 (file)
@@ -120,7 +120,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index c79555c3a15d49e04a84002344aecdfada9bb4f5..8bf1f5ee1545b37ba1ab6a59b0e5ae2be5f742f0 100644 (file)
@@ -63,7 +63,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 object(stdClass)#%d (13) {
index 85921f800df68f907d637561570a104f8e2f5e46..aa7d1aaa2df31da227e9e1cc600f12f93a5ed3ba 100644 (file)
@@ -40,7 +40,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 bool(false)
index c352bea8a0b52a1395339f69e5f5af9060d6d206..ef06436c26e3781bf133dd540b75232f2740d510 100644 (file)
@@ -30,10 +30,10 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 NULL
index 09ea19161ac0610cc29a2f004e2c1114adbaccf8..b6decf9cb8b6db8aa1dbe6c56508adbf94e3906a 100644 (file)
@@ -142,7 +142,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [E_WARNING] mysqli_fetch_object() expects at least 1 parameter, 0 given in %s on line %d
index cb9f98cfa66cfe00232cee3b5802d5e8d72ce008..8967e7e4fe1657df4241eb4e9b3dfd0ce7d83cd0 100644 (file)
@@ -46,7 +46,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 No exception with PHP:
index c8e2b8508eca717e1a6b8c91e1a0d206ee9dc8d7..77db2b63406ee1418a3b64ff7488ec3b7a880c7d 100644 (file)
@@ -20,7 +20,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 %s(6) "object"
index d8c8cc70fdb6b7c10e6b5ee7f3a5cb1e057c047b..dffa2a9f2b9108e2d894e21d292ea92478aa2c1b 100644 (file)
@@ -126,7 +126,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [E_WARNING] mysqli_result::__construct(): invalid object or resource mysql%s
index 7ca1b9a132caa04cc1367ccfa1ae23c98e0a62a9..802e21421283c4ed3aadec8fbae93fc735f1e0b2 100644 (file)
@@ -39,7 +39,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [004]
index d6581c6699cd13100103b343734baf90dd093a6d..7817d70aff6b29ec443ba73b653fa6cbb541cf86 100644 (file)
@@ -49,7 +49,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 int(0)
index c34cf3f6475742a37855d551cb3ed7b8134f20dd..95100d7afb4f658b6fe7a905b6ae5bca85724b8d 100644 (file)
@@ -121,7 +121,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_field_seek(): Invalid field offset in %s on line %d
index 9885c1d9d8692fbfdaf61a40df7522c95860ffd9..4c461660cef860535cb0f677c88a227f54e926aa 100644 (file)
@@ -56,7 +56,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 int(0)
index cc4c72f561f27844f43a37dcdf80c7da08963e5f..bb9cc7adf499f3c31ad5cecb5745fee504d6b686 100644 (file)
@@ -7,17 +7,17 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('pcntl_fork'))
-       die("skip Process Control Functions not available");
+    die("skip Process Control Functions not available");
 
 if (!function_exists('posix_getpid'))
-       die("skip POSIX functions not available");
+    die("skip POSIX functions not available");
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -229,10 +229,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS messages"))
-       printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 6cd7778319fde8d32a7800becff2502ba9288beb..45957aae482c5af839f0f7ef490d260975dc3c25 100644 (file)
@@ -52,7 +52,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 a
index 537809dd707b6eb3867cb880a614b00249c16de6..5a557165821a287f7e82df0cf453fc96f2d88929 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_charset'))
-       die("skip: function not available");
+    die("skip: function not available");
 ?>
 --FILE--
 <?php
@@ -108,7 +108,7 @@ if (!function_exists('mysqli_get_charset'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_get_charset(): Couldn't fetch mysqli in %s on line %d
index f7de44b1db70c5831610dd8c12da29832500dcd1..948212a7e905b83d4e66fad850ea9d5cb6142c39 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_client_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --INI--
@@ -15,909 +15,909 @@ mysqlnd.collect_memory_statistics=1
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       /*
-       TODO
-       no_index_used - difficult to simulate because server/engine dependent
-       bad_index_used - difficult to simulate because server/engine dependent
-       flushed_normal_sets
-       flushed_ps_sets
-       explicit_close
-       implicit_close
-       disconnect_close
-       in_middle_of_command_close
-       explicit_free_result
-       implicit_free_result
-       explicit_stmt_close
-       implicit_stmt_close
-       */
-
-       function mysqli_get_client_stats_assert_eq($field, $current, $expected, &$test_counter, $desc = "") {
-
-               $test_counter++;
-               if (is_array($current) && is_array($expected)) {
-                       if ($current[$field] !== $expected[$field]) {
-                               printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
-                                       $test_counter, $desc,
-                                       $field, $expected[$field], gettype($expected[$field]),
-                                       $current[$field], gettype($current[$field]));
-                       }
-               } else if (is_array($current)) {
-                       if ($current[$field] !== $expected) {
-                               printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
-                                       $test_counter, $desc,
-                                       $field, $expected, gettype($expected),
-                                       $current[$field], gettype($current[$field]));
-                       }
-               } else {
-                       if ($current !== $expected) {
-                               printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
-                                       $test_counter, $desc,
-                                       $field, $expected, gettype($expected),
-                                       $current, gettype($current));
-                       }
-               }
-
-       }
-
-       function mysqli_get_client_stats_assert_gt($field, $current, $expected, &$test_counter, $desc = "") {
-
-               $test_counter++;
-               if (is_array($current) && is_array($expected)) {
-                       if ($current[$field] <= $expected[$field]) {
-                               printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
-                                       $test_counter, $desc,
-                                       $field, $expected[$field], gettype($expected[$field]),
-                                       $current[$field], gettype($current[$field]));
-                               }
-               } else {
-                       if ($current <= $expected) {
-                               printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
-                                       $test_counter, $desc, $field,
-                                       $expected, gettype($expected),
-                                       $current, gettype($current));
-                       }
-               }
-
-       }
-
-
-       $tmp = $link = null;
-       if (!is_null($tmp = @mysqli_get_client_stats($link)))
-               printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       require_once("connect.inc");
-
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
-
-       var_dump($info);
-
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-               exit(1);
-       }
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
-
-       if (count($info) != count($new_info)) {
-               printf("[005] Expecting the same number of entries in the arrays\n");
-               var_dump($info);
-               var_dump($new_info);
-       }
-
-       $test_counter = 6;
-
-       mysqli_get_client_stats_assert_gt('bytes_sent', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_gt('bytes_received', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_gt('packets_sent', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_gt('packets_received', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_gt('protocol_overhead_in', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_gt('protocol_overhead_out', $new_info, $info, $test_counter);
-
-       // we assume the above as tested and in the following we check only those
-       mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter);
-
-       /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_buffered_sets', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $new_info, $info, $test_counter);
-
-       mysqli_get_client_stats_assert_eq('rows_skipped_ps', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('copy_on_write_saved', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('copy_on_write_performed', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('command_buffer_too_small', $new_info, $info, $test_counter);
-       // This is not a mistake that I use string(1) "1" here! Andrey did not go for int to avoid any
-       // issues for very large numbers and 32 vs. 64bit systems
-       mysqli_get_client_stats_assert_eq('connect_success', $new_info, "1", $test_counter);
-       mysqli_get_client_stats_assert_eq('connect_failure', $new_info, $info, $test_counter);
-       mysqli_get_client_stats_assert_eq('connection_reused', $new_info, $info, $test_counter);
-
-       // No data fetched so far
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $new_info, "0", $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $new_info, "0", $test_counter);
-
-       require('table.inc');
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
-
-       // fetch stats
-       $expected = $info;
-
-       // buffered normal
-       print "Testing buffered normal...\n";
-       if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test', MYSQLI_STORE_RESULT))
-               printf("[%03d] SELECT COUNT() FROM test failed, [%d] %s\n",
-                       ++$test_counter, mysqli_errno($link), mysqli_error($link));
-
-       $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
-       $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
-       $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + 1);
-
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
-
-       mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
-
-       // real_data_* get incremented after mysqli_*fetch*()
+    /*
+    TODO
+    no_index_used - difficult to simulate because server/engine dependent
+    bad_index_used - difficult to simulate because server/engine dependent
+    flushed_normal_sets
+    flushed_ps_sets
+    explicit_close
+    implicit_close
+    disconnect_close
+    in_middle_of_command_close
+    explicit_free_result
+    implicit_free_result
+    explicit_stmt_close
+    implicit_stmt_close
+    */
+
+    function mysqli_get_client_stats_assert_eq($field, $current, $expected, &$test_counter, $desc = "") {
+
+        $test_counter++;
+        if (is_array($current) && is_array($expected)) {
+            if ($current[$field] !== $expected[$field]) {
+                printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
+                    $test_counter, $desc,
+                    $field, $expected[$field], gettype($expected[$field]),
+                    $current[$field], gettype($current[$field]));
+            }
+        } else if (is_array($current)) {
+            if ($current[$field] !== $expected) {
+                printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
+                    $test_counter, $desc,
+                    $field, $expected, gettype($expected),
+                    $current[$field], gettype($current[$field]));
+            }
+        } else {
+            if ($current !== $expected) {
+                printf("[%03d] %s Expecting %s = %s/%s, got %s/%s\n",
+                    $test_counter, $desc,
+                    $field, $expected, gettype($expected),
+                    $current, gettype($current));
+            }
+        }
+
+    }
+
+    function mysqli_get_client_stats_assert_gt($field, $current, $expected, &$test_counter, $desc = "") {
+
+        $test_counter++;
+        if (is_array($current) && is_array($expected)) {
+            if ($current[$field] <= $expected[$field]) {
+                printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
+                    $test_counter, $desc,
+                    $field, $expected[$field], gettype($expected[$field]),
+                    $current[$field], gettype($current[$field]));
+                }
+        } else {
+            if ($current <= $expected) {
+                printf("[%03d] %s Expecting %s > %s/%s, got %s/%s\n",
+                    $test_counter, $desc, $field,
+                    $expected, gettype($expected),
+                    $current, gettype($current));
+            }
+        }
+
+    }
+
+
+    $tmp = $link = null;
+    if (!is_null($tmp = @mysqli_get_client_stats($link)))
+        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    require_once("connect.inc");
+
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[002] Expecting array/any_non_empty, got %s/%s\n", gettype($info), $info);
+
+    var_dump($info);
+
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+        exit(1);
+    }
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[004] Expecting array/any_non_empty, got %s/%s\n", gettype($new_info), $new_info);
+
+    if (count($info) != count($new_info)) {
+        printf("[005] Expecting the same number of entries in the arrays\n");
+        var_dump($info);
+        var_dump($new_info);
+    }
+
+    $test_counter = 6;
+
+    mysqli_get_client_stats_assert_gt('bytes_sent', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_gt('bytes_received', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_gt('packets_sent', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_gt('packets_received', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_gt('protocol_overhead_in', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_gt('protocol_overhead_out', $new_info, $info, $test_counter);
+
+    // we assume the above as tested and in the following we check only those
+    mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, $info, $test_counter);
+
+    /* we need to skip this test in unicode - we send set names utf8 during mysql_connect */
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_buffered_sets', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $new_info, $info, $test_counter);
+
+    mysqli_get_client_stats_assert_eq('rows_skipped_ps', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('copy_on_write_saved', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('copy_on_write_performed', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('command_buffer_too_small', $new_info, $info, $test_counter);
+    // This is not a mistake that I use string(1) "1" here! Andrey did not go for int to avoid any
+    // issues for very large numbers and 32 vs. 64bit systems
+    mysqli_get_client_stats_assert_eq('connect_success', $new_info, "1", $test_counter);
+    mysqli_get_client_stats_assert_eq('connect_failure', $new_info, $info, $test_counter);
+    mysqli_get_client_stats_assert_eq('connection_reused', $new_info, $info, $test_counter);
+
+    // No data fetched so far
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $new_info, "0", $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $new_info, "0", $test_counter);
+
+    require('table.inc');
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
+
+    // fetch stats
+    $expected = $info;
+
+    // buffered normal
+    print "Testing buffered normal...\n";
+    if (!$res = mysqli_query($link, 'SELECT COUNT(*) AS _num FROM test', MYSQLI_STORE_RESULT))
+        printf("[%03d] SELECT COUNT() FROM test failed, [%d] %s\n",
+            ++$test_counter, mysqli_errno($link), mysqli_error($link));
+
+    $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
+    $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + 1);
+
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
+
+    mysqli_get_client_stats_assert_gt('bytes_sent', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_gt('bytes_received', $info, $expected, $test_counter);
+
+    // real_data_* get incremented after mysqli_*fetch*()
     mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, "0", $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
 
-       /* no change to rows_fetched_from_client_normal_buffered! */
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[%03d] fetch_assoc - SELECT COUNT() FROM test failed, [%d] %s\n",
-                       ++$test_counter, mysqli_errno($link), mysqli_error($link));
+    /* no change to rows_fetched_from_client_normal_buffered! */
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[%03d] fetch_assoc - SELECT COUNT() FROM test failed, [%d] %s\n",
+            ++$test_counter, mysqli_errno($link), mysqli_error($link));
 
-       $expected['rows_fetched_from_client_normal_buffered'] = (string)($expected['rows_fetched_from_client_normal_buffered'] + 1);
+    $expected['rows_fetched_from_client_normal_buffered'] = (string)($expected['rows_fetched_from_client_normal_buffered'] + 1);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       // fetch will increment
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+    // fetch will increment
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
 
-       $num_rows = $row['_num'];
-       mysqli_free_result($res);
+    $num_rows = $row['_num'];
+    mysqli_free_result($res);
 
-       print "Testing buffered normal... - SELECT id, label FROM test\n";
-       if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_STORE_RESULT))
-               printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
-                       ++$test_counter, mysqli_errno($link), mysqli_error($link));
+    print "Testing buffered normal... - SELECT id, label FROM test\n";
+    if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_STORE_RESULT))
+        printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
+            ++$test_counter, mysqli_errno($link), mysqli_error($link));
 
 
-       assert(mysqli_num_rows($res) == $num_rows);
+    assert(mysqli_num_rows($res) == $num_rows);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
 
-       $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
-       $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + $num_rows);
-       $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
+    $expected['rows_buffered_from_client_normal'] = (string)($expected['rows_buffered_from_client_normal'] + $num_rows);
+    $expected['buffered_sets'] = (string)($expected['buffered_sets'] + 1);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
 
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('buffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_normal', $info, $expected, $test_counter);
 
-       /* fetching none, but stats should not be affected - current implementation */
-       mysqli_free_result($res);
+    /* fetching none, but stats should not be affected - current implementation */
+    mysqli_free_result($res);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
 
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_buffered', $info, $expected, $test_counter);
 
-       print "Testing unbuffered normal...\n";
-       if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
-               printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
-                       ++$test_counter, mysqli_errno($link), mysqli_error($link));
+    print "Testing unbuffered normal...\n";
+    if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
+        printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
+            ++$test_counter, mysqli_errno($link), mysqli_error($link));
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
 
-       while ($row = mysqli_fetch_assoc($res))
-               ;
-       mysqli_free_result($res);
+    while ($row = mysqli_fetch_assoc($res))
+        ;
+    mysqli_free_result($res);
 
-       $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
-       $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows);
-       $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows);
+    $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows);
+    $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
 
-       print "Testing unbuffered normal... - SELECT id, label FROM test, not all fetched\n";
-       if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
-               printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
-                       ++$test_counter, mysqli_errno($link), mysqli_error($link));
+    print "Testing unbuffered normal... - SELECT id, label FROM test, not all fetched\n";
+    if (!$res = mysqli_query($link, 'SELECT id, label FROM test', MYSQLI_USE_RESULT))
+        printf("[%03d] SELECT id, label FROM test failed, [%d] %s\n",
+            ++$test_counter, mysqli_errno($link), mysqli_error($link));
 
-       for ($i = 0; $i < $num_rows - 1; $i++)
-               $row = mysqli_fetch_assoc($res);
+    for ($i = 0; $i < $num_rows - 1; $i++)
+        $row = mysqli_fetch_assoc($res);
 
-       $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1);
-       $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1);
-       $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + $num_rows - 1);
+    $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + $num_rows - 1);
+    $expected['unbuffered_sets'] = (string)($expected['unbuffered_sets'] + 1);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('unbuffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
 
-       print "Testing if implicit fetching and cleaning happens...\n";
-       mysqli_free_result($res);
+    print "Testing if implicit fetching and cleaning happens...\n";
+    mysqli_free_result($res);
 
-       /* last row has been implicitly cleaned from the wire by freeing the result set */
-       $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
-       $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + 1);
-       $expected['rows_skipped_normal'] = (string)($info['rows_skipped_normal'] + 1);
-       $expected['flushed_normal_sets'] = (string)($expected['flushed_normal_sets'] + 1);
+    /* last row has been implicitly cleaned from the wire by freeing the result set */
+    $expected['rows_fetched_from_server_normal'] = (string)($expected['rows_fetched_from_server_normal'] + 1);
+    $expected['rows_fetched_from_client_normal_unbuffered'] = (string)($expected['rows_fetched_from_client_normal_unbuffered'] + 1);
+    $expected['rows_skipped_normal'] = (string)($info['rows_skipped_normal'] + 1);
+    $expected['flushed_normal_sets'] = (string)($expected['flushed_normal_sets'] + 1);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_skipped_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('flushed_normal_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_normal_unbuffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_skipped_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('flushed_normal_sets', $info, $expected, $test_counter);
 
-       print "Testing buffered Prepared Statements...\n";
-       if (!$stmt = mysqli_stmt_init($link))
-               printf("[%03d] stmt_init() failed, [%d] %s\n",
-                       ++$test_counter, mysqli_errno($link), mysqli_error($link));
+    print "Testing buffered Prepared Statements...\n";
+    if (!$stmt = mysqli_stmt_init($link))
+        printf("[%03d] stmt_init() failed, [%d] %s\n",
+            ++$test_counter, mysqli_errno($link), mysqli_error($link));
 
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
-                       !mysqli_stmt_execute($stmt))
-               printf("[%03d] prepare/execute failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+            !mysqli_stmt_execute($stmt))
+        printf("[%03d] prepare/execute failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       /* by default PS is unbuffered - no change */
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+    /* by default PS is unbuffered - no change */
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
 
-       if (!mysqli_stmt_store_result($stmt))
-               printf("[%03d] store_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-       mysqli_stmt_free_result($stmt);
+    if (!mysqli_stmt_store_result($stmt))
+        printf("[%03d] store_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    mysqli_stmt_free_result($stmt);
 
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
 
-       $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
-       $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
-       $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
+    $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
+    $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
 
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
 
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, "0", $test_counter);
 
-       print "Testing buffered Prepared Statements... - fetching all\n";
+    print "Testing buffered Prepared Statements... - fetching all\n";
 
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
-                       !mysqli_stmt_execute($stmt))
-               printf("[%03d] prepare/execute failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+            !mysqli_stmt_execute($stmt))
+        printf("[%03d] prepare/execute failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       $id = $label = null;
-       if (!mysqli_stmt_bind_result($stmt, $id, $label))
-               printf("[%03d] bind_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    $id = $label = null;
+    if (!mysqli_stmt_bind_result($stmt, $id, $label))
+        printf("[%03d] bind_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       if (!mysqli_stmt_store_result($stmt))
-               printf("[%03d] store_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_store_result($stmt))
+        printf("[%03d] store_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       while (mysqli_stmt_fetch($stmt))
-               ;
+    while (mysqli_stmt_fetch($stmt))
+        ;
 
-       $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
-       $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
-       $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
-       $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
+    $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+    $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
+    $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
 
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
 
-       mysqli_stmt_free_result($stmt);
+    mysqli_stmt_free_result($stmt);
 
-       print "Testing buffered Prepared Statements... - fetching all but one\n";
+    print "Testing buffered Prepared Statements... - fetching all but one\n";
 
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
-                       !mysqli_stmt_execute($stmt))
-               printf("[%03d] prepare/execute failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+            !mysqli_stmt_execute($stmt))
+        printf("[%03d] prepare/execute failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       $id = $label = null;
-       if (!mysqli_stmt_bind_result($stmt, $id, $label))
-               printf("[%03d] bind_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    $id = $label = null;
+    if (!mysqli_stmt_bind_result($stmt, $id, $label))
+        printf("[%03d] bind_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       if (!mysqli_stmt_store_result($stmt))
-               printf("[%03d] store_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_store_result($stmt))
+        printf("[%03d] store_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       for ($i = 0; $i < $num_rows - 1; $i++)
-               mysqli_stmt_fetch($stmt);
+    for ($i = 0; $i < $num_rows - 1; $i++)
+        mysqli_stmt_fetch($stmt);
 
-       $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
-       $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows - 1);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
-       $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
-       $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
+    $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+    $expected['rows_fetched_from_client_ps_buffered'] = (string)($expected['rows_fetched_from_client_ps_buffered'] + $num_rows - 1);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['ps_buffered_sets'] = (string)($expected['ps_buffered_sets'] + 1);
+    $expected['rows_buffered_from_client_ps'] = (string)($expected['rows_buffered_from_client_ps'] + $num_rows);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_buffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_buffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
 
-       $expected['rows_skipped_ps'] = $info['rows_skipped_ps'];
-       mysqli_stmt_free_result($stmt);
+    $expected['rows_skipped_ps'] = $info['rows_skipped_ps'];
+    mysqli_stmt_free_result($stmt);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       /* buffered result set - no skipping possible! */
-       mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
+    /* buffered result set - no skipping possible! */
+    mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
 
-       print "Testing unbuffered Prepared Statements... - fetching all\n";
+    print "Testing unbuffered Prepared Statements... - fetching all\n";
 
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
-                       !mysqli_stmt_execute($stmt))
-               printf("[%03d] prepare/execute failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+            !mysqli_stmt_execute($stmt))
+        printf("[%03d] prepare/execute failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       $id = $label = null;
-       if (!mysqli_stmt_bind_result($stmt, $id, $label))
-               printf("[%03d] bind_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    $id = $label = null;
+    if (!mysqli_stmt_bind_result($stmt, $id, $label))
+        printf("[%03d] bind_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       $i = 0;
-       while (mysqli_stmt_fetch($stmt))
-               $i++;
-       assert($num_rows = $i);
+    $i = 0;
+    while (mysqli_stmt_fetch($stmt))
+        $i++;
+    assert($num_rows = $i);
 
-       $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
-       $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
-       $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
+    $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows);
+    $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
 
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
 
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
 
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
 
-       mysqli_stmt_free_result($stmt);
+    mysqli_stmt_free_result($stmt);
 
-       print "Testing unbuffered Prepared Statements... - fetching all but one\n";
+    print "Testing unbuffered Prepared Statements... - fetching all but one\n";
 
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
-                       !mysqli_stmt_execute($stmt))
-               printf("[%03d] prepare/execute failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id, label FROM test') ||
+            !mysqli_stmt_execute($stmt))
+        printf("[%03d] prepare/execute failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
 
-       $id = $label = null;
-       if (!mysqli_stmt_bind_result($stmt, $id, $label))
-               printf("[%03d] bind_result failed, [%d] %s\n",
-                       ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
-       for ($i = 0; $i < $num_rows - 1; $i++)
-               mysqli_stmt_fetch($stmt);
-
-       $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows - 1);
-       $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows - 1);
-       $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
-       $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
-
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
-
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
-
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
-
-       mysqli_stmt_free_result($stmt);
-       $expected['rows_skipped_ps'] = (string)($expected['rows_skipped_ps'] + 1);
-       $expected['flushed_ps_sets'] = (string)($expected['flushed_ps_sets'] + 1);
-       $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + 1);
-
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
-
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
-       mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('flushed_ps_sets', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
-
-       /*
-       print "Checking for normal buffered side effects...\n";
-       foreach ($info as $k => $v)
-               if ($info[$k] != $expected[$k])
-                       printf("$k - $v != %s\n", $expected[$k]);
-       */
-       print "... done with fetch statistics\n";
-
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
-
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
-       //
-       // result_set_queries statistics
-       //
-
-       if (!is_array($info = mysqli_get_client_stats()) || empty($info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($info), $info);
-
-       if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
-               printf("[%03d] SELECT failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       $rows = 0;
-       while ($row = mysqli_fetch_assoc($res))
-               $rows++;
-
-       if (0 == $rows)
-               printf("[%03d] Expecting at least one result, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       mysqli_free_result($res);
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-
-       mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, (string)($info['result_set_queries'] + 1), $test_counter);
-       $info = $new_info;
-
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
-
-       //
-       // non_result_set_queries - DDL
-       //
-
-       // CREATE TABLE, DROP TABLE
-       if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
-               printf("[%03d] DROP TABLE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!mysqli_query($link, "CREATE TABLE non_result_set_queries_test(id INT) ENGINE = " . $engine)) {
-               printf("[%03d] CREATE TABLE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-       } else {
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'CREATE/DROP TABLE');
-       }
-       $info = $new_info;
-
-       // ALERT TABLE
-       if (!mysqli_query($link, "ALTER TABLE non_result_set_queries_test ADD label CHAR(1)")) {
-               printf("[%03d] ALTER TABLE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-       } else {
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER TABLE');
-       }
-       $info = $new_info;
-
-       // CREATE INDEX, DROP INDEX
-       if (!mysqli_query($link, "CREATE INDEX idx_1 ON non_result_set_queries_test(id)")) {
-               printf("[%03d] CREATE INDEX failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-       } else {
-
-               if (!mysqli_query($link, "DROP INDEX idx_1 ON non_result_set_queries_test"))
-                       printf("[%03d] DROP INDEX failed, [%d] %s\n", ++$test_counter,
-                               mysqli_errno($link), mysqli_error($link));
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX');
-       }
-       $info = $new_info;
-
-       // RENAME TABLE
-       if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
-               printf("[%03d] Cleanup, DROP TABLE client_stats_test failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       $info = $new_info;
-
-       if (!mysqli_query($link, "RENAME TABLE non_result_set_queries_test TO client_stats_test")) {
-               printf("[%03d] RENAME TABLE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       } else {
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE');
-
-       }
-       $info = $new_info;
-
-       if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
-               printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
-               printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       // Let's see if we have privileges for CREATE DATABASE
-       mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats");
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       $info = $new_info;
-
-
-       // CREATE, ALTER, DROP DATABASE
-       if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) {
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
-               $info = $new_info;
-
-               if (!mysqli_query($link, "ALTER DATABASE DEFAULT CHARACTER SET latin1"))
-                       printf("[%03d] ALTER DATABASE failed, [%d] %s\n", ++$test_counter,
-                               mysqli_errno($link), mysqli_error($link));
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
-               $info = $new_info;
-
-               if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
-                       printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
-                               mysqli_errno($link), mysqli_error($link));
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               $info = $new_info;
-
-               if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_"))
-                       printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter,
-                               mysqli_errno($link), mysqli_error($link));
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE');
-               $info = $new_info;
-       }
-
-       // CREATE SERVER, ALTER SERVER, DROP SERVER
-       // We don't really try to use federated, we just want to see if the syntax works
-       mysqli_query($link, "DROP SERVER IF EXISTS myself");
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       $info = $new_info;
-
-       $sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')",
-               $user, $passwd, $db);
-       if (mysqli_query($link, $sql)) {
-               // server knows about it
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE SERVER');
-               $info = $new_info;
-
-               if (!mysqli_query($link, sprintf("ALTER SERVER myself OPTIONS(user '%s_')", $user)))
-                       printf("[%03d] ALTER SERVER failed, [%d] %s\n", ++$test_counter,
-                               mysqli_errno($link), mysqli_error($link));
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER SERVER');
-               $info = $new_info;
-
-               if (!mysqli_query($link, "DROP SERVER myself"))
-                       printf("[%03d] DROP SERVER failed, [%d] %s\n", ++$test_counter,
-                               mysqli_errno($link), mysqli_error($link));
-
-               if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                       printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-               mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP SERVER');
-               $info = $new_info;
-       }
-
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
-       /*
-       We don't test the NDB ones.
-       13.1. Data Definition Statements
-       13.1.3. ALTER LOGFILE GROUP Syntax
-       13.1.4. ALTER TABLESPACE Syntax
-       13.1.9. CREATE LOGFILE GROUP Syntax
-       13.1.10. CREATE TABLESPACE Syntax
-       13.1.15. DROP LOGFILE GROUP Syntax
-       13.1.16. DROP TABLESPACE Syntax
-       */
-
-       //
-       // DML
-       //
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                               ++$test_counter, gettype($new_info), $new_info);
-       $info = $new_info;
-
-       if (!mysqli_query($link, "INSERT INTO test(id) VALUES (100)"))
-               printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'INSERT');
-       $info = $new_info;
-
-       if (!mysqli_query($link, "UPDATE test SET label ='z' WHERE id = 100"))
-               printf("[%03d] UPDATE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'UPDATE');
-       $info = $new_info;
-
-       if (!mysqli_query($link, "REPLACE INTO test(id, label) VALUES (100, 'b')"))
-               printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'REPLACE');
-       $info = $new_info;
-
-       // NOTE: this will NOT update dbl_ddls counter
-       if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
-               printf("[%03d] SELECT@dml failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-       mysqli_free_result($res);
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter, 'SELECT@dml');
-       $info = $new_info;
-
-       if (!mysqli_query($link, "DELETE FROM test WHERE id = 100"))
-               printf("[%03d] DELETE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE');
-       $info = $new_info;
-
-       if (!$res = mysqli_query($link, "TRUNCATE TABLE test"))
-               printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'TRUNCATE');
-       $info = $new_info;
-
-
-       $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
-       if ($fp = fopen($file, 'w')) {
-               @fwrite($fp, '1;"a"');
-               fclose($fp);
-               chmod($file, 0644);
-               $sql = sprintf('LOAD DATA LOCAL INFILE "%s" INTO TABLE test', mysqli_real_escape_string($link, $file));
-               if (mysqli_query($link, $sql)) {
-                       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-                               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                                       ++$test_counter, gettype($new_info), $new_info);
-                       mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'LOAD DATA LOCAL');
-                       $info = $new_info;
-               }
-               unlink($file);
-       }
-
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
-       /*
-       We skip those:
-       13.2. Data Manipulation Statements
-       13.2.2. DO Syntax
-       13.2.3. HANDLER Syntax
-       13.2.5. LOAD DATA INFILE Syntax
-       */
-       mysqli_query($link, "DELETE FROM test");
-       if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b')"))
-               printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
-               printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_use_result($link)))
-               printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       while ($row = mysqli_fetch_assoc($res))
-               ;
-       mysqli_free_result($res);
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
-       $info = $new_info;
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
-               printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link)))
-               printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
-                       mysqli_errno($link), mysqli_error($link));
-
-       while ($row = mysqli_fetch_assoc($res))
-               ;
-       mysqli_free_result($res);
-       if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
-               printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
-                       ++$test_counter, gettype($new_info), $new_info);
-       mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, (string)($info['buffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
-       $info = $new_info;
-
-       mysqli_close($link);
-
-       mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
-       $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
-       mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
-
-       /*
-       no_index_used
-       bad_index_used
-       flushed_normal_sets
-       flushed_ps_sets
-       explicit_close
-       implicit_close
-       disconnect_close
-       in_middle_of_command_close
-       explicit_free_result
-       implicit_free_result
-       explicit_stmt_close
-       implicit_stmt_close
-       */
-
-       print "done!";
+    $id = $label = null;
+    if (!mysqli_stmt_bind_result($stmt, $id, $label))
+        printf("[%03d] bind_result failed, [%d] %s\n",
+            ++$test_counter, mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+    for ($i = 0; $i < $num_rows - 1; $i++)
+        mysqli_stmt_fetch($stmt);
+
+    $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + $num_rows - 1);
+    $expected['rows_fetched_from_client_ps_unbuffered'] = (string)($expected['rows_fetched_from_client_ps_unbuffered'] + $num_rows - 1);
+    $expected['result_set_queries'] = (string)($expected['result_set_queries'] + 1);
+    $expected['ps_unbuffered_sets'] = (string)($expected['ps_unbuffered_sets'] + 1);
+
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
+
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_ps', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_ps'] = $info['bytes_received_real_data_ps'];
+
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_client_ps_unbuffered', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('result_set_queries', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('ps_unbuffered_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_buffered_from_client_ps', $info, $expected, $test_counter);
+
+    mysqli_stmt_free_result($stmt);
+    $expected['rows_skipped_ps'] = (string)($expected['rows_skipped_ps'] + 1);
+    $expected['flushed_ps_sets'] = (string)($expected['flushed_ps_sets'] + 1);
+    $expected['rows_fetched_from_server_ps'] = (string)($expected['rows_fetched_from_server_ps'] + 1);
+
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
+
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+    mysqli_get_client_stats_assert_eq('rows_skipped_ps', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('flushed_ps_sets', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('rows_fetched_from_server_ps', $info, $expected, $test_counter);
+
+    /*
+    print "Checking for normal buffered side effects...\n";
+    foreach ($info as $k => $v)
+        if ($info[$k] != $expected[$k])
+            printf("$k - $v != %s\n", $expected[$k]);
+    */
+    print "... done with fetch statistics\n";
+
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
+
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+    //
+    // result_set_queries statistics
+    //
+
+    if (!is_array($info = mysqli_get_client_stats()) || empty($info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($info), $info);
+
+    if (!$res = mysqli_query($link, "SELECT id, label FROM test"))
+        printf("[%03d] SELECT failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    $rows = 0;
+    while ($row = mysqli_fetch_assoc($res))
+        $rows++;
+
+    if (0 == $rows)
+        printf("[%03d] Expecting at least one result, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    mysqli_free_result($res);
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+
+    mysqli_get_client_stats_assert_eq('result_set_queries', $new_info, (string)($info['result_set_queries'] + 1), $test_counter);
+    $info = $new_info;
+
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+
+    //
+    // non_result_set_queries - DDL
+    //
+
+    // CREATE TABLE, DROP TABLE
+    if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
+        printf("[%03d] DROP TABLE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!mysqli_query($link, "CREATE TABLE non_result_set_queries_test(id INT) ENGINE = " . $engine)) {
+        printf("[%03d] CREATE TABLE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+    } else {
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'CREATE/DROP TABLE');
+    }
+    $info = $new_info;
+
+    // ALERT TABLE
+    if (!mysqli_query($link, "ALTER TABLE non_result_set_queries_test ADD label CHAR(1)")) {
+        printf("[%03d] ALTER TABLE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+    } else {
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER TABLE');
+    }
+    $info = $new_info;
+
+    // CREATE INDEX, DROP INDEX
+    if (!mysqli_query($link, "CREATE INDEX idx_1 ON non_result_set_queries_test(id)")) {
+        printf("[%03d] CREATE INDEX failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+    } else {
+
+        if (!mysqli_query($link, "DROP INDEX idx_1 ON non_result_set_queries_test"))
+            printf("[%03d] DROP INDEX failed, [%d] %s\n", ++$test_counter,
+                mysqli_errno($link), mysqli_error($link));
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 2), $test_counter, 'DROP INDEX');
+    }
+    $info = $new_info;
+
+    // RENAME TABLE
+    if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
+        printf("[%03d] Cleanup, DROP TABLE client_stats_test failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    $info = $new_info;
+
+    if (!mysqli_query($link, "RENAME TABLE non_result_set_queries_test TO client_stats_test")) {
+        printf("[%03d] RENAME TABLE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    } else {
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'RENAME TABLE');
+
+    }
+    $info = $new_info;
+
+    if (!mysqli_query($link, "DROP TABLE IF EXISTS non_result_set_queries_test"))
+        printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!mysqli_query($link, "DROP TABLE IF EXISTS client_stats_test"))
+        printf("[%03d] Cleanup, DROP TABLE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    // Let's see if we have privileges for CREATE DATABASE
+    mysqli_query($link, "DROP DATABASE IF EXISTS mysqli_get_client_stats");
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    $info = $new_info;
+
+
+    // CREATE, ALTER, DROP DATABASE
+    if (mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats")) {
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
+        $info = $new_info;
+
+        if (!mysqli_query($link, "ALTER DATABASE DEFAULT CHARACTER SET latin1"))
+            printf("[%03d] ALTER DATABASE failed, [%d] %s\n", ++$test_counter,
+                mysqli_errno($link), mysqli_error($link));
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE DATABASE');
+        $info = $new_info;
+
+        if (!mysqli_query($link, "CREATE DATABASE mysqli_get_client_stats_"))
+            printf("[%03d] CREATE DATABASE failed, [%d] %s\n", ++$test_counter,
+                mysqli_errno($link), mysqli_error($link));
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        $info = $new_info;
+
+        if (!mysqli_query($link, "DROP DATABASE mysqli_get_client_stats_"))
+            printf("[%03d] DROP DATABASE failed, [%d] %s\n", ++$test_counter,
+                mysqli_errno($link), mysqli_error($link));
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP DATABASE');
+        $info = $new_info;
+    }
+
+    // CREATE SERVER, ALTER SERVER, DROP SERVER
+    // We don't really try to use federated, we just want to see if the syntax works
+    mysqli_query($link, "DROP SERVER IF EXISTS myself");
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    $info = $new_info;
+
+    $sql = sprintf("CREATE SERVER myself FOREIGN DATA WRAPPER mysql OPTIONS (user '%s', password '%s', database '%s')",
+        $user, $passwd, $db);
+    if (mysqli_query($link, $sql)) {
+        // server knows about it
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'CREATE SERVER');
+        $info = $new_info;
+
+        if (!mysqli_query($link, sprintf("ALTER SERVER myself OPTIONS(user '%s_')", $user)))
+            printf("[%03d] ALTER SERVER failed, [%d] %s\n", ++$test_counter,
+                mysqli_errno($link), mysqli_error($link));
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'ALTER SERVER');
+        $info = $new_info;
+
+        if (!mysqli_query($link, "DROP SERVER myself"))
+            printf("[%03d] DROP SERVER failed, [%d] %s\n", ++$test_counter,
+                mysqli_errno($link), mysqli_error($link));
+
+        if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+            printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+        mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DROP SERVER');
+        $info = $new_info;
+    }
+
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+    /*
+    We don't test the NDB ones.
+    13.1. Data Definition Statements
+    13.1.3. ALTER LOGFILE GROUP Syntax
+    13.1.4. ALTER TABLESPACE Syntax
+    13.1.9. CREATE LOGFILE GROUP Syntax
+    13.1.10. CREATE TABLESPACE Syntax
+    13.1.15. DROP LOGFILE GROUP Syntax
+    13.1.16. DROP TABLESPACE Syntax
+    */
+
+    //
+    // DML
+    //
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                ++$test_counter, gettype($new_info), $new_info);
+    $info = $new_info;
+
+    if (!mysqli_query($link, "INSERT INTO test(id) VALUES (100)"))
+        printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'INSERT');
+    $info = $new_info;
+
+    if (!mysqli_query($link, "UPDATE test SET label ='z' WHERE id = 100"))
+        printf("[%03d] UPDATE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'UPDATE');
+    $info = $new_info;
+
+    if (!mysqli_query($link, "REPLACE INTO test(id, label) VALUES (100, 'b')"))
+        printf("[%03d] INSERT failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'REPLACE');
+    $info = $new_info;
+
+    // NOTE: this will NOT update dbl_ddls counter
+    if (!$res = mysqli_query($link, "SELECT id, label FROM test WHERE id = 100"))
+        printf("[%03d] SELECT@dml failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+    mysqli_free_result($res);
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, $info, $test_counter, 'SELECT@dml');
+    $info = $new_info;
+
+    if (!mysqli_query($link, "DELETE FROM test WHERE id = 100"))
+        printf("[%03d] DELETE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'DELETE');
+    $info = $new_info;
+
+    if (!$res = mysqli_query($link, "TRUNCATE TABLE test"))
+        printf("[%03d] TRUNCATE failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'TRUNCATE');
+    $info = $new_info;
+
+
+    $file = tempnam(sys_get_temp_dir(), 'mysqli_test');
+    if ($fp = fopen($file, 'w')) {
+        @fwrite($fp, '1;"a"');
+        fclose($fp);
+        chmod($file, 0644);
+        $sql = sprintf('LOAD DATA LOCAL INFILE "%s" INTO TABLE test', mysqli_real_escape_string($link, $file));
+        if (mysqli_query($link, $sql)) {
+            if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+                printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+                    ++$test_counter, gettype($new_info), $new_info);
+            mysqli_get_client_stats_assert_eq('non_result_set_queries', $new_info, (string)($info['non_result_set_queries'] + 1), $test_counter, 'LOAD DATA LOCAL');
+            $info = $new_info;
+        }
+        unlink($file);
+    }
+
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+    /*
+    We skip those:
+    13.2. Data Manipulation Statements
+    13.2.2. DO Syntax
+    13.2.3. HANDLER Syntax
+    13.2.5. LOAD DATA INFILE Syntax
+    */
+    mysqli_query($link, "DELETE FROM test");
+    if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b')"))
+        printf("[%03d] Cannot insert new records, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+        printf("[%03d] Cannot SELECT with mysqli_real_query(), [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_use_result($link)))
+        printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    while ($row = mysqli_fetch_assoc($res))
+        ;
+    mysqli_free_result($res);
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('unbuffered_sets', $new_info, (string)($info['unbuffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
+    $info = $new_info;
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+        printf("[%03d] Cannot SELECT with mysqli_real_query() II, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link)))
+        printf("[%03d] mysqli_use_result() failed, [%d] %s\n", ++$test_counter,
+            mysqli_errno($link), mysqli_error($link));
+
+    while ($row = mysqli_fetch_assoc($res))
+        ;
+    mysqli_free_result($res);
+    if (!is_array($new_info = mysqli_get_client_stats()) || empty($new_info))
+        printf("[%03d] Expecting array/any_non_empty, got %s/%s\n",
+            ++$test_counter, gettype($new_info), $new_info);
+    mysqli_get_client_stats_assert_eq('buffered_sets', $new_info, (string)($info['buffered_sets'] + 1), $test_counter, 'mysqli_use_result()');
+    $info = $new_info;
+
+    mysqli_close($link);
+
+    mysqli_get_client_stats_assert_gt('bytes_received_real_data_normal', $info, $expected, $test_counter);
+    $expected['bytes_received_real_data_normal'] = $info['bytes_received_real_data_normal'];
+    mysqli_get_client_stats_assert_eq('bytes_received_real_data_ps', $info, $expected, $test_counter);
+
+    /*
+    no_index_used
+    bad_index_used
+    flushed_normal_sets
+    flushed_ps_sets
+    explicit_close
+    implicit_close
+    disconnect_close
+    in_middle_of_command_close
+    explicit_free_result
+    implicit_free_result
+    explicit_stmt_close
+    implicit_stmt_close
+    */
+
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 9c889caf8f0567d0de71ee5ebc02cbf95e25d7aa..b945db128f8d5716e7d82279cf6f347914ff3e87 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_client_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --INI--
@@ -14,27 +14,27 @@ mysqlnd.collect_statistics=1
 mysqlnd.collect_memory_statistics=1
 --FILE--
 <?php
-       require_once('connect.inc');
-       require_once('table.inc');
+    require_once('connect.inc');
+    require_once('table.inc');
 
-       $stats = mysqli_get_client_stats();
-       printf("BEGINNING: implicit_free_result = %d\n",        $stats['implicit_free_result']);
+    $stats = mysqli_get_client_stats();
+    printf("BEGINNING: implicit_free_result = %d\n",   $stats['implicit_free_result']);
 
-       if (!$res = mysqli_query($link, 'SELECT id FROM test'))
-               printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, 'SELECT id FROM test'))
+        printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       mysqli_free_result($res);
-       mysqli_close($link);
+    mysqli_free_result($res);
+    mysqli_close($link);
 
-       $after = mysqli_get_client_stats();
-       if ($after['implicit_free_result'] != $stats['implicit_free_result'])
-               printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n",
-                       $after['implicit_free_result'] - $stats['implicit_free_result']);
+    $after = mysqli_get_client_stats();
+    if ($after['implicit_free_result'] != $stats['implicit_free_result'])
+        printf("[002] Where is the missing mysqli_free_result() call? implicit_free_result has changed by %d.\n",
+            $after['implicit_free_result'] - $stats['implicit_free_result']);
 
-       $stats = $after;
-       printf("END: implicit_free_result = %d\n",      $stats['implicit_free_result']);
+    $stats = $after;
+    printf("END: implicit_free_result = %d\n", $stats['implicit_free_result']);
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 5d9b2aad94910df08393dd691a3fe785da2e6315..edb868054d8a4cdbf2d5a066335118bf104bd79c 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_client_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --INI--
@@ -14,31 +14,31 @@ mysqlnd.collect_statistics=0
 mysqlnd.collect_memory_statistics=0
 --FILE--
 <?php
-       $before = mysqli_get_client_stats();
-       if (!is_array($before) || empty($before)) {
-               printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
-               var_dump($before);
-       }
+    $before = mysqli_get_client_stats();
+    if (!is_array($before) || empty($before)) {
+        printf("[001] Expecting non-empty array, got %s.\n", gettype($before));
+        var_dump($before);
+    }
 
-       // connect and table inc connect to mysql and create tables
-       require_once('connect.inc');
-       require_once('table.inc');
-       $after = mysqli_get_client_stats();
+    // connect and table inc connect to mysql and create tables
+    require_once('connect.inc');
+    require_once('table.inc');
+    $after = mysqli_get_client_stats();
 
-       if ($before !== $after) {
-               printf("[002] Statistics have changed\n");
-               var_dump($before);
-               var_dump($after);
-       }
+    if ($before !== $after) {
+        printf("[002] Statistics have changed\n");
+        var_dump($before);
+        var_dump($after);
+    }
 
-       foreach ($after as $k => $v)
-               if ($v != 0) {
-                       printf("[003] Field %s should not have any other value but 0, got %s.\n",
-                               $k, $v);
-               }
+    foreach ($after as $k => $v)
+        if ($v != 0) {
+            printf("[003] Field %s should not have any other value but 0, got %s.\n",
+                $k, $v);
+        }
 
-       mysqli_close($link);
-       print "done!";
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index ea1055f806078e0ab960fabf8308305fc9f53969..214baf8f7151de5702f73538429372789c6c6e7d 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_client_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --INI--
@@ -14,80 +14,80 @@ mysqlnd.collect_statistics=1
 mysqlnd.collect_memory_statistics=1
 --FILE--
 <?php
-       require_once('connect.inc');
-       require_once('table.inc');
-
-       $stats = mysqli_get_client_stats();
-       printf("BEGINNING: rows_fetched_from_client_ps_unbuffered = %d\n",      $stats['rows_fetched_from_client_ps_unbuffered']);
-       printf("BEGINNING: rows_fetched_from_client_ps_buffered = %d\n",        $stats['rows_fetched_from_client_ps_buffered']);
-       printf("BEGINNING: rows_fetched_from_client_ps_cursor = %d\n",  $stats['rows_fetched_from_client_ps_cursor']);
-
-       if (!$stmt = mysqli_stmt_init($link))
-               printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       $id = null;
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
-                       !mysqli_stmt_execute($stmt) ||
-                       !mysqli_stmt_store_result($stmt) ||
-                       !mysqli_stmt_bind_result($stmt, $id))
-               printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
-       $num_rows = 0;
-       while (mysqli_stmt_fetch($stmt))
-               $num_rows++;
-
-       mysqli_stmt_free_result($stmt);
-
-       $after = mysqli_get_client_stats();
-
-       if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
-               printf("[003] Unbuffered rows got increased after buffered PS, expecting %d got %d.\n",
-                       $stats['rows_fetched_from_client_ps_unbuffered'],
-                       $after['rows_fetched_from_client_ps_unbuffered']);
-
-       $stats['rows_fetched_from_client_ps_buffered'] += $num_rows;
-       if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
-               printf("[005] Buffered rows should be %d got %d.\n",
-                       $stats['rows_fetched_from_client_ps_buffered'],
-                       $after['rows_fetched_from_client_ps_buffered']);
-
-       $stats = $after;
-       printf("BUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n",       $stats['rows_fetched_from_client_ps_unbuffered']);
-       printf("BUFFERED: rows_fetched_from_client_ps_buffered = %d\n", $stats['rows_fetched_from_client_ps_buffered']);
-       printf("BUFFERED: rows_fetched_from_client_ps_cursor = %d\n",   $stats['rows_fetched_from_client_ps_cursor']);
-
-       $id = null;
-       if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
-                       !mysqli_stmt_execute($stmt) ||
-                       !mysqli_stmt_bind_result($stmt, $id))
-               printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-
-       $num_rows = 0;
-       while (mysqli_stmt_fetch($stmt))
-               $num_rows++;
-
-       $after = mysqli_get_client_stats();
-       $stats['rows_fetched_from_client_ps_unbuffered'] += $num_rows;
-       if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
-               printf("[007] Unbuffered rows should be %d got %d.\n",
-                       $stats['rows_fetched_from_client_ps_unbuffered'],
-                       $after['rows_fetched_from_client_ps_unbuffered']);
-
-       if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
-               printf("[005] Buffered rows should be unchanged, expecting %d got %d.\n",
-                       $stats['rows_fetched_from_client_ps_buffered'],
-                       $after['rows_fetched_from_client_ps_buffered']);
-
-       mysqli_stmt_free_result($stmt);
-       mysqli_stmt_close($stmt);
-
-       $stats = $after;
-       printf("UNBUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n",     $stats['rows_fetched_from_client_ps_unbuffered']);
-       printf("UNBUFFERED: rows_fetched_from_client_ps_buffered = %d\n",       $stats['rows_fetched_from_client_ps_buffered']);
-       printf("UNBUFFERED: rows_fetched_from_client_ps_cursor = %d\n", $stats['rows_fetched_from_client_ps_cursor']);
-
-       mysqli_close($link);
-       print "done!";
+    require_once('connect.inc');
+    require_once('table.inc');
+
+    $stats = mysqli_get_client_stats();
+    printf("BEGINNING: rows_fetched_from_client_ps_unbuffered = %d\n", $stats['rows_fetched_from_client_ps_unbuffered']);
+    printf("BEGINNING: rows_fetched_from_client_ps_buffered = %d\n",   $stats['rows_fetched_from_client_ps_buffered']);
+    printf("BEGINNING: rows_fetched_from_client_ps_cursor = %d\n",     $stats['rows_fetched_from_client_ps_cursor']);
+
+    if (!$stmt = mysqli_stmt_init($link))
+        printf("[001] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    $id = null;
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
+            !mysqli_stmt_execute($stmt) ||
+            !mysqli_stmt_store_result($stmt) ||
+            !mysqli_stmt_bind_result($stmt, $id))
+        printf("[002] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+    $num_rows = 0;
+    while (mysqli_stmt_fetch($stmt))
+        $num_rows++;
+
+    mysqli_stmt_free_result($stmt);
+
+    $after = mysqli_get_client_stats();
+
+    if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
+        printf("[003] Unbuffered rows got increased after buffered PS, expecting %d got %d.\n",
+            $stats['rows_fetched_from_client_ps_unbuffered'],
+            $after['rows_fetched_from_client_ps_unbuffered']);
+
+    $stats['rows_fetched_from_client_ps_buffered'] += $num_rows;
+    if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
+        printf("[005] Buffered rows should be %d got %d.\n",
+            $stats['rows_fetched_from_client_ps_buffered'],
+            $after['rows_fetched_from_client_ps_buffered']);
+
+    $stats = $after;
+    printf("BUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n",  $stats['rows_fetched_from_client_ps_unbuffered']);
+    printf("BUFFERED: rows_fetched_from_client_ps_buffered = %d\n",    $stats['rows_fetched_from_client_ps_buffered']);
+    printf("BUFFERED: rows_fetched_from_client_ps_cursor = %d\n",      $stats['rows_fetched_from_client_ps_cursor']);
+
+    $id = null;
+    if (!mysqli_stmt_prepare($stmt, 'SELECT id FROM test') ||
+            !mysqli_stmt_execute($stmt) ||
+            !mysqli_stmt_bind_result($stmt, $id))
+        printf("[006] [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+
+    $num_rows = 0;
+    while (mysqli_stmt_fetch($stmt))
+        $num_rows++;
+
+    $after = mysqli_get_client_stats();
+    $stats['rows_fetched_from_client_ps_unbuffered'] += $num_rows;
+    if ($after['rows_fetched_from_client_ps_unbuffered'] != $stats['rows_fetched_from_client_ps_unbuffered'])
+        printf("[007] Unbuffered rows should be %d got %d.\n",
+            $stats['rows_fetched_from_client_ps_unbuffered'],
+            $after['rows_fetched_from_client_ps_unbuffered']);
+
+    if ($after['rows_fetched_from_client_ps_buffered'] != $stats['rows_fetched_from_client_ps_buffered'] )
+        printf("[005] Buffered rows should be unchanged, expecting %d got %d.\n",
+            $stats['rows_fetched_from_client_ps_buffered'],
+            $after['rows_fetched_from_client_ps_buffered']);
+
+    mysqli_stmt_free_result($stmt);
+    mysqli_stmt_close($stmt);
+
+    $stats = $after;
+    printf("UNBUFFERED: rows_fetched_from_client_ps_unbuffered = %d\n",        $stats['rows_fetched_from_client_ps_unbuffered']);
+    printf("UNBUFFERED: rows_fetched_from_client_ps_buffered = %d\n",  $stats['rows_fetched_from_client_ps_buffered']);
+    printf("UNBUFFERED: rows_fetched_from_client_ps_cursor = %d\n",    $stats['rows_fetched_from_client_ps_cursor']);
+
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 0358656ab550e9b828f209324776a5f5ed7b06c4..9eca46e84a13a349fe1ebdefed7e690ca06d1d52 100644 (file)
@@ -9,7 +9,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_client_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --FILE--
index 80875a44e6092fc269d2290ca524f0fcb7527ae8..be2dd150e501555ac43edeee41d8f927d48f1864 100644 (file)
@@ -9,7 +9,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_connection_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --FILE--
@@ -81,7 +81,7 @@ if (!function_exists('mysqli_get_connection_stats')) {
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index a91d84413c2a563b1cb6dd487c7f19f30b7dbb0e..4124c8c292649b81dc804f136b5c0434299f7b55 100644 (file)
@@ -9,7 +9,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_get_connection_stats')) {
-       die("skip only available with mysqlnd");
+    die("skip only available with mysqlnd");
 }
 ?>
 --FILE--
index ada57f7d9f60b5fa2cfd3c8948638372d243ce78..c48430ab35ec1bd3e3a84c351694c586e0d50cb3 100644 (file)
@@ -29,7 +29,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 3ea1b4a70d34d1719abf079a94446d2e4c2a2507..d56c35062c17f589c5909bea031ef942b0dc7a1e 100644 (file)
@@ -27,7 +27,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index b0076c1859038a1b62069a95884ada0eff720346..1e57bf2135ad9695cd4b9916eaedde43546d95e3 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$TEST_EXPERIMENTAL)
-       die("skip - experimental (= unsupported) feature");
+    die("skip - experimental (= unsupported) feature");
 ?>
 --FILE--
 <?php
index 56ee2cce051354bf2702b6fe600dfefbcf5a7d49..183775a8a0144fcf9693ea2167f8ef5379f39794 100644 (file)
@@ -10,87 +10,87 @@ require_once('skipifconnectfailure.inc');
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       if (!is_null($tmp = @mysqli_info()))
-               printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_null($tmp = @mysqli_info()))
+        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!is_null($tmp = @mysqli_info(NULL)))
-               printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_null($tmp = @mysqli_info(NULL)))
+        printf("[002] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
 
-       require "table.inc";
-       if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')"))
-               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    require "table.inc";
+    if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (100, 'a')"))
+        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       // NOTE: empty string, no multiple insert syntax
-       if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
-               printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
+    // NOTE: empty string, no multiple insert syntax
+    if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
+        printf("[004] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')"))
-               printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "INSERT INTO test(id, label) VALUES (101, 'a'), (102, 'b')"))
+        printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
-               printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+        printf("[006] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test'))
-               printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, 'INSERT INTO test(id, label) SELECT id + 200, label FROM test'))
+        printf("[007] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
-               printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+        printf("[008] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)'))
-               printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, 'ALTER TABLE test MODIFY label CHAR(2)'))
+        printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
-               printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+        printf("[010] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100"))
-               printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "UPDATE test SET label = 'b' WHERE id >= 100"))
+        printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
-               printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+        printf("[012] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$res = mysqli_query($link, "SELECT 1"))
-               printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SELECT 1"))
+        printf("[013] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
-               printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
-       mysqli_free_result($res);
+    if (!is_null($tmp = mysqli_info($link)) || ('' != $tmp))
+        printf("[014] Expecting null, got %s/%s\n", gettype($tmp), $tmp);
+    mysqli_free_result($res);
 
-       // NOTE: no LOAD DATA INFILE test
-       if ($dir = sys_get_temp_dir()) {
-               do {
-                       $file = $dir . '/' . 'mysqli_info_phpt.cvs';
-                       if (!$fp = fopen($file, 'w'))
-                               /* ignore this error */
-                               break;
+    // NOTE: no LOAD DATA INFILE test
+    if ($dir = sys_get_temp_dir()) {
+        do {
+            $file = $dir . '/' . 'mysqli_info_phpt.cvs';
+            if (!$fp = fopen($file, 'w'))
+                /* ignore this error */
+                break;
 
-                       if (!fwrite($fp, "100;'a';\n") ||
-                               !fwrite($fp, "101;'b';\n") ||
-                               !fwrite($fp, "102;'c';\n")) {
-                               @unlink($file);
-                               break;
-                       }
-                       fclose($fp);
-                       if (!mysqli_query($link, "DELETE FROM test")) {
-                               printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                               break;
-                       }
+            if (!fwrite($fp, "100;'a';\n") ||
+                !fwrite($fp, "101;'b';\n") ||
+                !fwrite($fp, "102;'c';\n")) {
+                @unlink($file);
+                break;
+            }
+            fclose($fp);
+            if (!mysqli_query($link, "DELETE FROM test")) {
+                printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+                break;
+            }
 
-                       if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) {
-                               /* ok, because we might not be allowed to do this */
-                               @unlink($file);
-                               break;
-                       }
+            if (!@mysqli_query($link, sprintf("LOAD DATA LOCAL INFILE '%s' INTO TABLE test FIELDS TERMINATED BY ';' OPTIONALLY ENCLOSED BY '\'' LINES TERMINATED BY '\n'", $file))) {
+                /* ok, because we might not be allowed to do this */
+                @unlink($file);
+                break;
+            }
 
-                       if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
-                               printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
+            if (!is_string($tmp = mysqli_info($link)) || ('' == $tmp))
+                printf("[016] Expecting string/any_non_empty, got %s/%s\n", gettype($tmp), $tmp);
 
-                       unlink($file);
-               } while (false);
-       }
+            unlink($file);
+        } while (false);
+    }
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 7d4c0e085c6b2fe248b168b559d66eddc1ed2895..5c56f3e37e3a19d840bb55841168bc42eefc774e 100644 (file)
@@ -132,7 +132,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_insert_id(): Couldn't fetch mysqli in %s on line %d
index 16797aa94b370b9ed125ad0bf34341a5c8d8a993..b3f36d4cb0ccc7e775836ddf12e4d8b8924194f3 100644 (file)
@@ -95,7 +95,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_insert_id_var"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 496e5e48feff749f47d0a9b0debcd5e0f784153d..5e9840b9104995e18d1fe2d1b7bb163cdec00d0f 100644 (file)
@@ -6,14 +6,14 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("SKIP [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("SKIP [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 
 $max_len = pow(2, 24);
 if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
-       die(sprintf("SKIP [%d] %s\n", mysqli_errno($link), mysqli_error($link)));
+    die(sprintf("SKIP [%d] %s\n", mysqli_errno($link), mysqli_error($link)));
 
 if (!mysqli_query($link, "SET NAMES 'latin1'"))
-       die(sprintf("SKIP [%d] %s\n", mysqli_errno($link), mysqli_error($link)));
+    die(sprintf("SKIP [%d] %s\n", mysqli_errno($link), mysqli_error($link)));
 
 mysqli_close($link);
 ?>
@@ -21,92 +21,92 @@ mysqli_close($link);
 memory_limit=256M
 --FILE--
 <?php
-       require('connect.inc');
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    require('connect.inc');
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
-               printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
+        printf("[002] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       mysqli_free_result($res);
+    mysqli_free_result($res);
 
-       if (0 === ($org_max_allowed_packet = (int)$row['Value']))
-               printf("[004] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+    if (0 === ($org_max_allowed_packet = (int)$row['Value']))
+        printf("[004] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
 
-       $max_len = pow(2, 24);
-       if ($org_max_allowed_packet < $max_len) {
-               if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
-                       if (1227 == mysqli_errno($link)) {
-                               /* [1227] Access denied; you need the SUPER privilege for this operation */
-                               print "done!";
-                               exit(0);
-                       } else {
-                               printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                       }
-               }
-       }
-       mysqli_close($link);
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[006] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    $max_len = pow(2, 24);
+    if ($org_max_allowed_packet < $max_len) {
+        if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
+            if (1227 == mysqli_errno($link)) {
+                /* [1227] Access denied; you need the SUPER privilege for this operation */
+                print "done!";
+                exit(0);
+            } else {
+                printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+            }
+        }
+    }
+    mysqli_close($link);
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[006] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!mysqli_query($link, "SET NAMES 'latin1'"))
-               printf("[007] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    if (!mysqli_query($link, "SET NAMES 'latin1'"))
+        printf("[007] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
-               printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SHOW GLOBAL VARIABLES LIKE 'max_allowed_packet'"))
+        printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[009] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       mysqli_free_result($res);
+    mysqli_free_result($res);
 
-       if (0 === ($max_allowed_packet = (int)$row['Value']))
-               printf("[010] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
+    if (0 === ($max_allowed_packet = (int)$row['Value']))
+        printf("[010] Cannot determine max_allowed_packet size and/or bogus max_allowed_packet setting used.\n");
 
-       $max_len = pow(2, 24);
-       if ($max_allowed_packet < $max_len) {
-               printf("[011] Failed to change max_allowed_packet");
-       }
+    $max_len = pow(2, 24);
+    if ($max_allowed_packet < $max_len) {
+        printf("[011] Failed to change max_allowed_packet");
+    }
 
-       if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
-               printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link, "CREATE TABLE test(col_blob LONGBLOB) ENGINE=" . $engine))
+        printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       $query_prefix = "INSERT INTO test(col_blob) VALUES ('";
-       $query_postfix = "')";
-       $query_len = strlen($query_prefix) + strlen($query_postfix);
-       $com_query_len = 2;
+    $query_prefix = "INSERT INTO test(col_blob) VALUES ('";
+    $query_postfix = "')";
+    $query_len = strlen($query_prefix) + strlen($query_postfix);
+    $com_query_len = 2;
 
 
-       $blob = str_repeat('a', $max_len - $com_query_len - $query_len);
-       $query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix);
+    $blob = str_repeat('a', $max_len - $com_query_len - $query_len);
+    $query = sprintf("%s%s%s", $query_prefix, $blob, $query_postfix);
 
-       if (!mysqli_query($link, $query))
-               printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link, $query))
+        printf("[013] max_allowed_packet = %d, strlen(query) = %d, [%d] %s\n", $max_allowed_packet, strlen($query), mysqli_errno($link), mysqli_error($link));
 
-       if (!$res = mysqli_query($link, "SELECT col_blob FROM test"))
-               printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SELECT col_blob FROM test"))
+        printf("[014] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!$row = mysqli_fetch_assoc($res)) {
-               printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       } else {
-               if ($row['col_blob'] != $blob) {
-                       printf("[016] Blob seems wrong, dumping data\n");
-                       var_dump(strlen($row['col_blob']));
-                       var_dump(strlen($blob));
-               }
-               mysqli_free_result($res);
-       }
+    if (!$row = mysqli_fetch_assoc($res)) {
+        printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    } else {
+        if ($row['col_blob'] != $blob) {
+            printf("[016] Blob seems wrong, dumping data\n");
+            var_dump(strlen($row['col_blob']));
+            var_dump(strlen($blob));
+        }
+        mysqli_free_result($res);
+    }
 
-       if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
-               if (1227 != mysqli_errno($link))
-                       printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
+        if (1227 != mysqli_errno($link))
+            printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 8b4e36afd47a77e92964834a144a5f255bdd5857..5e6d769cefe88f5e05b41de3ebb52db253f8101f 100644 (file)
@@ -75,7 +75,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_kill(): processid should have positive value in %s on line %d
index d966eca05e5d1a1085501b85976bf3a78de524c5..27ec3f31189eabec140fd342d0ae51a628ae4f59 100644 (file)
@@ -176,7 +176,7 @@ API vs. SQL LAST_INSERT_ID()
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 API: %d, SQL: %d
index f3469e20e6e834bb64f03b51fc34bfd7fa969119..25f7eee25d3b4530afb05916f6c0aa551132e373 100644 (file)
@@ -10,31 +10,31 @@ require_once('skipifconnectfailure.inc');
 mysqli.max_links=1
 --FILE--
 <?php
-       require_once("connect.inc");
-       require_once("table.inc");
-
-       // to make sure we have at least one working connection...
-       var_dump(mysqli_ping($link));
-       // to make sure that max_links is really set to one
-       var_dump((int)ini_get('mysqli.max_links'));
-
-       $links = array();
-       for ($i = 1; $i <= 5; $i++)
-               if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-                       printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n",
-                               $i, mysqli_connect_errno(), mysqli_connect_error(),
-                               mysqli_errno($links[$i]), mysqli_error($links[$i]));
-
-       for ($i = 1; $i <= 5; $i++) {
-               if ($res = mysqli_query($links[$i], 'SELECT id FROM test LIMIT 1')) {
-                       printf("[%03d] Can run query on link %d\n", 5 + $i, $i);
-                       mysqli_free_result($res);
-               }
-               mysqli_close($links[$i]);
-       }
-
-       mysqli_close($link);
-       print "done!";
+    require_once("connect.inc");
+    require_once("table.inc");
+
+    // to make sure we have at least one working connection...
+    var_dump(mysqli_ping($link));
+    // to make sure that max_links is really set to one
+    var_dump((int)ini_get('mysqli.max_links'));
+
+    $links = array();
+    for ($i = 1; $i <= 5; $i++)
+        if ($links[$i] = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+            printf("[%03d] One link is already open, it should not be possible to open more, [%d] %s, [%d] %s\n",
+                $i, mysqli_connect_errno(), mysqli_connect_error(),
+                mysqli_errno($links[$i]), mysqli_error($links[$i]));
+
+    for ($i = 1; $i <= 5; $i++) {
+        if ($res = mysqli_query($links[$i], 'SELECT id FROM test LIMIT 1')) {
+            printf("[%03d] Can run query on link %d\n", 5 + $i, $i);
+            mysqli_free_result($res);
+        }
+        mysqli_close($links[$i]);
+    }
+
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 7f0a1f748b09b0c87022bc341df80ed440adc568..eed4c273cbb0379a41e6ac073db4588784d8b94b 100644 (file)
@@ -65,7 +65,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [004]
index 05f564313d7572fbd226b7c71612ad64d4326c7d..8b01fbdf88aea529f8724764ffe355f0519411b2 100644 (file)
@@ -117,7 +117,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [006] 3
index 4f65f77480327193d9c7385a5200de04c6d9c5b6..ec424e44bda98bfa5679a476184082f5a6add6b3 100644 (file)
@@ -6,8 +6,8 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$IS_MYSQLND)
-       /* The libmysql read_timeout limit default is 365 * 24 * 3600 seconds. It cannot be altered through PHP API calls */
-       die("skip mysqlnd only test");
+    /* The libmysql read_timeout limit default is 365 * 24 * 3600 seconds. It cannot be altered through PHP API calls */
+    die("skip mysqlnd only test");
 ?>
 --INI--
 default_socket_timeout=60
@@ -15,18 +15,18 @@ max_execution_time=60
 mysqlnd.net_read_timeout=1
 --FILE--
 <?php
-       include ("connect.inc");
+    include ("connect.inc");
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       if (!$res = mysqli_query($link, "SELECT SLEEP(5)"))
-               printf("[002] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SELECT SLEEP(5)"))
+        printf("[002] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 [002] [2006] MySQL server has gone away
index 7b69aff6173c0b4e8fc8ba03aa9cdbdee44fb144..3bc7dd924968ddecc0d1f6e5a64326d4d0d95634 100644 (file)
@@ -7,14 +7,14 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND) {
-       die("skip: test applies only to mysqlnd");
+    die("skip: test applies only to mysqlnd");
 }
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 50011) {
-       die(sprintf('skip Needs MySQL 5.0.12+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.0.12+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --INI--
@@ -23,22 +23,22 @@ mysqlnd.net_read_timeout=12
 max_execution_time=12
 --FILE--
 <?php
-       set_time_limit(12);
-       include ("connect.inc");
+    set_time_limit(12);
+    include ("connect.inc");
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       if (!$res = mysqli_query($link, "SELECT SLEEP(6)"))
-               printf("[002] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SELECT SLEEP(6)"))
+        printf("[002] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
 
-       var_dump($res->fetch_assoc());
+    var_dump($res->fetch_assoc());
 
-       mysqli_free_result($res);
-       mysqli_close($link);
+    mysqli_free_result($res);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 array(1) {
index df273c4f14ff82ec3bb9024d2e2d5f0c8ad28f37..391ac60f944c2cf659e1ed1e0cb128bf729c54ff 100644 (file)
@@ -7,14 +7,14 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND) {
-       die("skip: test applies only to mysqlnd");
+    die("skip: test applies only to mysqlnd");
 }
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 50011) {
-       die(sprintf('skip Needs MySQL 5.0.12+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.0.12+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --INI--
@@ -23,21 +23,21 @@ max_execution_time=10
 mysqlnd.net_read_timeout=0
 --FILE--
 <?php
-       include ("connect.inc");
+    include ("connect.inc");
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
-       }
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Connect failed, [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
+    }
 
-       if (!$res = mysqli_query($link, "SELECT SLEEP(2)"))
-               printf("[002] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SELECT SLEEP(2)"))
+        printf("[002] [%d] %s\n",  mysqli_errno($link), mysqli_error($link));
 
-       var_dump($res->fetch_assoc());
+    var_dump($res->fetch_assoc());
 
-       mysqli_free_result($res);
-       mysqli_close($link);
+    mysqli_free_result($res);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 array(1) {
index 6760cbbadc596d3a8f42ad96ad8ff3da550520a6..3afa51b6b555bf49d26564e87340792f971409ed 100644 (file)
@@ -70,7 +70,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 
index 481f49eedf07a4638cf06047d5505be50c162a18..1f7ca8d834052670c658c46b9b57eadf30c3665e 100644 (file)
@@ -10,118 +10,118 @@ require_once('skipifconnectfailure.inc');
 mysqli.reconnect=0
 --FILE--
 <?php
-       require_once("connect.inc");
-       require_once("table.inc");
-
-       if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot create second database connection, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
-
-       $thread_id_timeout = mysqli_thread_id($link);
-       $thread_id_control = mysqli_thread_id($link2);
-
-       if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
-               printf("[002] Cannot get full processlist, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (!isset($running_threads[$thread_id_timeout]) ||
-                       !isset($running_threads[$thread_id_control]))
-               printf("[003] Processlist is borked, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
-               printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
-               printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[006] Cannot get wait_timeout, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-       mysqli_free_result($res);
-
-       if ($row['Value'] != 2)
-               printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       // after 2+ seconds the server should kill the connection
-       sleep(3);
-
-       if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
-               printf("[008] Cannot get full processlist, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (isset($running_threads[$thread_id_timeout]))
-               printf("[009] Server should have killed the timeout connection, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       if (false !== @mysqli_ping($link))
-               printf("[010] Reconnect should not have happened");
-
-       if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
-               printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[012] Cannot create database connection, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
-
-       $thread_id_timeout = mysqli_thread_id($link);
-       /*
-         Don't test for the mysqli_query() return value here.
-         It is undefined if the server replies to the query and how.
-         For example, it seems that on Linux when connecting to MySQL 5.1,
-         the server always manages to send a full a reply. Whereas MySQl 5.5
-         may not. The behaviour is undefined. Any return value is fine.
-       */
-       if ($IS_MYSQLND) {
-               /*
-               mysqlnd is a bit more verbose than libmysql. mysqlnd should print:
-               Warning: mysqli_query(): MySQL server has gone away in %s on line %d
-
-               Warning: mysqli_query(): Error reading result set's header in %d on line %d
-               */
-               @mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
-       } else {
-               mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
-       }
-       // Give the server a second to really kill the other thread...
-       sleep(1);
-
-       if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
-               printf("[014] Cannot get full processlist, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (isset($running_threads[$thread_id_timeout]) ||
-                       !isset($running_threads[$thread_id_control]))
-               printf("[015] Processlist is borked, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       if (false !== ($tmp = @mysqli_ping($link)))
-               printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
-
-       if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
-               printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       mysqli_close($link2);
-       print "done!";
+    require_once("connect.inc");
+    require_once("table.inc");
+
+    if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot create second database connection, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
+
+    $thread_id_timeout = mysqli_thread_id($link);
+    $thread_id_control = mysqli_thread_id($link2);
+
+    if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+        printf("[002] Cannot get full processlist, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (!isset($running_threads[$thread_id_timeout]) ||
+            !isset($running_threads[$thread_id_control]))
+        printf("[003] Processlist is borked, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
+        printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
+        printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[006] Cannot get wait_timeout, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+    mysqli_free_result($res);
+
+    if ($row['Value'] != 2)
+        printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    // after 2+ seconds the server should kill the connection
+    sleep(3);
+
+    if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+        printf("[008] Cannot get full processlist, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (isset($running_threads[$thread_id_timeout]))
+        printf("[009] Server should have killed the timeout connection, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    if (false !== @mysqli_ping($link))
+        printf("[010] Reconnect should not have happened");
+
+    if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
+        printf("[011] Executing a query should not be possible, connection should be closed, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!$link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[012] Cannot create database connection, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
+
+    $thread_id_timeout = mysqli_thread_id($link);
+    /*
+      Don't test for the mysqli_query() return value here.
+      It is undefined if the server replies to the query and how.
+      For example, it seems that on Linux when connecting to MySQL 5.1,
+      the server always manages to send a full a reply. Whereas MySQl 5.5
+      may not. The behaviour is undefined. Any return value is fine.
+    */
+    if ($IS_MYSQLND) {
+        /*
+        mysqlnd is a bit more verbose than libmysql. mysqlnd should print:
+        Warning: mysqli_query(): MySQL server has gone away in %s on line %d
+
+        Warning: mysqli_query(): Error reading result set's header in %d on line %d
+        */
+        @mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
+    } else {
+        mysqli_query($link, sprintf('KILL %d', $thread_id_timeout));
+    }
+    // Give the server a second to really kill the other thread...
+    sleep(1);
+
+    if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+        printf("[014] Cannot get full processlist, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (isset($running_threads[$thread_id_timeout]) ||
+            !isset($running_threads[$thread_id_control]))
+        printf("[015] Processlist is borked, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    if (false !== ($tmp = @mysqli_ping($link)))
+        printf("[016] Expecting boolean/false got %s/%s\n", gettype($tmp), $tmp);
+
+    if ($res = @mysqli_query($link, "SELECT DATABASE() as _dbname"))
+        printf("[017] Running a query should not be possible, connection should be gone, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    mysqli_close($link2);
+    print "done!";
 ?>
 --EXPECT--
 done!
index f891b309c2d3b7f55abab6634ccf2f82262cf96d..a37e8d1ee9b3cb4d5afeee115e8bdb04fddc964e 100644 (file)
@@ -50,7 +50,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_num_fields(): Couldn't fetch mysqli_result in %s on line %d
index c6e646e4c3e9268feb386da78f500d06a6b96318..bd12ffc83bfdd9031fbd99b82a2b3f27756f393c 100644 (file)
@@ -75,7 +75,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, bool given in %s on line %d
index 734adcf5c880e1abfcc86bbe118aa72248b69e97..dd43a42da6f7ee8d9223e16924023b310866f21b 100644 (file)
@@ -70,7 +70,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_real_connect(): (%s/%d): %s in %s on line %d
index 94acab84bb05344694dc5aa095677d4b4496c388..a4f468a9bf83770800e8d4dd51c1243d47d1a3f1 100644 (file)
@@ -8,7 +8,7 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only test");
+    die("skip mysqlnd only test");
 ?>
 --FILE--
 <?php
@@ -103,7 +103,7 @@ if (!$IS_MYSQLND)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index b263939837863b384165cbb96ccffcdbdbcb59be..c85ede53f265ef43378cf518f63d7cf57ca8e341 100644 (file)
@@ -11,43 +11,43 @@ phpinfo(INFO_MODULES);
 $tmp = ob_get_contents();
 ob_end_clean();
 if (!stristr($tmp, "auth_plugin_sha256_password"))
-       die("skip SHA256 auth plugin not built-in to mysqlnd");
+    die("skip SHA256 auth plugin not built-in to mysqlnd");
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+        die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (mysqli_get_server_version($link) < 50606)
-       die("skip: SHA-256 requires MySQL 5.6.6+");
+    die("skip: SHA-256 requires MySQL 5.6.6+");
 
 if (!($res = $link->query("SHOW PLUGINS"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 $found = false;
 while ($row = $res->fetch_assoc()) {
-       if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
-               $found = true;
-               break;
-       }
+    if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
+        $found = true;
+        break;
+    }
 }
 if (!$found)
-       die("skip SHA-256 server plugin unavailable");
+    die("skip SHA-256 server plugin unavailable");
 
 if (!($res = $link->query("SHOW STATUS LIKE 'Rsa_public_key'"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 if (!($row = $res->fetch_assoc())) {
-       die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
 }
 
 if (strlen($row['Value']) < 100) {
-       die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
 }
 
 if (!$link->query("SET @@session.old_passwords=2")) {
-       die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
 }
 
 $link->query('DROP USER shatest');
@@ -55,24 +55,24 @@ $link->query("DROP USER shatest@localhost");
 
 
 if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
-       !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
-       die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
+    !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
+    die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
-       !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
-       die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
+    !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+    die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query("DROP TABLE IF EXISTS test") ||
-       !$link->query("CREATE TABLE test (id INT)") ||
-       !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    !$link->query("CREATE TABLE test (id INT)") ||
+    !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 
 if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db)) ||
-       !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
-       die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
+    !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
+    die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
 }
 
 $link->close();
@@ -105,9 +105,9 @@ $link->close();
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
-       $link->query('DROP USER shatest');
-       $link->query('DROP USER shatest@localhost');
+    require_once("clean_table.inc");
+    $link->query('DROP USER shatest');
+    $link->query('DROP USER shatest@localhost');
 ?>
 --EXPECT--
 done!
index cd96c55ad5cbaa65998d55c522fb6b7cd06b9bcc..e19fbb1aafc944a5ede8bae179ba062687b8e186 100644 (file)
@@ -11,56 +11,56 @@ phpinfo(INFO_MODULES);
 $tmp = ob_get_contents();
 ob_end_clean();
 if (!stristr($tmp, "auth_plugin_sha256_password"))
-       die("skip SHA256 auth plugin not built-in to mysqlnd");
+    die("skip SHA256 auth plugin not built-in to mysqlnd");
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+        die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (mysqli_get_server_version($link) < 50606)
-       die("skip: SHA-256 requires MySQL 5.6.6+");
+    die("skip: SHA-256 requires MySQL 5.6.6+");
 
 if (!($res = $link->query("SHOW PLUGINS"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 $found = false;
 while ($row = $res->fetch_assoc()) {
-       if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
-               $found = true;
-               break;
-       }
+    if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
+        $found = true;
+        break;
+    }
 }
 if (!$found)
-       die("skip SHA-256 server plugin unavailable");
+    die("skip SHA-256 server plugin unavailable");
 
 if (!($res = $link->query("SHOW STATUS LIKE 'Rsa_public_key'"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 if (!($row = $res->fetch_assoc())) {
-       die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
 }
 
 $key = $row['Value'];
 if (strlen($key) < 100) {
-       die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
 }
 
 /* date changes may give false positive */
 $file = "test_sha256_ini";
 if ((file_exists($file) && !unlink($file)) || !($fp = @fopen($file, "w"))) {
-       die(sprintf("skip Cannot create RSA pub key file '%s'", $file));
+    die(sprintf("skip Cannot create RSA pub key file '%s'", $file));
 }
 $key = str_replace("A", "a", $key);
 $key = str_replace("M", "m", $key);
 if (strlen($key) != fwrite($fp, $key)) {
-       die(sprintf("skip Failed to create pub key file"));
+    die(sprintf("skip Failed to create pub key file"));
 }
 
 
 if (!$link->query("SET @@session.old_passwords=2")) {
-       die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
 }
 
 $link->query('DROP USER shatest');
@@ -68,24 +68,24 @@ $link->query("DROP USER shatest@localhost");
 
 
 if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
-       !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
-       die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
+    !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
+    die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
-       !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
-       die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
+    !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+    die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query("DROP TABLE IF EXISTS test") ||
-       !$link->query("CREATE TABLE test (id INT)") ||
-       !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    !$link->query("CREATE TABLE test (id INT)") ||
+    !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 
 if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db)) ||
-       !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
-       die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
+    !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
+    die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
 }
 
 $link->close();
@@ -94,25 +94,25 @@ $link->close();
 mysqlnd.sha256_server_public_key="test_sha256_ini"
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
 
-       $link = new mysqli($host, 'shatest', 'shatest', $db, $port, $socket);
-       if ($link->connect_errno) {
-               printf("[001] [%d] %s\n", $link->connect_errno, $link->connect_error);
-       } else {
-               if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
-                       printf("[002] [%d] %s\n", $link->errno, $link->error);
+    $link = new mysqli($host, 'shatest', 'shatest', $db, $port, $socket);
+    if ($link->connect_errno) {
+        printf("[001] [%d] %s\n", $link->connect_errno, $link->connect_error);
+    } else {
+        if (!$res = $link->query("SELECT id FROM test WHERE id = 1"))
+            printf("[002] [%d] %s\n", $link->errno, $link->error);
 
-               if (!$row = mysqli_fetch_assoc($res)) {
-                       printf("[003] [%d] %s\n", $link->errno, $link->error);
-               }
+        if (!$row = mysqli_fetch_assoc($res)) {
+            printf("[003] [%d] %s\n", $link->errno, $link->error);
+        }
 
-               if ($row['id'] != 1) {
-                       printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
-               }
-       }
-       print "done!";
+        if ($row['id'] != 1) {
+            printf("[004] Expecting 1 got %s/'%s'", gettype($row['id']), $row['id']);
+        }
+    }
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 190158316b004771aff230693ee0aa3464eaa9d6..0ed6ac6dd284ae0b6f682d3225f025373ef0e8b2 100644 (file)
@@ -11,53 +11,53 @@ phpinfo(INFO_MODULES);
 $tmp = ob_get_contents();
 ob_end_clean();
 if (!stristr($tmp, "auth_plugin_sha256_password"))
-       die("skip SHA256 auth plugin not built-in to mysqlnd");
+    die("skip SHA256 auth plugin not built-in to mysqlnd");
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+        die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (mysqli_get_server_version($link) < 50606)
-       die("skip: SHA-256 requires MySQL 5.6.6+");
+    die("skip: SHA-256 requires MySQL 5.6.6+");
 
 if (!($res = $link->query("SHOW PLUGINS"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 $found = false;
 while ($row = $res->fetch_assoc()) {
-       if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
-               $found = true;
-               break;
-       }
+    if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
+        $found = true;
+        break;
+    }
 }
 if (!$found)
-       die("skip SHA-256 server plugin unavailable");
+    die("skip SHA-256 server plugin unavailable");
 
 if (!($res = $link->query("SHOW STATUS LIKE 'Rsa_public_key'"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 if (!($row = $res->fetch_assoc())) {
-       die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
 }
 
 if (strlen($row['Value']) < 100) {
-       die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
 }
 
 /* date changes may give false positive */
 $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
 if ((file_exists($file) && !unlink($file)) || !($fp = @fopen($file, "w"))) {
-       die(sprintf("skip Cannot create RSA pub key file '%s'", $file));
+    die(sprintf("skip Cannot create RSA pub key file '%s'", $file));
 }
 if (strlen($row['Value']) != fwrite($fp, $row['Value'])) {
-       die(sprintf("skip Failed to create pub key file"));
+    die(sprintf("skip Failed to create pub key file"));
 }
 
 
 if (!$link->query("SET @@session.old_passwords=2")) {
-       die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
 }
 
 $link->query('DROP USER shatest');
@@ -65,24 +65,24 @@ $link->query("DROP USER shatest@localhost");
 
 
 if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
-       !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
-       die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
+    !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
+    die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
-       !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
-       die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
+    !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+    die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query("DROP TABLE IF EXISTS test") ||
-       !$link->query("CREATE TABLE test (id INT)") ||
-       !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    !$link->query("CREATE TABLE test (id INT)") ||
+    !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 
 if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db)) ||
-       !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
-       die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
+    !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
+    die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
 }
 
 $link->close();
@@ -122,11 +122,11 @@ $link->close();
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
-       $link->query('DROP USER shatest');
-       $link->query('DROP USER shatest@localhost');
-       $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
-       @unlink($file);
+    require_once("clean_table.inc");
+    $link->query('DROP USER shatest');
+    $link->query('DROP USER shatest@localhost');
+    $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
+    @unlink($file);
 ?>
 --EXPECT--
 done!
index 73b2ebe95ce0327427dbda21cc6c6bc3b41d2256..37b8207e97ac2c4a6ea5739836fa906a0360e086 100644 (file)
@@ -11,53 +11,53 @@ phpinfo(INFO_MODULES);
 $tmp = ob_get_contents();
 ob_end_clean();
 if (!stristr($tmp, "auth_plugin_sha256_password"))
-       die("skip SHA256 auth plugin not built-in to mysqlnd");
+    die("skip SHA256 auth plugin not built-in to mysqlnd");
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
+        die(printf("skip: [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (mysqli_get_server_version($link) < 50606)
-       die("skip: SHA-256 requires MySQL 5.6.6+");
+    die("skip: SHA-256 requires MySQL 5.6.6+");
 
 if (!($res = $link->query("SHOW PLUGINS"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 $found = false;
 while ($row = $res->fetch_assoc()) {
-       if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
-               $found = true;
-               break;
-       }
+    if (($row['Name'] == 'sha256_password') && ($row['Status'] == 'ACTIVE')) {
+        $found = true;
+        break;
+    }
 }
 if (!$found)
-       die("skip SHA-256 server plugin unavailable");
+    die("skip SHA-256 server plugin unavailable");
 
 if (!($res = $link->query("SHOW STATUS LIKE 'Rsa_public_key'"))) {
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 }
 
 if (!($row = $res->fetch_assoc())) {
-       die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Failed to check RSA pub key, [%d] %s\n", $link->errno, $link->error));
 }
 
 if (strlen($row['Value']) < 100) {
-       die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
+    die(sprintf("skip Server misconfiguration? RSA pub key is suspicious, [%d] %s\n", $link->errno, $link->error));
 }
 
 /* date changes may give false positive */
 $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
 if ((file_exists($file) && !unlink($file)) || !($fp = @fopen($file, "w"))) {
-       die(sprintf("skip Cannot create RSA pub key file '%s'", $file));
+    die(sprintf("skip Cannot create RSA pub key file '%s'", $file));
 }
 if (strlen($row['Value']) != fwrite($fp, $row['Value'])) {
-       die(sprintf("skip Failed to create pub key file"));
+    die(sprintf("skip Failed to create pub key file"));
 }
 
 
 if (!$link->query("SET @@session.old_passwords=2")) {
-       die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Cannot set @@session.old_passwords=2 [%d] %s", $link->errno, $link->error));
 }
 
 $link->query('DROP USER shatest');
@@ -65,24 +65,24 @@ $link->query("DROP USER shatest@localhost");
 
 
 if (!$link->query('CREATE USER shatest@"%" IDENTIFIED WITH sha256_password') ||
-       !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
-       die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
+    !$link->query('CREATE USER shatest@"localhost" IDENTIFIED WITH sha256_password')) {
+    die(sprintf("skip CREATE USER failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query('SET PASSWORD FOR shatest@"%" = PASSWORD("shatest")') ||
-       !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
-       die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
+    !$link->query('SET PASSWORD FOR shatest@"localhost" = PASSWORD("shatest")')) {
+    die(sprintf("skip SET PASSWORD failed [%d] %s", $link->errno, $link->error));
 }
 
 if (!$link->query("DROP TABLE IF EXISTS test") ||
-       !$link->query("CREATE TABLE test (id INT)") ||
-       !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
-       die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
+    !$link->query("CREATE TABLE test (id INT)") ||
+    !$link->query("INSERT INTO test(id) VALUES (1), (2), (3)"))
+    die(sprintf("SKIP [%d] %s\n", $link->errno, $link->error));
 
 
 if (!$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'%%'", $db)) ||
-       !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
-       die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
+    !$link->query(sprintf("GRANT SELECT ON TABLE %s.test TO shatest@'localhost'", $db))) {
+    die(sprintf("skip Cannot grant SELECT to user [%d] %s", mysqli_errno($link), mysqli_error($link)));
 }
 
 $link->close();
@@ -166,13 +166,13 @@ $link->close();
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
-       $link->query('DROP USER shatest');
-       $link->query('DROP USER shatest@localhost');
-       $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
-       @unlink($file);
-       $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd"));
-       @unlink($file_wrong);
+    require_once("clean_table.inc");
+    $link->query('DROP USER shatest');
+    $link->query('DROP USER shatest@localhost');
+    $file = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_" , @date("Ymd"));
+    @unlink($file);
+    $file_wrong = sprintf("%s%s%s_%s", sys_get_temp_dir(), DIRECTORY_SEPARATOR, "test_sha256_wrong" , @date("Ymd"));
+    @unlink($file_wrong);
 ?>
 --EXPECTF--
 Warning: mysqli::real_connect(): (HY000/1045): %s in %s on line %d
index f1adcf49f5535cce9a09ac56a946ee24040867ad..a68a6bb339af0fe679f1961041aaa6ebc3531524 100644 (file)
@@ -12,133 +12,133 @@ mysqli.max_persistent=-1
 mysqli.max_links=-1
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       $phost = 'p:' . $host;
+    $phost = 'p:' . $host;
 
-       if (!$link = my_mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $phost, $user, $db, $port, $socket);
+    if (!$link = my_mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $phost, $user, $db, $port, $socket);
 
-       if (!$thread_id = $link->thread_id)
-               printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$thread_id = $link->thread_id)
+        printf("[002] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
-               printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+    if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+        printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
-               printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
+        printf("[004] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
 
-       if ($thread_id == $new_thread_id)
-               printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+    if ($thread_id == $new_thread_id)
+        printf("[005] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
 
-       if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
-               !($row = mysqli_fetch_assoc($res)))
-               printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+        !($row = mysqli_fetch_assoc($res)))
+        printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       var_dump($row);
-       mysqli_free_result($res);
+    var_dump($row);
+    mysqli_free_result($res);
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       if (!$link = new my_mysqli($phost, $user, $passwd, $db, $port, $socket))
-               printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $phost, $user, $db, $port, $socket);
+    if (!$link = new my_mysqli($phost, $user, $passwd, $db, $port, $socket))
+        printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $phost, $user, $db, $port, $socket);
 
-       if (!$thread_id = $link->thread_id)
-               printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$thread_id = $link->thread_id)
+        printf("[008] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
-               printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+    if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+        printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
-               printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
+        printf("[010] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
 
-       if ($thread_id == $new_thread_id)
-               printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+    if ($thread_id == $new_thread_id)
+        printf("[011] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
 
-       if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
-                       !($row = $res->fetch_assoc()))
-               printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+            !($row = $res->fetch_assoc()))
+        printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       var_dump($row);
-       mysqli_free_result($res);
+    var_dump($row);
+    mysqli_free_result($res);
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
-               printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+    if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
+        printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$link = mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
-               printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $phost, $user, $db, $port, $socket);
+    if (!$link = mysqli_connect($phost, $user, $passwd, $db, $port, $socket))
+        printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $phost, $user, $db, $port, $socket);
 
-       if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
-               printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+    if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+        printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
-       printf("Flipping phost/host order\n");
+    printf("Flipping phost/host order\n");
 
-               if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
+        if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[016] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
 
-       if (!$thread_id = mysqli_thread_id($link))
-               printf("[017] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$thread_id = mysqli_thread_id($link))
+        printf("[017] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (true !== ($tmp = my_mysqli_real_connect($link, $phost, $user, $passwd, $db, $port, $socket)))
-               printf("[018] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+    if (true !== ($tmp = my_mysqli_real_connect($link, $phost, $user, $passwd, $db, $port, $socket)))
+        printf("[018] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
-               printf("[019] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_int($new_thread_id = mysqli_thread_id($link)) || ($new_thread_id < 0))
+        printf("[019] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
 
-       if ($thread_id == $new_thread_id)
-               printf("[020] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+    if ($thread_id == $new_thread_id)
+        printf("[020] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
 
-       if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
-               !($row = mysqli_fetch_assoc($res)))
-               printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+        !($row = mysqli_fetch_assoc($res)))
+        printf("[021] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       var_dump($row);
-       mysqli_free_result($res);
+    var_dump($row);
+    mysqli_free_result($res);
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
-               printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
+    if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+        printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
 
-       if (!$thread_id = $link->thread_id)
-               printf("[023] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$thread_id = $link->thread_id)
+        printf("[023] Cannot determine thread id, test will fail, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (true !== ($tmp = $link->real_connect($phost, $user, $passwd, $db, $port, $socket)))
-               printf("[024] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+    if (true !== ($tmp = $link->real_connect($phost, $user, $passwd, $db, $port, $socket)))
+        printf("[024] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
-               printf("[025] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
+    if (!is_int($new_thread_id = $link->thread_id) || ($new_thread_id < 0))
+        printf("[025] Expecting int/any got %s/%s\n", gettype($tmp), $tmp);
 
-       if ($thread_id == $new_thread_id)
-               printf("[026] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
+    if ($thread_id == $new_thread_id)
+        printf("[026] Expecting new connection and new thread id. Old thread id %d, new thread id %d\n", $thread_id, $new_thread_id);
 
-       if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
-                       !($row = $res->fetch_assoc()))
-               printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+            !($row = $res->fetch_assoc()))
+        printf("[027] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       var_dump($row);
-       mysqli_free_result($res);
+    var_dump($row);
+    mysqli_free_result($res);
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
-               printf("[028] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+    if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+        printf("[028] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[029] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
+    if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[029] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
 
-       if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
-               printf("[030] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+    if (NULL !== ($tmp = $link->connect($phost, $user, $passwd, $db, $port, $socket)))
+        printf("[030] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 array(1) {
index e8c592f9ff68f8ff430dc508376e134c45f97750..a59a43cbd59a922c8f8392238eacebbf62edc4a4 100644 (file)
@@ -14,44 +14,44 @@ mysqli.max_persistent=2
 mysqli.max_links=2
 --FILE--
 <?php
-       require_once("connect.inc");
-
-       $host = 'p:' . $host;
-       if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               // automatic downgrade to normal connections has failed
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
-       }
-       if (!mysqli_query($link1, "SET @pcondisabled = 'Connection 1'"))
-               printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
-                       mysqli_errno($link1), mysqli_error($link1));
-
-       if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               // automatic downgrade to normal connections has failed
-               printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
-       }
-
-       if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
-               printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
-       $row = mysqli_fetch_assoc($res);
-       printf("Connecction 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
-       mysqli_free_result($res);
-
-       if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
-               printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
-       $row = mysqli_fetch_assoc($res);
-       printf("Connecction 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
-       mysqli_free_result($res);
-
-       if ($link1 === $link2)
-               printf("[006] Links should not be identical\n");
-
-       mysqli_close($link1);
-       mysqli_close($link2);
-       print "done!";
+    require_once("connect.inc");
+
+    $host = 'p:' . $host;
+    if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        // automatic downgrade to normal connections has failed
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+    }
+    if (!mysqli_query($link1, "SET @pcondisabled = 'Connection 1'"))
+        printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
+            mysqli_errno($link1), mysqli_error($link1));
+
+    if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        // automatic downgrade to normal connections has failed
+        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+    }
+
+    if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
+        printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+    $row = mysqli_fetch_assoc($res);
+    printf("Connecction 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+    mysqli_free_result($res);
+
+    if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+        printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+    $row = mysqli_fetch_assoc($res);
+    printf("Connecction 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+    mysqli_free_result($res);
+
+    if ($link1 === $link2)
+        printf("[006] Links should not be identical\n");
+
+    mysqli_close($link1);
+    mysqli_close($link2);
+    print "done!";
 ?>
 --EXPECTF--
 Warning: my_mysqli_connect(): Persistent connections are disabled. Downgrading to normal in %s on line %d
index f4be4c7c7bc56fd1f662100bb7649cb014a36ad1..5fd719cf2dbf5cea1c1534a89f1ff3d39a964657 100644 (file)
@@ -12,80 +12,80 @@ mysqli.allow_persistent=1
 mysqli.max_persistent=2
 --FILE--
 <?php
-       require_once("connect.inc");
-       require_once("table.inc");
-
-       $host = 'p:' . $host;
-       if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-
-       // get the thread ids of the two connections...
-       $thread_id = mysqli_thread_id($link);
-       $pthread_id = mysqli_thread_id($plink);
-
-       if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
-               printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (count($running_threads) < 2)
-               printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!isset($running_threads[$thread_id]))
-               printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!isset($running_threads[$pthread_id]))
-               printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       // Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that...
-       if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
-               printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       mysqli_close($plink);
-       // Give the server think-time to kill the pthread
-       sleep(1);
-
-       if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
-               printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       $running_threads2 = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads2[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (isset($running_threads2[$pthread_id]))
-               printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       if (!isset($running_threads2[$thread_id]))
-               printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       // On PHP side this should do nothing. PHP should not try to close the connection or something.
-       @mysqli_close($plink);
-
-       if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-       if (!$res3 = @mysqli_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1')) {
-               printf("[012] New persistent connection cannot execute queries, [%d] %s\n", @mysqli_errno($plink), @mysqli_error($plink));
-       }
-
-       @mysqli_free_result($res3);
-       @mysqli_close($plink);
-       mysqli_close($link);
-
-       // remove the "p:<host>" from the host variable
-       $host = substr($host, 2);
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-       if (!$res4 = mysqli_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1'))
-               printf("[014] New regular connection cannot execute queries, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       mysqli_free_result($res4);
-       mysqli_close($link);
-       print "done!";
+    require_once("connect.inc");
+    require_once("table.inc");
+
+    $host = 'p:' . $host;
+    if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+
+    // get the thread ids of the two connections...
+    $thread_id = mysqli_thread_id($link);
+    $pthread_id = mysqli_thread_id($plink);
+
+    if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
+        printf("[002] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (count($running_threads) < 2)
+        printf("[003] Processlist is too short, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!isset($running_threads[$thread_id]))
+        printf("[004] Cannot find thread id of the regular link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!isset($running_threads[$pthread_id]))
+        printf("[005] Cannot find thread id of the persistent link, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    // Kill the persistent connection - don't use mysqli_kill, mysqlnd will catch that...
+    if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
+        printf("[006] Cannot kill persistent connection, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    mysqli_close($plink);
+    // Give the server think-time to kill the pthread
+    sleep(1);
+
+    if (!$res = mysqli_query($link, 'SHOW FULL PROCESSLIST'))
+        printf("[007] Cannot get processlist, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    $running_threads2 = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads2[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (isset($running_threads2[$pthread_id]))
+        printf("[008] Thread of the persistent connection should have been gone, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!isset($running_threads2[$thread_id]))
+        printf("[009] Thread of the regular connection should be still there, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    // On PHP side this should do nothing. PHP should not try to close the connection or something.
+    @mysqli_close($plink);
+
+    if (!$plink = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[011] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+    if (!$res3 = @mysqli_query($plink, 'SELECT id FROM test ORDER BY id LIMIT 1')) {
+        printf("[012] New persistent connection cannot execute queries, [%d] %s\n", @mysqli_errno($plink), @mysqli_error($plink));
+    }
+
+    @mysqli_free_result($res3);
+    @mysqli_close($plink);
+    mysqli_close($link);
+
+    // remove the "p:<host>" from the host variable
+    $host = substr($host, 2);
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[013] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+    if (!$res4 = mysqli_query($link, 'SELECT id FROM test ORDER BY id LIMIT 1'))
+        printf("[014] New regular connection cannot execute queries, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    mysqli_free_result($res4);
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 311d8ed21e66cc8060fae8d51a93da0b95934237..b00b99883aa5ad2238cdaa77e1b52570131c4b2c 100644 (file)
@@ -13,77 +13,77 @@ mysqli.max_persistent=-1
 mysqli.max_links=-1
 --FILE--
 <?php
-       require_once("connect.inc");
-       // opens a regular connection
-       require_once("table.inc");
+    require_once("connect.inc");
+    // opens a regular connection
+    require_once("table.inc");
 
-       if (!$res = mysqli_query($link, "SELECT 'works..' as _desc"))
-               printf("[001] Cannot run query, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_query($link, "SELECT 'works..' as _desc"))
+        printf("[001] Cannot run query, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
 
-       $row = mysqli_fetch_assoc($res);
-       mysqli_free_result($res);
-       printf("Regular connection 1 - '%s'\n", $row['_desc']);
+    $row = mysqli_fetch_assoc($res);
+    mysqli_free_result($res);
+    printf("Regular connection 1 - '%s'\n", $row['_desc']);
 
-       if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[002] Cannot open second regular connection, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
+    if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[002] Cannot open second regular connection, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!$res = mysqli_query($link2, "SELECT 'works...' as _desc"))
-               printf("[003] Cannot run query, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link2));
+    if (!$res = mysqli_query($link2, "SELECT 'works...' as _desc"))
+        printf("[003] Cannot run query, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link2));
 
-       $row = mysqli_fetch_assoc($res);
-       mysqli_free_result($res);
-       printf("Regular connection 2 - '%s'\n", $row['_desc']);
+    $row = mysqli_fetch_assoc($res);
+    mysqli_free_result($res);
+    printf("Regular connection 2 - '%s'\n", $row['_desc']);
 
-       $host = 'p:' . $host;
-       if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket,
-                       mysqli_connect_errno(), mysqli_connect_error());
+    $host = 'p:' . $host;
+    if (!$plink = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[004] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket,
+            mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!$res = mysqli_query($plink, "SELECT 'works...' as _desc"))
-               printf("[005] Cannot run query, [%d] %s\n",
-                       mysqli_errno($plink), mysqli_error($plink));
+    if (!$res = mysqli_query($plink, "SELECT 'works...' as _desc"))
+        printf("[005] Cannot run query, [%d] %s\n",
+            mysqli_errno($plink), mysqli_error($plink));
 
-       $row = mysqli_fetch_assoc($res);
-       mysqli_free_result($res);
-       printf("Persistent connection 1 - '%s'\n", $row['_desc']);
+    $row = mysqli_fetch_assoc($res);
+    mysqli_free_result($res);
+    printf("Persistent connection 1 - '%s'\n", $row['_desc']);
 
-       if (!$plink2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket,
-                       mysqli_connect_errno(), mysqli_connect_error());
+    if (!$plink2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[006] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket,
+            mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!$res = mysqli_query($plink2, "SELECT 'works...' as _desc"))
-               printf("[007] Cannot run query, [%d] %s\n",
-                       mysqli_errno($plink2), mysqli_error($plink2));
+    if (!$res = mysqli_query($plink2, "SELECT 'works...' as _desc"))
+        printf("[007] Cannot run query, [%d] %s\n",
+            mysqli_errno($plink2), mysqli_error($plink2));
 
-       $row = mysqli_fetch_assoc($res);
-       mysqli_free_result($res);
-       printf("Persistent connection 2 - '%s'\n", $row['_desc']);
+    $row = mysqli_fetch_assoc($res);
+    mysqli_free_result($res);
+    printf("Persistent connection 2 - '%s'\n", $row['_desc']);
 
-       $plink3 = mysqli_init();
-       if (!my_mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket))
-               printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket,
-                       mysqli_connect_errno(), mysqli_connect_error());
+    $plink3 = mysqli_init();
+    if (!my_mysqli_real_connect($plink3, $host, $user, $passwd, $db, $port, $socket))
+        printf("[008] Cannot create persistent connection using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket,
+            mysqli_connect_errno(), mysqli_connect_error());
 
-       if (!$res = mysqli_query($plink3, "SELECT 'works...' as _desc"))
-               printf("[009] Cannot run query, [%d] %s\n",
-                       mysqli_errno($plink2), mysqli_error($plink2));
+    if (!$res = mysqli_query($plink3, "SELECT 'works...' as _desc"))
+        printf("[009] Cannot run query, [%d] %s\n",
+            mysqli_errno($plink2), mysqli_error($plink2));
 
-       $row = mysqli_fetch_assoc($res);
-       mysqli_free_result($res);
-       printf("Persistent connection 3 - '%s'\n", $row['_desc']);
+    $row = mysqli_fetch_assoc($res);
+    mysqli_free_result($res);
+    printf("Persistent connection 3 - '%s'\n", $row['_desc']);
 
-       mysqli_close($link);
-       mysqli_close($link2);
-       mysqli_close($plink);
-       mysqli_close($plink2);
-       mysqli_close($plink3);
-       print "done!";
+    mysqli_close($link);
+    mysqli_close($link2);
+    mysqli_close($plink);
+    mysqli_close($plink2);
+    mysqli_close($plink3);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 7a96d906653fa32894133555aff7ba155b0a774d..a01a78a03c0a9cccc7f35955b5ac3cb2b2953b7f 100644 (file)
@@ -2,42 +2,42 @@
 Persistent connections and mysqli.max_links
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-       require_once('table.inc');
-
-       mysqli_query($link, 'DROP USER pcontest');
-       mysqli_query($link, 'DROP USER pcontest@localhost');
-
-       if (!mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') ||
-               !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"')) {
-               printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
-               mysqli_close($link);
-               die("skip CREATE USER failed");
-       }
-
-       // we might be able to specify the host using CURRENT_USER(), but...
-       if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) ||
-               !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) {
-               printf("skip Cannot GRANT SELECT to second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
-               mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
-               mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@localhost');
-               mysqli_query($link, 'DROP USER pcontest@localhost');
-               mysqli_query($link, 'DROP USER pcontest');
-               mysqli_close($link);
-               die("skip GRANT failed");
-       }
-
-       if (!($link_pcontest = @my_mysqli_connect($host, 'pcontest', 'pcontest', $db, $port, $socket))) {
-               mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
-               mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@localhost');
-               mysqli_query($link, 'DROP USER pcontest@localhost');
-               mysqli_query($link, 'DROP USER pcontest');
-               mysqli_close($link);
-               die("skip CONNECT using new user failed");
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+    require_once('table.inc');
+
+    mysqli_query($link, 'DROP USER pcontest');
+    mysqli_query($link, 'DROP USER pcontest@localhost');
+
+    if (!mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') ||
+        !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"')) {
+        printf("skip Cannot create second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
+        mysqli_close($link);
+        die("skip CREATE USER failed");
     }
-       mysqli_close($link);
+
+    // we might be able to specify the host using CURRENT_USER(), but...
+    if (!mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) ||
+        !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) {
+        printf("skip Cannot GRANT SELECT to second DB user [%d] %s", mysqli_errno($link), mysqli_error($link));
+        mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
+        mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@localhost');
+        mysqli_query($link, 'DROP USER pcontest@localhost');
+        mysqli_query($link, 'DROP USER pcontest');
+        mysqli_close($link);
+        die("skip GRANT failed");
+    }
+
+    if (!($link_pcontest = @my_mysqli_connect($host, 'pcontest', 'pcontest', $db, $port, $socket))) {
+        mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
+        mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest@localhost');
+        mysqli_query($link, 'DROP USER pcontest@localhost');
+        mysqli_query($link, 'DROP USER pcontest');
+        mysqli_close($link);
+        die("skip CONNECT using new user failed");
+    }
+    mysqli_close($link);
 ?>
 --INI--
 mysqli.allow_persistent=1
@@ -45,147 +45,147 @@ mysqli.max_persistent=2
 mysqli.rollback_on_cached_plink=1
 --FILE--
 <?php
-       require_once("connect.inc");
-       require_once('table.inc');
-
-
-       if (!mysqli_query($link, 'DROP USER pcontest') ||
-               !mysqli_query($link, 'DROP USER pcontest@localhost') ||
-               !mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') ||
-               !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"') ||
-               !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) ||
-               !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) {
-               printf("[000] Init failed, [%d] %s\n",
-                       mysqli_errno($plink), mysqli_error($plink));
-       }
-
-       var_dump(mysqli_get_links_stats(1));
-
-       echo "Before pconnect:";
-       var_dump(mysqli_get_links_stats());
-
-       if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
-               printf("[001] Cannot connect using the second DB user created during SKIPIF, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
-
-       echo "After pconnect:";
-       var_dump(mysqli_get_links_stats());
-
-       ob_start();
-       phpinfo();
-       $phpinfo = strip_tags(ob_get_contents());
-       ob_end_clean();
-
-       $phpinfo = substr($phpinfo, strpos($phpinfo, 'MysqlI Support => enabled'), 500);
-       if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
-               printf("[002] Cannot get # active persistent links from phpinfo()\n");
-       $num_plinks = $matches[1];
-
-       if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
-               printf("[003] Cannot run query on persistent connection of second DB user, [%d] %s\n",
-                       mysqli_errno($plink), mysqli_error($plink));
-
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[004] Cannot run fetch result, [%d] %s\n",
-                       mysqli_errno($plink), mysqli_error($plink));
-       mysqli_free_result($res);
-       var_dump($row);
-
-       // change the password for the second DB user and kill the persistent connection
-       if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') &&
-                       !mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")'))||
-                       !mysqli_query($link, 'FLUSH PRIVILEGES'))
-               printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    require_once("connect.inc");
+    require_once('table.inc');
+
+
+    if (!mysqli_query($link, 'DROP USER pcontest') ||
+        !mysqli_query($link, 'DROP USER pcontest@localhost') ||
+        !mysqli_query($link, 'CREATE USER pcontest@"%" IDENTIFIED BY "pcontest"') ||
+        !mysqli_query($link, 'CREATE USER pcontest@localhost IDENTIFIED BY "pcontest"') ||
+        !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'%%'", $db)) ||
+        !mysqli_query($link, sprintf("GRANT SELECT ON TABLE %s.test TO pcontest@'localhost'", $db))) {
+        printf("[000] Init failed, [%d] %s\n",
+            mysqli_errno($plink), mysqli_error($plink));
+    }
+
+    var_dump(mysqli_get_links_stats(1));
+
+    echo "Before pconnect:";
+    var_dump(mysqli_get_links_stats());
+
+    if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
+        printf("[001] Cannot connect using the second DB user created during SKIPIF, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
+
+    echo "After pconnect:";
+    var_dump(mysqli_get_links_stats());
+
+    ob_start();
+    phpinfo();
+    $phpinfo = strip_tags(ob_get_contents());
+    ob_end_clean();
+
+    $phpinfo = substr($phpinfo, strpos($phpinfo, 'MysqlI Support => enabled'), 500);
+    if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
+        printf("[002] Cannot get # active persistent links from phpinfo()\n");
+    $num_plinks = $matches[1];
+
+    if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
+        printf("[003] Cannot run query on persistent connection of second DB user, [%d] %s\n",
+            mysqli_errno($plink), mysqli_error($plink));
+
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[004] Cannot run fetch result, [%d] %s\n",
+            mysqli_errno($plink), mysqli_error($plink));
+    mysqli_free_result($res);
+    var_dump($row);
+
+    // change the password for the second DB user and kill the persistent connection
+    if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest = "newpass"') &&
+            !mysqli_query($link, 'SET PASSWORD FOR pcontest = PASSWORD("newpass")'))||
+            !mysqli_query($link, 'FLUSH PRIVILEGES'))
+        printf("[005] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
         // change the password for the second DB user and kill the persistent connection
-       if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') &&
-               !mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")')) ||
-                       !mysqli_query($link, 'FLUSH PRIVILEGES'))
-               printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       // persistent connections cannot be closed but only be killed
-       $pthread_id = mysqli_thread_id($plink);
-       if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
-               printf("[007] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       // give the server a second to really kill the thread
-       sleep(1);
-
-       if (!$res = mysqli_query($link, "SHOW FULL PROCESSLIST"))
-               printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (isset($running_threads[$pthread_id]))
-               printf("[009] Persistent connection has not been killed\n");
-
-       echo "Before second pconnect:";
-       var_dump(mysqli_get_links_stats());
-
-       // this fails and we have 0 (<= $num_plinks) connections
-       if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
-               printf("[010] Can connect using the old password, [%d] %s\n",
-                       mysqli_connect_errno($link), mysqli_connect_error($link));
-
-       echo "After second pconnect:";
-       var_dump(mysqli_get_links_stats());
-
-       ob_start();
-       phpinfo();
-       $phpinfo = strip_tags(ob_get_contents());
-       ob_end_clean();
-       $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
-       if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
-               printf("[010] Cannot get # of active persistent links from phpinfo()\n");
-
-       var_dump(mysqli_get_links_stats());
-
-       $num_plinks_kill = $matches[1];
-       $sstats = mysqli_get_links_stats();
-       if ($sstats['active_plinks'] != $num_plinks_kill) {
-               printf("[010.2] Num of active plinks differ %s %s\n", $sstats['active_plinks'], $num_plinks_kill);
-       }
-       if ($num_plinks_kill > $num_plinks)
-               printf("[011] Expecting Active Persistent Links < %d, got %d\n", $num_plinks, $num_plinks_kill);
-
-       if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket))
-               printf("[012] Cannot connect using the new password, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
-
-       if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
-               printf("[013] Cannot run query on persistent connection of second DB user, [%d] %s\n",
-                       mysqli_errno($plink), mysqli_error($plink));
-
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[014] Cannot run fetch result, [%d] %s\n",
-                       mysqli_errno($plink), mysqli_error($plink));
-       mysqli_free_result($res);
-       var_dump($row);
-
-       if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) {
-               printf("[015] Can open more persistent connections than allowed, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
-               var_dump(mysqli_get_links_stats());
-       }
-
-       ob_start();
-       phpinfo();
-       $phpinfo = strip_tags(ob_get_contents());
-       ob_end_clean();
-       $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
-       if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
-               printf("[016] Cannot get # of active persistent links from phpinfo()\n");
-
-       $num_plinks = $matches[1];
-       if ($num_plinks > (int)ini_get('mysqli.max_persistent'))
-               printf("[017] mysqli.max_persistent=%d allows %d open connections!\n", ini_get('mysqli.max_persistent'),$num_plinks);
-
-       mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
-       mysqli_query($link, 'DROP USER pcontest');
-       mysqli_close($link);
-       print "done!";
+    if ((!mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = "newpass"') &&
+        !mysqli_query($link, 'SET PASSWORD FOR pcontest@localhost = PASSWORD("newpass")')) ||
+            !mysqli_query($link, 'FLUSH PRIVILEGES'))
+        printf("[006] Cannot change PW of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    // persistent connections cannot be closed but only be killed
+    $pthread_id = mysqli_thread_id($plink);
+    if (!mysqli_query($link, sprintf('KILL %d', $pthread_id)))
+        printf("[007] Cannot KILL persistent connection of second DB user, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    // give the server a second to really kill the thread
+    sleep(1);
+
+    if (!$res = mysqli_query($link, "SHOW FULL PROCESSLIST"))
+        printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (isset($running_threads[$pthread_id]))
+        printf("[009] Persistent connection has not been killed\n");
+
+    echo "Before second pconnect:";
+    var_dump(mysqli_get_links_stats());
+
+    // this fails and we have 0 (<= $num_plinks) connections
+    if ($plink = @my_mysqli_connect('p:' . $host, 'pcontest', 'pcontest', $db, $port, $socket))
+        printf("[010] Can connect using the old password, [%d] %s\n",
+            mysqli_connect_errno($link), mysqli_connect_error($link));
+
+    echo "After second pconnect:";
+    var_dump(mysqli_get_links_stats());
+
+    ob_start();
+    phpinfo();
+    $phpinfo = strip_tags(ob_get_contents());
+    ob_end_clean();
+    $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
+    if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
+        printf("[010] Cannot get # of active persistent links from phpinfo()\n");
+
+    var_dump(mysqli_get_links_stats());
+
+    $num_plinks_kill = $matches[1];
+    $sstats = mysqli_get_links_stats();
+    if ($sstats['active_plinks'] != $num_plinks_kill) {
+        printf("[010.2] Num of active plinks differ %s %s\n", $sstats['active_plinks'], $num_plinks_kill);
+    }
+    if ($num_plinks_kill > $num_plinks)
+        printf("[011] Expecting Active Persistent Links < %d, got %d\n", $num_plinks, $num_plinks_kill);
+
+    if (!$plink = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket))
+        printf("[012] Cannot connect using the new password, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
+
+    if (!$res = mysqli_query($plink, 'SELECT id, label FROM test WHERE id = 1'))
+        printf("[013] Cannot run query on persistent connection of second DB user, [%d] %s\n",
+            mysqli_errno($plink), mysqli_error($plink));
+
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[014] Cannot run fetch result, [%d] %s\n",
+            mysqli_errno($plink), mysqli_error($plink));
+    mysqli_free_result($res);
+    var_dump($row);
+
+    if ($plink2 = my_mysqli_connect('p:' . $host, 'pcontest', 'newpass', $db, $port, $socket)) {
+        printf("[015] Can open more persistent connections than allowed, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
+        var_dump(mysqli_get_links_stats());
+    }
+
+    ob_start();
+    phpinfo();
+    $phpinfo = strip_tags(ob_get_contents());
+    ob_end_clean();
+    $phpinfo = substr($phpinfo, stripos($phpinfo, 'MysqlI Support => enabled'), 500);
+    if (!preg_match('@Active Persistent Links\s+=>\s+(\d+)@ismU', $phpinfo, $matches))
+        printf("[016] Cannot get # of active persistent links from phpinfo()\n");
+
+    $num_plinks = $matches[1];
+    if ($num_plinks > (int)ini_get('mysqli.max_persistent'))
+        printf("[017] mysqli.max_persistent=%d allows %d open connections!\n", ini_get('mysqli.max_persistent'),$num_plinks);
+
+    mysqli_query($link, 'REVOKE ALL PRIVILEGES, GRANT OPTION FROM pcontest');
+    mysqli_query($link, 'DROP USER pcontest');
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 926f6b797c00adecdc874d54ca3e0431ac2b0a0f..89600c48d9857ddb046e06ef238e25635fc1baff 100644 (file)
@@ -14,72 +14,72 @@ mysqli.max_persistent=2
 mysqli.max_links=2
 --FILE--
 <?php
-       require_once("connect.inc");
-
-       $host = 'p:' . $host;
-       if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
-       }
-       if (!mysqli_query($link1, 'SET @pcondisabled = "Connection 1"'))
-               printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
-                       mysqli_errno($link1), mysqli_error($link1));
-
-       if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
-       }
-
-       if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
-               printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
-       $row = mysqli_fetch_assoc($res);
-       printf("Connection 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
-       mysqli_free_result($res);
-
-       if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
-               printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
-       $row = mysqli_fetch_assoc($res);
-       printf("Connection 2 (no reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
-       $thread_id = mysqli_thread_id($link2);
-       printf("Connection 2 (no reuse) - Thread ID -> '%s'\n", $thread_id);
-       mysqli_free_result($res);
-
-       if (!mysqli_query($link2, 'SET @pcondisabled = "Connection 2"'))
-               printf("[006] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link2));
-
-       if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
-               printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
-       $row = mysqli_fetch_assoc($res);
-       printf("Connection 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
-       mysqli_free_result($res);
-
-       mysqli_close($link2);
-
-       /* reuse of existing persistent connection expected! */
-       if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
-                       $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
-       }
-
-       if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
-               printf("[009] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-
-       $row = mysqli_fetch_assoc($res);
-       printf("Connection 2 (reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
-       $thread_id_reuse = mysqli_thread_id($link2);
-       printf("Connection 2 (reuse) - Thread ID -> '%s'\n", $thread_id_reuse);
-       mysqli_free_result($res);
-
-       if ($thread_id != $thread_id_reuse)
-               printf("[010] Seems as if we have got a new connection, connections should have been cached and reused!\n");
-
-       mysqli_close($link1);
-       mysqli_close($link2);
-       print "done!";
+    require_once("connect.inc");
+
+    $host = 'p:' . $host;
+    if (!$link1 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+    }
+    if (!mysqli_query($link1, 'SET @pcondisabled = "Connection 1"'))
+        printf("[002] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
+            mysqli_errno($link1), mysqli_error($link1));
+
+    if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+    }
+
+    if (!$res = mysqli_query($link1, 'SELECT @pcondisabled AS _test'))
+        printf("[004] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+    $row = mysqli_fetch_assoc($res);
+    printf("Connection 1 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+    mysqli_free_result($res);
+
+    if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+        printf("[005] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+    $row = mysqli_fetch_assoc($res);
+    printf("Connection 2 (no reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+    $thread_id = mysqli_thread_id($link2);
+    printf("Connection 2 (no reuse) - Thread ID -> '%s'\n", $thread_id);
+    mysqli_free_result($res);
+
+    if (!mysqli_query($link2, 'SET @pcondisabled = "Connection 2"'))
+        printf("[006] Cannot set user variable to check if we got the same persistent connection, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link2));
+
+    if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+        printf("[007] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+    $row = mysqli_fetch_assoc($res);
+    printf("Connection 2 - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+    mysqli_free_result($res);
+
+    mysqli_close($link2);
+
+    /* reuse of existing persistent connection expected! */
+    if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[008] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s, [%d] %s\n",
+            $host, $user, $db, $port, $socket, mysqli_connect_errno(), mysqli_connect_error());
+    }
+
+    if (!$res = mysqli_query($link2, 'SELECT @pcondisabled AS _test'))
+        printf("[009] [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+
+    $row = mysqli_fetch_assoc($res);
+    printf("Connection 2 (reuse) - SELECT @pcondisabled -> '%s'\n", $row['_test']);
+    $thread_id_reuse = mysqli_thread_id($link2);
+    printf("Connection 2 (reuse) - Thread ID -> '%s'\n", $thread_id_reuse);
+    mysqli_free_result($res);
+
+    if ($thread_id != $thread_id_reuse)
+        printf("[010] Seems as if we have got a new connection, connections should have been cached and reused!\n");
+
+    mysqli_close($link1);
+    mysqli_close($link2);
+    print "done!";
 ?>
 --EXPECTF--
 Connection 1 - SELECT @pcondisabled -> 'Connection 1'
index ca2acd1369c327e53f6e004c39724a6423e4dadf..e388847507e94408e0334a6b014ecf83cfde5f16 100644 (file)
@@ -13,57 +13,57 @@ mysqli.max_persistent=-1
 mysqli.max_links=-1
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       $host = 'p:' . $host;
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
+    $host = 'p:' . $host;
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
 
-       if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
-               printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+    if (true !== ($tmp = my_mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+        printf("[003] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
 
-       /* it is undefined which pooled connection we get - thread ids may differ */
+    /* it is undefined which pooled connection we get - thread ids may differ */
 
-       if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
-               !($row = mysqli_fetch_assoc($res)))
-               printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!($res = mysqli_query($link, "SELECT 'ok' AS it_works")) ||
+        !($row = mysqli_fetch_assoc($res)))
+        printf("[006] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       var_dump($row);
-       mysqli_free_result($res);
+    var_dump($row);
+    mysqli_free_result($res);
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
-               printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
+    if (!$link = new my_mysqli($host, $user, $passwd, $db, $port, $socket))
+        printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
 
 
-       if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
-               printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+    if (true !== ($tmp = $link->real_connect($host, $user, $passwd, $db, $port, $socket)))
+        printf("[009] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
 
-       /* it is undefined which pooled connection we get - thread ids may differ */
+    /* it is undefined which pooled connection we get - thread ids may differ */
 
-       if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
-                       !($row = $res->fetch_assoc()))
-               printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!($res = $link->query("SELECT 'works also with oo' AS syntax")) ||
+            !($row = $res->fetch_assoc()))
+        printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       var_dump($row);
-       mysqli_free_result($res);
+    var_dump($row);
+    mysqli_free_result($res);
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
-               printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+    if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+        printf("[013] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
-       if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
+    if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[014] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
 
-       if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
-               printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
+    if (NULL !== ($tmp = $link->connect($host, $user, $passwd, $db, $port, $socket)))
+        printf("[015] Expecting NULL got %s/%s\n", gettype($tmp), $tmp);
 
-       print "done!";
+    print "done!";
 ?>
 --EXPECT--
 array(1) {
index b9c66381f9bee2af2b6950a8dca4c3aa51d1ab75..00be1c4bcb13fafba4ea6ddd163e28d7e7d58045 100644 (file)
@@ -8,7 +8,7 @@ require_once('connect.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
+    die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
 ?>
 --FILE--
 <?php
index 7c10d13df15d70424f82bf9794c6fb3ab63169af..26dd85be014127105923e6752c7477e486ef8428 100644 (file)
@@ -8,7 +8,7 @@ require_once('connect.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
+    die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
 ?>
 --FILE--
 <?php
index 0bafb2cc9ba4389c364ae5d3fbfc1da2c7456176..95ddd486888df8bf22e15944a1126c166eed798c 100644 (file)
@@ -8,7 +8,7 @@ require_once('connect.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
+    die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
 ?>
 --FILE--
 <?php
@@ -166,10 +166,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS bogus"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_query($link, "DROP PROCEDURE IF EXISTS p");
 
index ab2ed2aee81e5accca3788661bb656d405063820..f039546221d842a300337394e890feb566345962 100644 (file)
@@ -8,13 +8,13 @@ require_once('connect.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
+    die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die("skip cannot connect");
+    die("skip cannot connect");
 
 if (mysqli_get_server_version($link) < 50012)
-       die("skip Test needs SQL function SLEEP() available as of MySQL 5.0.12");
+    die("skip Test needs SQL function SLEEP() available as of MySQL 5.0.12");
 
 ?>
 --FILE--
index 0c3bedf5b50244a14eb0ca9f71596a7d20687f13..28a8f4e48b4442be821fefbf30b22c660851fc56 100644 (file)
@@ -123,10 +123,10 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test2"))
-       printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c003] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index 08145cddcf2e678de757e4a178ed0e5508f90fb0..d35ac3dae96956a38cc14ca3ee17b694dbae6111 100644 (file)
@@ -114,7 +114,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 @mysqli_query($link, "DROP FUNCTION IF EXISTS f");
 @mysqli_query($link, 'DROP PROCEDURE IF EXISTS p');
index 81ca8c0faeccd6799019ffba7eebebc15d694a11..23021ee21543efe4d4a23c7f909863b143c1f6ea 100644 (file)
@@ -65,7 +65,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 --- Testing default ---
index aad39cd94d48b0e3aa16646775bb49883b02ba8d..1f7e88f754ca6556c4c530e55edbb5c01d4ce27d 100644 (file)
@@ -6,10 +6,10 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 50000) {
-       die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --FILE--
@@ -157,7 +157,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 @mysqli_query($link, "DROP PROCEDURE IS EXISTS p");
 
index 819a849d94f196e85c28aac849addb3a1465589a..ec7846b77d4b125382f74b17f801751197c12cdf 100644 (file)
@@ -8,7 +8,7 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 require_once('table.inc');
 if (!$res = mysqli_query($link, "SHOW CHARACTER SET LIKE 'utf8'"))
-       die("skip UTF8 chatset seems not available");
+    die("skip UTF8 chatset seems not available");
 mysqli_free_result($res);
 mysqli_close($link);
 ?>
index 2e39833ffe808bc2df4602cab22c7a1ce015118e..1b0d26e7a3af10fcc98c327ffb229273425f42c8 100644 (file)
@@ -10,167 +10,167 @@ require_once('skipifconnectfailure.inc');
 mysqli.allow_local_infile=1
 --FILE--
 <?php
-       include("connect.inc");
-
-       $tmp    = NULL;
-       $link   = NULL;
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link)))
-               printf("[001a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link)))
-               printf("[001b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link)))
-               printf("[001c] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link)))
-               printf("[001d] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link)))
-               printf("[001e] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link)))
-               printf("[001f] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link)))
-               printf("[001g] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       //  ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]]
-       if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link, $link)))
-               printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       if (!$link = mysqli_init())
-               printf("[002] mysqli_init() failed\n");
-
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
-               printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-
-       mysqli_close($link);
-       if (!$link = mysqli_init())
-               printf("[004] mysqli_init() failed\n");
-
-       if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
-               printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
-
-       // Run the following tests without an anoynmous MySQL user and use a password for the test user!
-       ini_set('mysqli.default_socket', $socket);
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
-               printf("[006] Usage of mysqli.default_socket failed\n");
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[007] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_port', $port);
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
-               printf("[008] Usage of mysqli.default_port failed\n");
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[009] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_pw', $passwd);
-       if (!mysqli_real_connect($link, $host, $user)) {
-               printf("[010] Usage of mysqli.default_pw failed\n") ;
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[011] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_user', $user);
-       if (!mysqli_real_connect($link, $host)) {
-               printf("[012] Usage of mysqli.default_user failed\n") ;
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[011] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_host', $host);
-       if (!mysqli_real_connect($link)) {
-               printf("[014] Usage of mysqli.default_host failed\n") ;
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[015] mysqli_init() failed\n");
-       }
-
-       // CLIENT_MULTI_STATEMENTS - should be disabled silently
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
-               printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
-               printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
-               var_dump($res->num_rows);
-               mysqli_next_result($link);
-               $res = mysqli_store_result($link);
-               var_dump($res->num_rows);
-       }
-
-
-       mysqli_close($link);
-       if (!$link = mysqli_init())
-               printf("[018] mysqli_init() failed\n");
-
-       if (ini_get('open_basedir')) {
-               // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
-
-               if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
-                       printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-               $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
-               if (!$fp = fopen($filename, 'w'))
-                       printf("[020] Cannot open temporary file %s\n", $filename);
-
-               fwrite($fp, '100;z');
-               fclose($fp);
-
-               // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
-               if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
-                       printf("[021] LOAD DATA INFILE should have been forbidden!\n");
-
-               unlink($filename);
-       }
-
-       mysqli_close($link);
-       var_dump($link);
-
-       if ($IS_MYSQLND) {
-               ini_set('mysqli.default_host', 'p:' . $host);
-               $link = mysqli_init();
-               if (!@mysqli_real_connect($link)) {
-                       printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
-               } else {
-                       if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
-                               printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                       $tmp = mysqli_fetch_assoc($res);
-                       if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
-                               printf("[024] Result looks strange - check manually, [%d] %s\n",
-                                       mysqli_errno($link), mysqli_error($link));
-                               var_dump($tmp);
-                       }
-                       mysqli_free_result($res);
-                       mysqli_close($link);
-               }
-
-               ini_set('mysqli.default_host', 'p:');
-               $link = mysqli_init();
-               if (@mysqli_real_connect($link)) {
-                       printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
-                       mysqli_close($link);
-               }
-               @mysqli_close($link);
-       }
-
-       if (false !== ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
-               printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
-
-       print "done!";
+    include("connect.inc");
+
+    $tmp    = NULL;
+    $link   = NULL;
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link)))
+        printf("[001a] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link)))
+        printf("[001b] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link)))
+        printf("[001c] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link)))
+        printf("[001d] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link)))
+        printf("[001e] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link)))
+        printf("[001f] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link)))
+        printf("[001g] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    //  ( mysqli link [, string hostname [, string username [, string passwd [, string dbname [, int port [, string socket [, int flags]]]]]]]
+    if (NULL !== ($tmp = @mysqli_real_connect($link, $link, $link, $link, $link, $link, $link, $link)))
+        printf("[001] Expecting NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    if (!$link = mysqli_init())
+        printf("[002] mysqli_init() failed\n");
+
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+
+    mysqli_close($link);
+    if (!$link = mysqli_init())
+        printf("[004] mysqli_init() failed\n");
+
+    if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
+        printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
+
+    // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+    ini_set('mysqli.default_socket', $socket);
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
+        printf("[006] Usage of mysqli.default_socket failed\n");
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[007] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_port', $port);
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
+        printf("[008] Usage of mysqli.default_port failed\n");
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[009] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_pw', $passwd);
+    if (!mysqli_real_connect($link, $host, $user)) {
+        printf("[010] Usage of mysqli.default_pw failed\n") ;
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[011] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_user', $user);
+    if (!mysqli_real_connect($link, $host)) {
+        printf("[012] Usage of mysqli.default_user failed\n") ;
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[011] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_host', $host);
+    if (!mysqli_real_connect($link)) {
+        printf("[014] Usage of mysqli.default_host failed\n") ;
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[015] mysqli_init() failed\n");
+    }
+
+    // CLIENT_MULTI_STATEMENTS - should be disabled silently
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
+        printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
+        printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
+        var_dump($res->num_rows);
+        mysqli_next_result($link);
+        $res = mysqli_store_result($link);
+        var_dump($res->num_rows);
+    }
+
+
+    mysqli_close($link);
+    if (!$link = mysqli_init())
+        printf("[018] mysqli_init() failed\n");
+
+    if (ini_get('open_basedir')) {
+        // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
+
+        if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
+            printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+        $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
+        if (!$fp = fopen($filename, 'w'))
+            printf("[020] Cannot open temporary file %s\n", $filename);
+
+        fwrite($fp, '100;z');
+        fclose($fp);
+
+        // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
+        if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
+            printf("[021] LOAD DATA INFILE should have been forbidden!\n");
+
+        unlink($filename);
+    }
+
+    mysqli_close($link);
+    var_dump($link);
+
+    if ($IS_MYSQLND) {
+        ini_set('mysqli.default_host', 'p:' . $host);
+        $link = mysqli_init();
+        if (!@mysqli_real_connect($link)) {
+            printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
+        } else {
+            if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
+                printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+            $tmp = mysqli_fetch_assoc($res);
+            if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
+                printf("[024] Result looks strange - check manually, [%d] %s\n",
+                    mysqli_errno($link), mysqli_error($link));
+                var_dump($tmp);
+            }
+            mysqli_free_result($res);
+            mysqli_close($link);
+        }
+
+        ini_set('mysqli.default_host', 'p:');
+        $link = mysqli_init();
+        if (@mysqli_real_connect($link)) {
+            printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
+            mysqli_close($link);
+        }
+        @mysqli_close($link);
+    }
+
+    if (false !== ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+        printf("[026] Expecting false, got %s/%s\n", gettype($tmp), $tmp);
+
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 0d1c4985f2db97716e7c1fb3c9c96991441bd859..4c1bfc58faa58db67cc0df096f4a1343857315c2 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only test");
+    die("skip mysqlnd only test");
 ?>
 --INI--
 mysqli.allow_local_infile=1
@@ -15,137 +15,137 @@ mysqli.allow_persistent=1
 mysqli.max_persistent=10
 --FILE--
 <?php
-       require_once("connect.inc");
-       $host = 'p:' . $host;
-
-       if (!$link = mysqli_init())
-               printf("[002] mysqli_init() failed\n");
-
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
-               printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-
-       mysqli_close($link);
-       if (!$link = mysqli_init())
-               printf("[004] mysqli_init() failed\n");
-
-       if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
-               printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
-
-       // Run the following tests without an anoynmous MySQL user and use a password for the test user!
-       ini_set('mysqli.default_socket', $socket);
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
-               printf("[006] Usage of mysqli.default_socket failed\n");
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[007] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_port', $port);
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
-               printf("[008] Usage of mysqli.default_port failed\n");
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[009] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_pw', $passwd);
-       if (!mysqli_real_connect($link, $host, $user)) {
-               printf("[010] Usage of mysqli.default_pw failed\n") ;
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[011] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_user', $user);
-       if (!mysqli_real_connect($link, $host)) {
-               printf("[012] Usage of mysqli.default_user failed\n") ;
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[011] mysqli_init() failed\n");
-       }
-
-       ini_set('mysqli.default_host', $host);
-       if (!mysqli_real_connect($link)) {
-               printf("[014] Usage of mysqli.default_host failed\n") ;
-       } else {
-               mysqli_close($link);
-               if (!$link = mysqli_init())
-                       printf("[015] mysqli_init() failed\n");
-       }
-
-       // CLIENT_MULTI_STATEMENTS - should be disabled silently
-       if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
-               printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
-               printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
-               var_dump($res->num_rows);
-               mysqli_next_result($link);
-               $res = mysqli_store_result($link);
-               var_dump($res->num_rows);
-       }
-
-
-       mysqli_close($link);
-       if (!$link = mysqli_init())
-               printf("[018] mysqli_init() failed\n");
-
-       if (ini_get('open_basedir')) {
-               // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
-
-               if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
-                       printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-               $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
-               if (!$fp = fopen($filename, 'w'))
-                       printf("[020] Cannot open temporary file %s\n", $filename);
-
-               fwrite($fp, '100;z');
-               fclose($fp);
-
-               // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
-               if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
-                       printf("[021] LOAD DATA INFILE should have been forbidden!\n");
-
-               unlink($filename);
-       }
-
-       mysqli_close($link);
-
-       if ($IS_MYSQLND) {
-               $link = mysqli_init();
-               if (!@mysqli_real_connect($link)) {
-                       printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
-               } else {
-                       if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
-                               printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                       $tmp = mysqli_fetch_assoc($res);
-                       if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
-                               printf("[024] Result looks strange - check manually, [%d] %s\n",
-                                       mysqli_errno($link), mysqli_error($link));
-                               var_dump($tmp);
-                       }
-                       mysqli_free_result($res);
-                       mysqli_close($link);
-               }
-
-               ini_set('mysqli.default_host', 'p:');
-               $link = mysqli_init();
-               if (@mysqli_real_connect($link)) {
-                       printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
-                       mysqli_close($link);
-               }
-       }
-
-       if (NULL === ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
-               printf("[026] Expecting not NULL, got %s/%s\n", gettype($tmp), $tmp);
-
-       print "done!";
+    require_once("connect.inc");
+    $host = 'p:' . $host;
+
+    if (!$link = mysqli_init())
+        printf("[002] mysqli_init() failed\n");
+
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket))
+        printf("[003] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+
+    mysqli_close($link);
+    if (!$link = mysqli_init())
+        printf("[004] mysqli_init() failed\n");
+
+    if (false !== ($tmp = mysqli_real_connect($link, $host, $user . 'unknown_really', $passwd . 'non_empty', $db, $port, $socket)))
+        printf("[005] Expecting boolean/false got %s/%s. Can connect to the server using host=%s, user=%s, passwd=***non_empty, dbname=%s, port=%s, socket=%s\n", gettype($tmp), $tmp, $host, $user . 'unknown_really', $db, $port, $socket);
+
+    // Run the following tests without an anoynmous MySQL user and use a password for the test user!
+    ini_set('mysqli.default_socket', $socket);
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port)) {
+        printf("[006] Usage of mysqli.default_socket failed\n");
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[007] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_port', $port);
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db)) {
+        printf("[008] Usage of mysqli.default_port failed\n");
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[009] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_pw', $passwd);
+    if (!mysqli_real_connect($link, $host, $user)) {
+        printf("[010] Usage of mysqli.default_pw failed\n") ;
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[011] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_user', $user);
+    if (!mysqli_real_connect($link, $host)) {
+        printf("[012] Usage of mysqli.default_user failed\n") ;
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[011] mysqli_init() failed\n");
+    }
+
+    ini_set('mysqli.default_host', $host);
+    if (!mysqli_real_connect($link)) {
+        printf("[014] Usage of mysqli.default_host failed\n") ;
+    } else {
+        mysqli_close($link);
+        if (!$link = mysqli_init())
+            printf("[015] mysqli_init() failed\n");
+    }
+
+    // CLIENT_MULTI_STATEMENTS - should be disabled silently
+    if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 65536))
+        printf("[016] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if ($res = mysqli_query($link, "SELECT 1 AS a; SELECT 2 AS b")) {
+        printf("[017] Should have failed. CLIENT_MULTI_STATEMENT should have been disabled.\n");
+        var_dump($res->num_rows);
+        mysqli_next_result($link);
+        $res = mysqli_store_result($link);
+        var_dump($res->num_rows);
+    }
+
+
+    mysqli_close($link);
+    if (!$link = mysqli_init())
+        printf("[018] mysqli_init() failed\n");
+
+    if (ini_get('open_basedir')) {
+        // CLIENT_LOCAL_FILES should be blocked - but how to test it ?!
+
+        if (!mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, 128))
+            printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+        $filename = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'mysqli_real_connect_phpt';
+        if (!$fp = fopen($filename, 'w'))
+            printf("[020] Cannot open temporary file %s\n", $filename);
+
+        fwrite($fp, '100;z');
+        fclose($fp);
+
+        // how do we test if gets forbidden because of a missing right or the flag, this test is partly bogus ?
+        if (mysqli_query($link, "LOAD DATA LOCAL INFILE '$filename' INTO TABLE test FIELDS TERMINATED BY ';'"))
+            printf("[021] LOAD DATA INFILE should have been forbidden!\n");
+
+        unlink($filename);
+    }
+
+    mysqli_close($link);
+
+    if ($IS_MYSQLND) {
+        $link = mysqli_init();
+        if (!@mysqli_real_connect($link)) {
+            printf("[022] Usage of mysqli.default_host=p:%s (persistent) failed\n", $host) ;
+        } else {
+            if (!$res = mysqli_query($link, "SELECT 'mysqli.default_host (persistent)' AS 'testing'"))
+                printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+            $tmp = mysqli_fetch_assoc($res);
+            if ($tmp['testing'] !== 'mysqli.default_host (persistent)') {
+                printf("[024] Result looks strange - check manually, [%d] %s\n",
+                    mysqli_errno($link), mysqli_error($link));
+                var_dump($tmp);
+            }
+            mysqli_free_result($res);
+            mysqli_close($link);
+        }
+
+        ini_set('mysqli.default_host', 'p:');
+        $link = mysqli_init();
+        if (@mysqli_real_connect($link)) {
+            printf("[025] Usage of mysqli.default_host=p: did not fail\n") ;
+            mysqli_close($link);
+        }
+    }
+
+    if (NULL === ($tmp = mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket)))
+        printf("[026] Expecting not NULL, got %s/%s\n", gettype($tmp), $tmp);
+
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 20384d9a0f00b133d7a937d8d0511f060d1e22cf..71707510d117a4a6d6cb8e83c462cb0521e0c33c 100644 (file)
@@ -9,11 +9,11 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
-               mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
+        mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (!mysqli_set_charset($link, 'big5'))
-       die(sprintf("skip Cannot set charset 'big5'"));
+    die(sprintf("skip Cannot set charset 'big5'"));
 mysqli_close($link);
 ?>
 --FILE--
@@ -72,7 +72,7 @@ mysqli_error($link));
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 bool(true)
index 14bf97c6358c3e6d1be5c70c39514b1086fbb526..a93405e862811a88bd254a904adb682e2f724fac 100644 (file)
@@ -9,11 +9,11 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
-               mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
+        mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (!mysqli_set_charset($link, 'eucjpms'))
-       die(sprintf("skip Cannot set charset 'eucjpms'"));
+    die(sprintf("skip Cannot set charset 'eucjpms'"));
 mysqli_close($link);
 ?>
 --FILE--
@@ -65,7 +65,7 @@ mysqli_error($link));
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 bool(true)
index cff45e06d4c207cd88b3e305fda5f3a8c72b4135..97c6161b2565db44dbe80889b0a200b94476a1ec 100644 (file)
@@ -9,11 +9,11 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
-               mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
+        mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (!mysqli_set_charset($link, 'euckr'))
-       die(sprintf("skip Cannot set charset 'euckr'"));
+    die(sprintf("skip Cannot set charset 'euckr'"));
 mysqli_close($link);
 ?>
 --FILE--
@@ -64,7 +64,7 @@ mysqli_error($link));
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 bool(true)
index 537ac7292f01d04fb4b4d0ed20d25314f1eac3b5..2b46fa6f8cfff73253d5532d03c9174966b4a284 100644 (file)
@@ -9,11 +9,11 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
-               mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
+        mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (!mysqli_set_charset($link, 'gb2312'))
-       die(sprintf("skip Cannot set charset 'gb2312'"));
+    die(sprintf("skip Cannot set charset 'gb2312'"));
 mysqli_close($link);
 ?>
 --FILE--
@@ -65,7 +65,7 @@ mysqli_error($link));
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 bool(true)
index 85ac847666be6a1d3bf83ce6b2fe3af0d8137b6a..510621aea84316842f2b675072dda4a43d4f2a07 100644 (file)
@@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
-               mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
+        mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (!mysqli_set_charset($link, 'gbk'))
-       die(sprintf("skip Cannot set charset 'gbk'"));
+    die(sprintf("skip Cannot set charset 'gbk'"));
 
 mysqli_close($link);
 ?>
@@ -65,7 +65,7 @@ mysqli_error($link));
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 bool(true)
index 9e1562dba0e9edf43f15c540d7be74e33e3d1895..4ab50b8311351d42b8714d5ecd9f07bf10e3254c 100644 (file)
@@ -8,11 +8,11 @@ require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 
 if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
-               mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect to MySQL, [%d] %s\n",
+        mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (!mysqli_set_charset($link, 'sjis'))
-       die(sprintf("skip Cannot set charset 'sjis'"));
+    die(sprintf("skip Cannot set charset 'sjis'"));
 mysqli_close($link);
 ?>
 --FILE--
index b3465ad2b10e855f6e723494a9768aa53bec6cb8..be21cae80b57fcd7301c880064de496bbb258027 100644 (file)
@@ -81,7 +81,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_real_escape_string(): Couldn't fetch mysqli in %s on line %d
index 9b99435d420b260ae3baab5e68b6e12f81ceaff8..a8deec7833477f10f65814f83f22864c57bd3637 100644 (file)
@@ -96,7 +96,7 @@ if (!$link = mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 @mysqli_query($link, "DROP PROCEDURE IF EXISTS p");
 @mysqli_query($link, "DROP FUNCTION IF EXISTS f");
index 745323c0cef7b98623d952104a2c34a240a02766..63afa87654cd7067e0ec73b8ed086d9c0a36695f 100644 (file)
@@ -8,7 +8,7 @@ require_once('connect.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$IS_MYSQLND)
-       die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
+    die("skip mysqlnd only feature, compile PHP using --with-mysqli=mysqlnd");
 ?>
 --FILE--
 <?php
index 606d38028522fd7a833cf8c39dbbaafe8a37da29..44ee4cdd4d10eab4420ea77a784ef8131655fdef 100644 (file)
@@ -6,125 +6,125 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (stristr(mysqli_get_client_info(), 'mysqlnd'))
-       die("skip: test for libmysql");
+    die("skip: test for libmysql");
 ?>
 --INI--
 mysqli.reconnect=1
 --FILE--
 <?php
-       require_once("connect.inc");
-       require_once("table.inc");
+    require_once("connect.inc");
+    require_once("table.inc");
 
-       if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot create second database connection, [%d] %s\n",
-                       mysqli_connect_errno(), mysqli_connect_error());
+    if (!$link2 = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot create second database connection, [%d] %s\n",
+            mysqli_connect_errno(), mysqli_connect_error());
 
-       $thread_id_timeout = mysqli_thread_id($link);
-       $thread_id_control = mysqli_thread_id($link2);
+    $thread_id_timeout = mysqli_thread_id($link);
+    $thread_id_control = mysqli_thread_id($link2);
 
-       if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
-               printf("[002] Cannot get full processlist, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (!isset($running_threads[$thread_id_timeout]) ||
-                       !isset($running_threads[$thread_id_control]))
-               printf("[003] Processlist is borked, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
-               printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
-               printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[006] Cannot get wait_timeout, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-       mysqli_free_result($res);
-
-       if ($row['Value'] != 2)
-               printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       // after 2+ seconds the server should kill the connection
-       sleep(3);
-
-       if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
-               printf("[008] Cannot get full processlist, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (isset($running_threads[$thread_id_timeout]))
-               printf("[009] Server should have killed the timeout connection, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       if (true !== mysqli_ping($link))
-               printf("[010] Reconnect should have happened");
-
-       if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
-               printf("[011] Cannot get database name, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[012] Cannot get database name, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       mysqli_free_result($res);
-       if ($row['_dbname'] != $db)
-               printf("[013] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
-                       $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
-
-       // ... and now we try KILL
-       $thread_id_timeout = mysqli_thread_id($link);
-
-       if (!mysqli_query($link2, sprintf('KILL %d', $thread_id_timeout)))
-               printf("[014] Cannot KILL timeout connection, [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
-       // Give the server a second to really kill the other thread...
-       sleep(1);
-
-       if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
-               printf("[015] Cannot get full processlist, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       $running_threads = array();
-       while ($row = mysqli_fetch_assoc($res))
-               $running_threads[$row['Id']] = $row;
-       mysqli_free_result($res);
-
-       if (isset($running_threads[$thread_id_timeout]) ||
-                       !isset($running_threads[$thread_id_control]))
-               printf("[016] Processlist is borked, [%d] %s\n",
-                       mysqli_errno($link2), mysqli_error($link));
-
-       if (true !== ($tmp = mysqli_ping($link)))
-               printf("[017] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
-
-       if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
-               printf("[018] Cannot get database name, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       if (!$row = mysqli_fetch_assoc($res))
-               printf("[019] Cannot get database name, [%d] %s\n",
-                       mysqli_errno($link), mysqli_error($link));
-
-       mysqli_free_result($res);
-       if ($row['_dbname'] != $db)
-               printf("[020] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
-                       $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
-
-       mysqli_close($link);
-       mysqli_close($link2);
-       print "done!";
+    if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+        printf("[002] Cannot get full processlist, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (!isset($running_threads[$thread_id_timeout]) ||
+            !isset($running_threads[$thread_id_control]))
+        printf("[003] Processlist is borked, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    if (!mysqli_query($link, "SET SESSION wait_timeout = 2"))
+        printf("[004] Cannot set wait_timeout, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!$res = mysqli_query($link, "SHOW VARIABLES LIKE 'wait_timeout'"))
+        printf("[005] Cannot check if wait_timeout has been set, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[006] Cannot get wait_timeout, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+    mysqli_free_result($res);
+
+    if ($row['Value'] != 2)
+        printf("[007] Failed setting the wait_timeout, test will not work, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    // after 2+ seconds the server should kill the connection
+    sleep(3);
+
+    if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+        printf("[008] Cannot get full processlist, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (isset($running_threads[$thread_id_timeout]))
+        printf("[009] Server should have killed the timeout connection, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    if (true !== mysqli_ping($link))
+        printf("[010] Reconnect should have happened");
+
+    if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
+        printf("[011] Cannot get database name, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[012] Cannot get database name, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    mysqli_free_result($res);
+    if ($row['_dbname'] != $db)
+        printf("[013] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
+            $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
+
+    // ... and now we try KILL
+    $thread_id_timeout = mysqli_thread_id($link);
+
+    if (!mysqli_query($link2, sprintf('KILL %d', $thread_id_timeout)))
+        printf("[014] Cannot KILL timeout connection, [%d] %s\n", mysqli_errno($link2), mysqli_error($link2));
+    // Give the server a second to really kill the other thread...
+    sleep(1);
+
+    if (!$res = mysqli_query($link2, "SHOW FULL PROCESSLIST"))
+        printf("[015] Cannot get full processlist, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    $running_threads = array();
+    while ($row = mysqli_fetch_assoc($res))
+        $running_threads[$row['Id']] = $row;
+    mysqli_free_result($res);
+
+    if (isset($running_threads[$thread_id_timeout]) ||
+            !isset($running_threads[$thread_id_control]))
+        printf("[016] Processlist is borked, [%d] %s\n",
+            mysqli_errno($link2), mysqli_error($link));
+
+    if (true !== ($tmp = mysqli_ping($link)))
+        printf("[017] Expecting boolean/true got %s/%s\n", gettype($tmp), $tmp);
+
+    if (!$res = mysqli_query($link, "SELECT DATABASE() as _dbname"))
+        printf("[018] Cannot get database name, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    if (!$row = mysqli_fetch_assoc($res))
+        printf("[019] Cannot get database name, [%d] %s\n",
+            mysqli_errno($link), mysqli_error($link));
+
+    mysqli_free_result($res);
+    if ($row['_dbname'] != $db)
+        printf("[020] Connection should has been made to DB/Schema '%s', expecting '%s', [%d] %s\n",
+            $row['_dbname'], $db, mysqli_errno($link), mysqli_error($link));
+
+    mysqli_close($link);
+    mysqli_close($link2);
+    print "done!";
 ?>
 --EXPECT--
 done!
index 8f395ef6f81e3bba708cab26c7ae6f482dcd5153..af2f5740a16f3dc951d175e8e80d0023f034659d 100644 (file)
@@ -8,10 +8,10 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -73,7 +73,7 @@ if (!have_innodb($link))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_release_savepoint(): Savepoint name cannot be empty in %s on line %d
index 0717aaf73bee2c5a6c361591bd336da14e704935..2b8a22fc4b4b16c16f70e0780b3bf7f11d0d0329 100644 (file)
@@ -7,11 +7,11 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 
 if (mysqli_get_server_version($link) < 50600)
-       die("SKIP For MySQL >= 5.6.0");
+    die("SKIP For MySQL >= 5.6.0");
 
 ?>
 --FILE--
@@ -42,7 +42,7 @@ if (mysqli_get_server_version($link) < 50600)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_change_user(): (%d/%d): Access denied for user '%s'@'%s' (using password: %s) in %s on line %d
index 535efb1facacb5fe01ba022deaa06b29fb05b47c..9cd9254d737f4497659c005c7bbd901f749edaed 100644 (file)
@@ -7,11 +7,11 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("SKIP Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 
 if (mysqli_get_server_version($link) >= 50600)
-       die("SKIP For MySQL < 5.6.0");
+    die("SKIP For MySQL < 5.6.0");
 ?>
 --FILE--
 <?php
@@ -98,7 +98,7 @@ if (mysqli_get_server_version($link) >= 50600)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_multi_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 'BAR; FOO' at line 1 in %s on line %d
index 29ff65780cc5341f201216f3b061c0321a404d0e..7649973f9ab282e6fce28723329efc963f4db690 100644 (file)
@@ -23,7 +23,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_result::__construct(): Invalid value for resultmode in %s on line %d
index d4fe48816a511ed8b7b27189324fcacfdc657d7c..dce3930fe5458ac1a62baf5c46bb36a5b1822f9c 100644 (file)
@@ -78,7 +78,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 array(7) refcount(2){
index 1a8f44b3f35d6679204be200fbcac3300051a226..85a3699175656ad4c662ea9a548b0e2e26868d29 100644 (file)
@@ -8,7 +8,7 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$IS_MYSQLND)
-       die("skip Test for mysqlnd only");
+    die("skip Test for mysqlnd only");
 require_once('skipifemb.inc'); ?>
 --FILE--
 <?php
index 3a15ebbb791257075bee5adb9e8b67f421a2ea5a..c1db61830a070f0e7163311cb82b7c130ce35572 100644 (file)
@@ -2,16 +2,16 @@
 mysqli_rollback()
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       require_once('connect.inc');
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    require_once('connect.inc');
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
-       if (!have_innodb($link))
-               die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    if (!have_innodb($link))
+        die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -68,7 +68,7 @@ mysqli_rollback()
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_rollback(): Couldn't fetch mysqli in %s on line %d
index 866d96aa987693fb5556d95eaeac4885b9a41d8f..edf8d486013821a1b8350da92f703ce3bce96454 100644 (file)
@@ -8,10 +8,10 @@ require_once('skipifconnectfailure.inc');
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!have_innodb($link))
-       die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
+    die(sprintf("skip Needs InnoDB support, [%d] %s", $link->errno, $link->error));
 ?>
 --FILE--
 <?php
@@ -64,7 +64,7 @@ if (!have_innodb($link))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_savepoint(): Savepoint name cannot be empty in %s on line %d
index d07985c2b7ea2804b23596c0c61404734f7f4533..f03125bd2ff95644bde3dab18942f7be18457e6e 100644 (file)
@@ -6,11 +6,11 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_send_query')) {
-       die("skip mysqli_send_query() not available");
+    die("skip mysqli_send_query() not available");
 }
 require_once('connect.inc');
 if (!$TEST_EXPERIMENTAL)
-       die("skip - experimental (= unsupported) feature");
+    die("skip - experimental (= unsupported) feature");
 ?>
 --FILE--
 <?php
index df90333867573a7aed3e25ee4c6e35c2191dbbf3..b213d8e05a89502cdb335a62babd9e72cb20049f 100644 (file)
@@ -7,41 +7,41 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_set_charset'))
-       die("skip Function not available");
+    die("skip Function not available");
 
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-       die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf("skip Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
 
 if (!($res = mysqli_query($link, 'SELECT version() AS server_version')) ||
-               !($tmp = mysqli_fetch_assoc($res))) {
-       mysqli_close($link);
-       die(sprintf("skip Cannot check server version, [%d] %s\n",
-       mysqli_errno($link), mysqli_error($link)));
+        !($tmp = mysqli_fetch_assoc($res))) {
+    mysqli_close($link);
+    die(sprintf("skip Cannot check server version, [%d] %s\n",
+    mysqli_errno($link), mysqli_error($link)));
 }
 mysqli_free_result($res);
 $version = explode('.', $tmp['server_version']);
 if (empty($version)) {
-       mysqli_close($link);
-       die(sprintf("skip Cannot check server version, based on '%s'",
-               $tmp['server_version']));
+    mysqli_close($link);
+    die(sprintf("skip Cannot check server version, based on '%s'",
+        $tmp['server_version']));
 }
 
 if ($version[0] <= 4 && $version[1] < 1) {
-       mysqli_close($link);
-       die(sprintf("skip Requires MySQL Server 4.1+\n"));
+    mysqli_close($link);
+    die(sprintf("skip Requires MySQL Server 4.1+\n"));
 }
 
 if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STORE_RESULT)) &&
-               (mysqli_num_rows($res) == 1)) ||
-               (($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin2"', MYSQLI_STORE_RESULT)) &&
-               (mysqli_num_rows($res) == 1))
-               ) {
-       // ok, required latin1 or latin2 are available
-       mysqli_close($link);
+        (mysqli_num_rows($res) == 1)) ||
+        (($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin2"', MYSQLI_STORE_RESULT)) &&
+        (mysqli_num_rows($res) == 1))
+        ) {
+    // ok, required latin1 or latin2 are available
+    mysqli_close($link);
 } else {
-       die(sprintf("skip Requires character set latin1 or latin2\n"));
-       mysqli_close($link);
+    die(sprintf("skip Requires character set latin1 or latin2\n"));
+    mysqli_close($link);
 }
 ?>
 --FILE--
@@ -123,7 +123,7 @@ if ((($res = mysqli_query($link, 'SHOW CHARACTER SET LIKE "latin1"', MYSQLI_STOR
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_set_charset(): Couldn't fetch mysqli in %s on line %d
index b36291872eb6675063f1d8372f76fa09417ff0a7..bb2a9201b8d971f9ee3099beedbd674bfb6e0b82 100644 (file)
@@ -37,7 +37,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 NULL
index 8463cc58b8f3d4f801431c7ca97201155b6683f7..17274cc43045e9ee0e203c71580208c2e1b13bb8 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_ssl_set'))
-       die("skip function not available");
+    die("skip function not available");
 ?>
 --FILE--
 <?php
index 1e08f0dec369d11bf1fddbfba4b6b8ff8f381059..33f1b896c80920cdab0cc24af156ab70b25a639d 100644 (file)
@@ -243,7 +243,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 [009] [%d] (error message varies with the MySQL Server version, check the error code)
index 92937a15ce64f8cdd1ac5b16bdfeadd462c68e60..f2da9d190c098ad458525e5ef4e59961db15808d 100644 (file)
@@ -64,7 +64,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index b48df9d410f68f6997033fef92b8b54cf2800d7e..5cb6cd0ac2739a888b09e0e63f6b96295c66702f 100644 (file)
@@ -23,7 +23,7 @@ die("SKIP: prefetch isn't supported at the moment");
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index b3d60380cb4a517b52ca4c070f5cb7603c45e130..aa1319877543b854ffca0921ff9bded82c955075 100644 (file)
@@ -271,7 +271,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 5ad6f583e79d08d77f098f0791e434a78ec066e2..b42794485206226d01a8eada1b1bf8ce29f366e8 100644 (file)
@@ -44,7 +44,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index d2d825438e40f7f207369861b9294214bbe943bd..3b8b7f2bf2bd3f8c6f3e6ca9d4457f4ffcfd72e7 100644 (file)
@@ -387,7 +387,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_bind_param(): Number of elements in type definition string doesn't match number of bind variables in %s on line %d
index a8a18ace858f845b6b76473f0e355078f606283d..198f6e98ff53242a4412e4d2c81c2818ebe75853 100644 (file)
@@ -326,7 +326,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 Regular, procedural, using variables
index b8f209ef79cea38b000da912c50bce5117881adc..2c43621ff968193abeb1192504b93e31faa70af1 100644 (file)
@@ -64,7 +64,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Test 1:
index 0b054c4827bb243164e3dfa58845f19c8e45b236..efe86972d98f996d438c7f074b4142e8bfe42bef 100644 (file)
@@ -10,87 +10,87 @@ require_once('skipifconnectfailure.inc');
 memory_limit=256M
 --FILE--
 <?php
-       /*
-       The way we test the INSERT and data types overlaps with
-       the mysqli_stmt_bind_result test in large parts. There is only
-       one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
-       fetch the inserted values. This way we test
-       mysqli_query()/mysqli_fetch_assoc() for all possible data types
-       in this file and we test mysqli_stmt_bind_result() in the other
-       test -- therefore the "duplicate" makes some sense to me.
-       */
-       require_once("connect.inc");
+    /*
+    The way we test the INSERT and data types overlaps with
+    the mysqli_stmt_bind_result test in large parts. There is only
+    one difference. This test uses mysqli_query()/mysqli_fetch_assoc() to
+    fetch the inserted values. This way we test
+    mysqli_query()/mysqli_fetch_assoc() for all possible data types
+    in this file and we test mysqli_stmt_bind_result() in the other
+    test -- therefore the "duplicate" makes some sense to me.
+    */
+    require_once("connect.inc");
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-               exit(1);
-       }
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+        exit(1);
+    }
 
-       $cols = 2500;
+    $cols = 2500;
 
-       list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
-       if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
-               if (1227 == mysqli_errno($link)) {
-                       /* [1227] Access denied; you need the SUPER privilege for this operation */
-                       $cols = 10;
-               } else {
-                       $cols = 10;
-                       printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               }
-       }
-       mysqli_close($link);
+    list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
+    if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
+        if (1227 == mysqli_errno($link)) {
+            /* [1227] Access denied; you need the SUPER privilege for this operation */
+            $cols = 10;
+        } else {
+            $cols = 10;
+            printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        }
+    }
+    mysqli_close($link);
 
 
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-               exit(1);
-       }
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+        exit(1);
+    }
 
-       if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
-               printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               exit(1);
-       }
+    if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+        printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        exit(1);
+    }
 
-       $str = array();
-       for ($i = 1; $i <= $cols; $i++) {
-               $str[] ="a$i BLOB";
-       }
-       $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
-       if (mysqli_errno($link)) {
-               printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               die("");
-       }
-       $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
-       var_dump($stmt->id);
-       $s = str_repeat("a", 2 << 12);
-       $eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
-       for ($i = 1; $i < $cols; $i++) {
-               $eval_str.="\$s,";
-       }
-       $eval_str.="\$s";
-       $eval_str.=");";
-       eval($eval_str);
-       printf("executing\n");
-       if (!$stmt->execute()) {
-               printf("failed");
-               printf("Failed to execute: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-       } else {
-               var_dump(true);
-       }
+    $str = array();
+    for ($i = 1; $i <= $cols; $i++) {
+        $str[] ="a$i BLOB";
+    }
+    $link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
+    if (mysqli_errno($link)) {
+        printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        die("");
+    }
+    $stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
+    var_dump($stmt->id);
+    $s = str_repeat("a", 2 << 12);
+    $eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
+    for ($i = 1; $i < $cols; $i++) {
+        $eval_str.="\$s,";
+    }
+    $eval_str.="\$s";
+    $eval_str.=");";
+    eval($eval_str);
+    printf("executing\n");
+    if (!$stmt->execute()) {
+        printf("failed");
+        printf("Failed to execute: [%d] %s\n", mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+    } else {
+        var_dump(true);
+    }
 
-       mysqli_stmt_close($stmt);
+    mysqli_stmt_close($stmt);
 
 
-       if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
-               if (1227 != mysqli_errno($link))
-                       printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       }
+    if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
+        if (1227 != mysqli_errno($link))
+            printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    }
 
-       mysqli_close($link);
+    mysqli_close($link);
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index e7b581f815774a5de9aa48a5db07bd3b8788d8e3..28dcf71da110b6a6b945818015b2e43efd5545aa 100644 (file)
@@ -201,7 +201,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 72adfb04e7a3194957f380eb458a809d25f5a2da..13bf7d4ac9fec4541716848114f68cf23a551c37 100644 (file)
@@ -121,7 +121,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index dcd05e5f68fb4f68499a242e5653c7b6e9ad35a9..8a43c449a0d7e5f47c265c279950bab1423a849e 100644 (file)
@@ -315,7 +315,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_bind_result() expects at least 2 parameters, 1 given in %s on line %d
index 734d691c2829e15b4d947daa6b55039e1602b135..ee36837407af1801c6ea82106c48203d27ca1b9b 100644 (file)
@@ -153,7 +153,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 8cff6b14962371bfc299258e8d586c9c63d9a9f9..62a3e499aede92346efe98a5c43bf97f9d503ac7 100644 (file)
@@ -10,204 +10,204 @@ require_once('skipifconnectfailure.inc');
 memory_limit=83886080
 --FILE--
 <?php
-       require_once("connect.inc");
-
-       function create_table($link, $column, $min, $max, $engine, $offset) {
-
-               if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
-                       printf("[%03d] Cannot drop table test, [%d] %s\n",
-                               $offset,
-                               mysqli_errno($link), mysqli_error($link));
-                       return array();
-               }
-
-               $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
-                       $column, $engine);
-               if (!mysqli_query($link, $sql)) {
-                       printf("[%03d] Cannot create table test, [%d] %s\n",
-                               $offset + 1,
-                               mysqli_errno($link), mysqli_error($link));
-                       return array();
-               }
-
-               $values = array();
-               for ($i = 1; $i <= 100; $i++) {
-                       $col1 = mt_rand($min, $max);
-                       $values[$i] = $col1;
-                       $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
-                               $i, $col1);
-                       if (!mysqli_query($link, $sql)) {
-                               printf("[%03d] Cannot insert data, [%d] %s\n",
-                                       $offset + 2,
-                                       mysqli_errno($link), mysqli_error($link));
-                               return array();
-                       }
-               }
-
-               return $values;
-       }
-
-       function test_format($link, $format, $from, $order_by, $expected, $offset) {
-
-               if (!$stmt = mysqli_stmt_init($link)) {
-                       printf("[%03d] Cannot create PS, [%d] %s\n",
-                               $offset,
-                               mysqli_errno($link), mysqli_error($link));
-                       return false;
-               }
-
-               if ($order_by)
-                       $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
-               else
-                       $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
-
-               if (!mysqli_stmt_prepare($stmt, $sql)) {
-                       printf("[%03d] Cannot prepare PS, [%d] %s\n",
-                               $offset + 1,
-                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                       return false;
-               }
-
-               if (!mysqli_stmt_execute($stmt)) {
-                       printf("[%03d] Cannot execute PS, [%d] %s\n",
-                               $offset + 2,
-                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                       return false;
-               }
-
-               if (!mysqli_stmt_store_result($stmt)) {
-                       printf("[%03d] Cannot store result set, [%d] %s\n",
-                               $offset + 3,
-                               mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                       return false;
-               }
-
-               if (!is_array($expected)) {
-
-                       $result = null;
-                       if (!mysqli_stmt_bind_result($stmt, $result)) {
-                               printf("[%03d] Cannot bind result, [%d] %s\n",
-                                       $offset + 4,
-                                       mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                               return false;
-                       }
-
-                       if (!mysqli_stmt_fetch($stmt)) {
-                               printf("[%03d] Cannot fetch result,, [%d] %s\n",
-                                       $offset + 5,
-                                       mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                               return false;
-                       }
-
-                       if ($result !== $expected) {
-                               printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
-                                       $offset + 6,
-                                       gettype($expected), $expected,
-                                       gettype($result), $result,
-                                       $format, $sql);
-                       }
-
-               } else {
-
-                       $order_by_col = $result = null;
-                       if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
-                               printf("[%03d] Cannot bind result, [%d] %s\n",
-                                       $offset + 7,
-                                       mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
-                               return false;
-                       }
-
-                       foreach ($expected as $k => $v) {
-                               if (!mysqli_stmt_fetch($stmt)) {
-                                       break;
-                               }
-                               if ($result !== $v) {
-                                       printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
-                                               $offset + 8,
-                                               $k,
-                                               gettype($v), $v,
-                                               gettype($result), $result,
-                                               $order_by_col,
-                                               $format, $sql);
-                               }
-                       }
-
-               }
-
-               mysqli_stmt_free_result($stmt);
-               mysqli_stmt_close($stmt);
-
-               return true;
-       }
-
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
-               printf("[001] Cannot connect - [%d] %s\n",
-                       mysqli_connect_errno(),
-                       mysqli_connect_error());
-
-       /* select from dual - pseudo table */
-       test_format($link, 'FORMAT(1.01, 0)', 'DUAL', null, '1', 10);
-       test_format($link, 'FORMAT(1.23, 1)', 'DUAL', null, '1.2', 20);
-       test_format($link, 'FORMAT(1.23, 2)', 'DUAL', null, '1.23', 30);
-       test_format($link, 'FORMAT(1234.567, 3)', 'DUAL', null, '1,234.567', 40);
-       /* no typo! */
-       test_format($link, 'FORMAT(1234.567, 4)', 'DUAL', null, '1,234.5670', 50);
-
-       mysqli_close($link);
-       require_once('table.inc');
-
-       /* select from existing table */
-       test_format($link, 'FORMAT(id, 0)', 'test', null, '1', 60);
-       test_format($link, 'FORMAT(id + 0.1, 1)', 'test', null, '1.1', 70);
-       test_format($link, 'FORMAT(id + 0.01, 2)', 'test', null, '1.01', 80);
-
-       /* create new table and select from it */
-       $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 100);
-
-       $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 110);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
-
-       $expected = create_table($link, 'TINYINT', -128, 127, $engine, 130);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
-
-       $expected = create_table($link, 'SMALLINT UNSIGNED', 0, 65535, $engine, 150);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
-
-       $expected = create_table($link, 'MEDIUMINT', 0, 8388607, $engine, 170);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 180);
-
-       $expected = create_table($link, 'INT UNSIGNED', 0, 1000, $engine, 190);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 200);
-
-       $expected = create_table($link, 'BIGINT', -1000, 1000, $engine, 210);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 220);
-
-       $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 230);
-       foreach ($expected as $k => $v)
-               $expected[$k] = number_format(round($v), 0, '.', ',');
-       test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 240);
-
-       // http://bugs.php.net/bug.php?id=42378
-       if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
-               printf("[300] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       }
-
-       if (mysqli_query($link, "CREATE TABLE `test` (
+    require_once("connect.inc");
+
+    function create_table($link, $column, $min, $max, $engine, $offset) {
+
+        if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
+            printf("[%03d] Cannot drop table test, [%d] %s\n",
+                $offset,
+                mysqli_errno($link), mysqli_error($link));
+            return array();
+        }
+
+        $sql = sprintf("CREATE TABLE test(id INT AUTO_INCREMENT PRIMARY KEY, col1 %s) ENGINE=%s",
+            $column, $engine);
+        if (!mysqli_query($link, $sql)) {
+            printf("[%03d] Cannot create table test, [%d] %s\n",
+                $offset + 1,
+                mysqli_errno($link), mysqli_error($link));
+            return array();
+        }
+
+        $values = array();
+        for ($i = 1; $i <= 100; $i++) {
+            $col1 = mt_rand($min, $max);
+            $values[$i] = $col1;
+            $sql = sprintf("INSERT INTO test(id, col1) VALUES (%d, %f)",
+                $i, $col1);
+            if (!mysqli_query($link, $sql)) {
+                printf("[%03d] Cannot insert data, [%d] %s\n",
+                    $offset + 2,
+                    mysqli_errno($link), mysqli_error($link));
+                return array();
+            }
+        }
+
+        return $values;
+    }
+
+    function test_format($link, $format, $from, $order_by, $expected, $offset) {
+
+        if (!$stmt = mysqli_stmt_init($link)) {
+            printf("[%03d] Cannot create PS, [%d] %s\n",
+                $offset,
+                mysqli_errno($link), mysqli_error($link));
+            return false;
+        }
+
+        if ($order_by)
+            $sql = sprintf('SELECT %s AS _format FROM %s ORDER BY %s', $format, $from, $order_by);
+        else
+            $sql = sprintf('SELECT %s AS _format FROM %s', $format, $from);
+
+        if (!mysqli_stmt_prepare($stmt, $sql)) {
+            printf("[%03d] Cannot prepare PS, [%d] %s\n",
+                $offset + 1,
+                mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+            return false;
+        }
+
+        if (!mysqli_stmt_execute($stmt)) {
+            printf("[%03d] Cannot execute PS, [%d] %s\n",
+                $offset + 2,
+                mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+            return false;
+        }
+
+        if (!mysqli_stmt_store_result($stmt)) {
+            printf("[%03d] Cannot store result set, [%d] %s\n",
+                $offset + 3,
+                mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+            return false;
+        }
+
+        if (!is_array($expected)) {
+
+            $result = null;
+            if (!mysqli_stmt_bind_result($stmt, $result)) {
+                printf("[%03d] Cannot bind result, [%d] %s\n",
+                    $offset + 4,
+                    mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                return false;
+            }
+
+            if (!mysqli_stmt_fetch($stmt)) {
+                printf("[%03d] Cannot fetch result,, [%d] %s\n",
+                    $offset + 5,
+                    mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                return false;
+            }
+
+            if ($result !== $expected) {
+                printf("[%03d] Expecting %s/%s got %s/%s with %s - %s.\n",
+                    $offset + 6,
+                    gettype($expected), $expected,
+                    gettype($result), $result,
+                    $format, $sql);
+            }
+
+        } else {
+
+            $order_by_col = $result = null;
+            if (!mysqli_stmt_bind_result($stmt, $order_by_col, $result)) {
+                printf("[%03d] Cannot bind result, [%d] %s\n",
+                    $offset + 7,
+                    mysqli_stmt_errno($stmt), mysqli_stmt_error($stmt));
+                return false;
+            }
+
+            foreach ($expected as $k => $v) {
+                if (!mysqli_stmt_fetch($stmt)) {
+                    break;
+                }
+                if ($result !== $v) {
+                    printf("[%03d] Row %d - expecting %s/%s got %s/%s [%s] with %s - %s.\n",
+                        $offset + 8,
+                        $k,
+                        gettype($v), $v,
+                        gettype($result), $result,
+                        $order_by_col,
+                        $format, $sql);
+                }
+            }
+
+        }
+
+        mysqli_stmt_free_result($stmt);
+        mysqli_stmt_close($stmt);
+
+        return true;
+    }
+
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
+        printf("[001] Cannot connect - [%d] %s\n",
+            mysqli_connect_errno(),
+            mysqli_connect_error());
+
+    /* select from dual - pseudo table */
+    test_format($link, 'FORMAT(1.01, 0)', 'DUAL', null, '1', 10);
+    test_format($link, 'FORMAT(1.23, 1)', 'DUAL', null, '1.2', 20);
+    test_format($link, 'FORMAT(1.23, 2)', 'DUAL', null, '1.23', 30);
+    test_format($link, 'FORMAT(1234.567, 3)', 'DUAL', null, '1,234.567', 40);
+    /* no typo! */
+    test_format($link, 'FORMAT(1234.567, 4)', 'DUAL', null, '1,234.5670', 50);
+
+    mysqli_close($link);
+    require_once('table.inc');
+
+    /* select from existing table */
+    test_format($link, 'FORMAT(id, 0)', 'test', null, '1', 60);
+    test_format($link, 'FORMAT(id + 0.1, 1)', 'test', null, '1.1', 70);
+    test_format($link, 'FORMAT(id + 0.01, 2)', 'test', null, '1.01', 80);
+
+    /* create new table and select from it */
+    $expected = create_table($link, 'FLOAT', -10000, 10000, $engine, 90);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 100);
+
+    $expected = create_table($link, 'FLOAT UNSIGNED', 0, 10000, $engine, 110);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 120);
+
+    $expected = create_table($link, 'TINYINT', -128, 127, $engine, 130);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 140);
+
+    $expected = create_table($link, 'SMALLINT UNSIGNED', 0, 65535, $engine, 150);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 160);
+
+    $expected = create_table($link, 'MEDIUMINT', 0, 8388607, $engine, 170);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 180);
+
+    $expected = create_table($link, 'INT UNSIGNED', 0, 1000, $engine, 190);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 200);
+
+    $expected = create_table($link, 'BIGINT', -1000, 1000, $engine, 210);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 220);
+
+    $expected = create_table($link, 'DECIMAL(5,0)', -1000, 1000, $engine, 230);
+    foreach ($expected as $k => $v)
+        $expected[$k] = number_format(round($v), 0, '.', ',');
+    test_format($link, 'id AS order_by_col, FORMAT(col1, 0)', 'test', 'id', $expected, 240);
+
+    // http://bugs.php.net/bug.php?id=42378
+    if (!mysqli_query($link, "DROP TABLE IF EXISTS test")) {
+        printf("[300] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    }
+
+    if (mysqli_query($link, "CREATE TABLE `test` (
   `targetport` int(11) NOT NULL default '0',
   `sources` double(17,4) default NULL,
   `current_sources` double(17,4) default NULL,
@@ -222,116 +222,116 @@ memory_limit=83886080
   PRIMARY KEY  (`targetport`)
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1")) {
 
-               do {
-                       $values = array();
-                       for ($i = 0; $i < 200; $i++) {
-                               $current_targets = mt_rand(-100000, 100000) / 10;
-                               do {
-                                       $trend = (mt_rand(0, 3) > 1) ? (mt_rand(-10000, 10000) / 100) : 'NULL';
-                               } while (isset($values[$trend]));
-
-                               $sql = sprintf('INSERT INTO test(targetport, current_targets, maxreports, trend) VALUES (%d, %f, %s, %s)',
-                                       $i,
-                                       $current_targets,
-                                       (mt_rand(0, 1) > 0) ? mt_rand(0, 1000) : 'NULL',
-                                       $trend);
-                               if (!mysqli_query($link, $sql)) {
-                                       printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                                       break 2;
-                               }
-                               if ($current_targets > 0 && $trend !== 'NULL')
-                                       $values[$trend] = $i;
-                       }
-                       krsort($values);
-
-                       if (!$stmt = mysqli_stmt_init($link)) {
-                               printf("[302] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                               break;
-                       }
-
-                       if (!mysqli_stmt_prepare($stmt, 'SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
-                               printf("[303] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       if (!mysqli_stmt_execute($stmt)) {
-                               printf("[304] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       if (!mysqli_stmt_store_result($stmt)) {
-                               printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       $trend = $targetport = $format = null;
-                       if (!mysqli_stmt_bind_result($stmt, $trend, $targetport, $format)) {
-
-                               printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       foreach ($values as $exp_trend => $exp_targetport) {
-                               if (!mysqli_stmt_fetch($stmt)) {
-                                       break;
-                               }
-                               if ($targetport != $exp_targetport) {
-                                       printf("[306] Values fetched from MySQL seem to be wrong, check manually\n");
-                                       printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
-                               }
-                       }
-                       mysqli_stmt_free_result($stmt);
-                       mysqli_stmt_close($stmt);
-
-                       // same but OO interface
-                       if (!$stmt = mysqli_stmt_init($link)) {
-                               printf("[307] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                               break;
-                       }
-
-                       if (!$stmt->prepare('SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
-                               printf("[308] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       if (!$stmt->execute()) {
-                               printf("[309] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       if (!$stmt->store_result()) {
-                               printf("[310] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       $trend = $targetport = $format = null;
-                       if (!$stmt->bind_result($trend, $targetport, $format)) {
-
-                               printf("[311] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
-                               break;
-                       }
-
-                       foreach ($values as $exp_trend => $exp_targetport) {
-                               if (!$stmt->fetch()) {
-                                       break;
-                               }
-                               if ($targetport != $exp_targetport) {
-                                       printf("[312] Values fetched from MySQL seem to be wrong, check manually\n");
-                                       printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
-                               }
-                       }
-                       $stmt->free_result();
-                       $stmt->close();
-
-               } while (false);
-
-       } else {
-               var_dump(mysqli_error($link));
-       }
-
-
-       mysqli_close($link);
-       print "done!";
+        do {
+            $values = array();
+            for ($i = 0; $i < 200; $i++) {
+                $current_targets = mt_rand(-100000, 100000) / 10;
+                do {
+                    $trend = (mt_rand(0, 3) > 1) ? (mt_rand(-10000, 10000) / 100) : 'NULL';
+                } while (isset($values[$trend]));
+
+                $sql = sprintf('INSERT INTO test(targetport, current_targets, maxreports, trend) VALUES (%d, %f, %s, %s)',
+                    $i,
+                    $current_targets,
+                    (mt_rand(0, 1) > 0) ? mt_rand(0, 1000) : 'NULL',
+                    $trend);
+                if (!mysqli_query($link, $sql)) {
+                    printf("[301] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+                    break 2;
+                }
+                if ($current_targets > 0 && $trend !== 'NULL')
+                    $values[$trend] = $i;
+            }
+            krsort($values);
+
+            if (!$stmt = mysqli_stmt_init($link)) {
+                printf("[302] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+                break;
+            }
+
+            if (!mysqli_stmt_prepare($stmt, 'SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
+                printf("[303] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            if (!mysqli_stmt_execute($stmt)) {
+                printf("[304] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            if (!mysqli_stmt_store_result($stmt)) {
+                printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            $trend = $targetport = $format = null;
+            if (!mysqli_stmt_bind_result($stmt, $trend, $targetport, $format)) {
+
+                printf("[305] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            foreach ($values as $exp_trend => $exp_targetport) {
+                if (!mysqli_stmt_fetch($stmt)) {
+                    break;
+                }
+                if ($targetport != $exp_targetport) {
+                    printf("[306] Values fetched from MySQL seem to be wrong, check manually\n");
+                    printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
+                }
+            }
+            mysqli_stmt_free_result($stmt);
+            mysqli_stmt_close($stmt);
+
+            // same but OO interface
+            if (!$stmt = mysqli_stmt_init($link)) {
+                printf("[307] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+                break;
+            }
+
+            if (!$stmt->prepare('SELECT trend, targetport, FORMAT(trend, 2) FROM test WHERE current_targets > 0 AND trend IS NOT NULL ORDER BY trend DESC LIMIT 100')) {
+                printf("[308] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            if (!$stmt->execute()) {
+                printf("[309] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            if (!$stmt->store_result()) {
+                printf("[310] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            $trend = $targetport = $format = null;
+            if (!$stmt->bind_result($trend, $targetport, $format)) {
+
+                printf("[311] [%d] %s\n", mysqli_stmt_errno($link), mysqli_stmt_error($link));
+                break;
+            }
+
+            foreach ($values as $exp_trend => $exp_targetport) {
+                if (!$stmt->fetch()) {
+                    break;
+                }
+                if ($targetport != $exp_targetport) {
+                    printf("[312] Values fetched from MySQL seem to be wrong, check manually\n");
+                    printf("%s/%s - %s/%s - '%s'\n", $trend, $exp_trend, $targetport, $exp_targetport, $format);
+                }
+            }
+            $stmt->free_result();
+            $stmt->close();
+
+        } while (false);
+
+    } else {
+        var_dump(mysqli_error($link));
+    }
+
+
+    mysqli_close($link);
+    print "done!";
 ?>
 --CLEAN--
 <?php
index fec6a3f8dfd9bf215af440adf6f104bd18c6d174..4b122853339ba59e6dac7112e5700389cdc38071 100644 (file)
@@ -243,7 +243,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 plain vanilla...
index 11755b4aef92d9d41d7244862045d4b0200160fb..bc623de753828bbb36fd47c13788937e5b57d057 100644 (file)
@@ -91,7 +91,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 6ea64e815a19f1f6b68e7e290f6c4144ef0dc204..4bf67c253cc7b664e96c33f8b6b85ee1df16acef 100644 (file)
@@ -81,7 +81,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt
index f9224eef6258a0470d38849e1cd1a4651b03c0e2..4a5f99dac49eb304539fad74eb2657cf18ddd577 100644 (file)
@@ -83,7 +83,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_data_seek(): invalid object or resource mysqli_stmt
index 3a1c004c2e798028c4c4175e85f9d434c96629f3..5043364a66e30be4332747cb34ba9125f5030b3f 100644 (file)
@@ -61,7 +61,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS type_change"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 mysqli_close($link);
 ?>
index d98a98b87ab866b4ae72923eaf784cc4d4ff3011..ac992bd05825cdfd811a4978b0ff191689dc0de1 100644 (file)
@@ -61,7 +61,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_errno(): Couldn't fetch mysqli_stmt in %s on line %d
index ad8efef6028ee1099f8154759e5d032f8ece3802..9d22ddc877c69f44681c1252aa4cadbbd38512f2 100644 (file)
@@ -61,7 +61,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_error(): Couldn't fetch mysqli_stmt in %s on line %d
index d97111a6fdee3be8bc7f54f9724ba5bbb2bea497..f65781032107f053986904d1e4d4f61814911af1 100644 (file)
@@ -6,10 +6,10 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 40100) {
-       die(sprintf('skip Needs MySQL 4.1+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 4.1+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --FILE--
@@ -134,7 +134,7 @@ if (mysqli_get_server_version($link) <= 40100) {
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_execute(): invalid object or resource mysqli_stmt
index 6537b8d88b7824c321956d21b7717566355e2f87..5e421b078d7d541f7b418e7152ffb55e92febb20 100644 (file)
@@ -6,10 +6,10 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) <= 50000) {
-       die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.0+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --FILE--
@@ -188,7 +188,7 @@ if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
    printf("[c001] [%d] %s\n", mysqli_connect_errno(), mysqli_connect_error());
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test_bind_fetch"))
-       printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    printf("[c002] Cannot drop table, [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
 @mysqli_query($link, 'DROP PROCEDURE IF EXISTS p');
 
index aed04962f228fbb0f4ab35923a9303df733966c2..78483649c6835e9c5eb334793e616429b2f50fa2 100644 (file)
@@ -6,10 +6,10 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) < 50503) {
-       die(sprintf('skip Needs MySQL 5.5.3+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.5.3+, found version %d.', mysqli_get_server_version($link)));
 }
 ?>
 --FILE--
index 6ab270b8f4c9672aeac5a1724c294229c64d339e..52c551ffce072bd508ffe2693a7fc53e09f2318f 100644 (file)
@@ -6,14 +6,14 @@ require_once('skipif.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
+    die(sprintf('skip Cannot connect to MySQL, [%d] %s.', mysqli_connect_errno(), mysqli_connect_error()));
 }
 if (mysqli_get_server_version($link) < 50503) {
-       die(sprintf('skip Needs MySQL 5.5.3+, found version %d.', mysqli_get_server_version($link)));
+    die(sprintf('skip Needs MySQL 5.5.3+, found version %d.', mysqli_get_server_version($link)));
 }
 /*
 if ($IS_MYSQLND) {
-       die(sprintf("skip WHY ?!"));
+    die(sprintf("skip WHY ?!"));
 }
 */
 ?>
index 4b41c9213d7a4782673109791a710c2ac1d959cc..d1d5b5696580b1ded61384719a96c967de0feffb 100644 (file)
@@ -87,7 +87,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
index 495fcdce7d623deb303ab71a4590ecdc66ba6206..787f7eadd0f7abd213484e6046944fcfb00e9140 100644 (file)
@@ -2,17 +2,17 @@
 Fetching BIT column values using the PS API
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-       require_once('connect.inc');
-       require_once('table.inc');
-       if (mysqli_get_server_version($link) < 50003)
-               // b'001' syntax not supported before 5.0.3
-               die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
-       if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
-               // better don't trust libmysql before 5.0.3
-               die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+    require_once('connect.inc');
+    require_once('table.inc');
+    if (mysqli_get_server_version($link) < 50003)
+        // b'001' syntax not supported before 5.0.3
+        die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
+    if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
+        // better don't trust libmysql before 5.0.3
+        die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
 ?>
 --FILE--
 <?php
@@ -70,7 +70,7 @@ Fetching BIT column values using the PS API
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 14333e7665b5b66447dccf18e973b1705c2b20e1..47d0ac9355adba1fa7e480e2be0e17884bde6438 100644 (file)
@@ -48,7 +48,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 OK: 1
index f76d407ad03d6d2df16657b8c201913fbed749c9..be74f47ce41583282a6483923f004fe5317eda08 100644 (file)
@@ -2,12 +2,12 @@
 mysqli_stmt_fetch - geometry / spatial types
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       if (!defined("MYSQLI_TYPE_GEOMETRY"))
-               die("skip MYSQLI_TYPE_GEOMETRY not defined");
+    if (!defined("MYSQLI_TYPE_GEOMETRY"))
+        die("skip MYSQLI_TYPE_GEOMETRY not defined");
 ?>
 --FILE--
 <?php
@@ -136,7 +136,7 @@ mysqli_stmt_fetch - geometry / spatial types
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 847fe04a3b9bf3a7ab5a5b150e38e416dad586b9..9dfded6a312b0efa00f5a6c093c33eb793917a6d 100644 (file)
@@ -85,7 +85,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_field_count(): invalid object or resource mysqli_stmt
index 292905ab633733fc9d6ad5d6fedf03a708850e99..09016bf8a5aaaebdb80bd0eae579c2170b58d317 100644 (file)
@@ -76,7 +76,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_free_result(): invalid object or resource mysqli_stmt
index 3613865e20dcad354d004c3fe610b32a638f05b5..e4cf8f8cf6728931bffd1a83fd3be2fa5885f02d 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_stmt_get_result'))
-       die('skip mysqli_stmt_get_result not available');
+    die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -202,7 +202,7 @@ if (!function_exists('mysqli_stmt_get_result'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_fetch(): invalid object or resource mysqli_stmt
index 00ed7adee49e5c7e618b31ecb7a1a5bc26e93163..2d9339e032819e7b19265dc651fc5c9a76b38d32 100644 (file)
@@ -6,7 +6,7 @@ require_once('skipif.inc');
 require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 if (!function_exists('mysqli_stmt_get_result'))
-       die('skip mysqli_stmt_get_result not available');
+    die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -153,7 +153,7 @@ if (!function_exists('mysqli_stmt_get_result'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 array(2) {
index c7109063e72af574ef6d1a2a867de4796caf8541..b05d2abe5e9bda866c22eaf52e33812bbb95e240 100644 (file)
@@ -2,21 +2,21 @@
 Fetching BIT column values using the PS API
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
-
-       if (!function_exists('mysqli_stmt_get_result'))
-               die("skip mysqli_stmt_get_result() not available");
-
-       require_once('connect.inc');
-       require_once('table.inc');
-       if (mysqli_get_server_version($link) < 50003)
-               // b'001' syntax not supported before 5.0.3
-               die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
-       if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
-               // better don't trust libmysql before 5.0.3
-               die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
+
+    if (!function_exists('mysqli_stmt_get_result'))
+        die("skip mysqli_stmt_get_result() not available");
+
+    require_once('connect.inc');
+    require_once('table.inc');
+    if (mysqli_get_server_version($link) < 50003)
+        // b'001' syntax not supported before 5.0.3
+        die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
+    if (!$IS_MYSQLND && (mysqli_get_client_version() < 50003))
+        // better don't trust libmysql before 5.0.3
+        die("skip Syntax used for test not supported with MySQL Server before 5.0.3");
 ?>
 --FILE--
 <?php
@@ -127,7 +127,7 @@ Fetching BIT column values using the PS API
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 8508150f981e75fa039b391fb47929d57650ffdf..d44aaa6f899c194aa180340be91033894904241b 100644 (file)
@@ -2,12 +2,12 @@
 mysqli_stmt_get_result() - meta data, field_count()
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       if (!function_exists('mysqli_stmt_get_result'))
-               die('skip mysqli_stmt_get_result not available');
+    if (!function_exists('mysqli_stmt_get_result'))
+        die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -43,7 +43,7 @@ mysqli_stmt_get_result() - meta data, field_count()
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 2 2
index aeadc3b1d73d5c90c6920de9fb2e87c6508a4d1d..3e656aacbaab9ea4bec61657fc4f6b6b94fc0f9f 100644 (file)
@@ -2,15 +2,15 @@
 mysqli_stmt_get_result - geometry / spatial types
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       if (!function_exists('mysqli_stmt_get_result'))
-               die("skip mysqli_stmt_get_result() not available");
+    if (!function_exists('mysqli_stmt_get_result'))
+        die("skip mysqli_stmt_get_result() not available");
 
-       if (!defined("MYSQLI_TYPE_GEOMETRY"))
-               die("skip MYSQLI_TYPE_GEOMETRY not defined");
+    if (!defined("MYSQLI_TYPE_GEOMETRY"))
+        die("skip MYSQLI_TYPE_GEOMETRY not defined");
 ?>
 --FILE--
 <?php
@@ -138,7 +138,7 @@ mysqli_stmt_get_result - geometry / spatial types
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index febc659167110b475d1268ce9fd4f9ed4d359f68..d3afbba5619f49baecc8b3cf04fb9dfa662a88e8 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_stmt_get_result'))
-       die('skip mysqli_stmt_get_result not available');
+    die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -207,7 +207,7 @@ if (!function_exists('mysqli_stmt_get_result'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 array(2) {
index 5481db04f48279308e54228059bac2ef53bdf167..1486b1a9fc1cb73bdf2a3247a91c15d1bcc7d0de 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_stmt_get_result'))
-       die('skip mysqli_stmt_get_result not available');
+    die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -63,7 +63,7 @@ if (!function_exists('mysqli_stmt_get_result'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 object(stdClass)#%d (13) {
index 1cd2981ed28200cec04f10a9492e5e6ce3e100b4..b6f02d0f6cb9e7638d46ebc9b73f7e35d8d2ce59 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_stmt_get_result'))
-       die('skip mysqli_stmt_get_result not available');
+    die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -89,7 +89,7 @@ if (!function_exists('mysqli_stmt_get_result'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 51198523c9ed970b8b12066d8d1728d5724244fb..bc365c6ad5bc7923dfc932b529bf95149bffca60 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!function_exists('mysqli_stmt_get_result'))
-       die('skip mysqli_stmt_get_result not available');
+    die('skip mysqli_stmt_get_result not available');
 ?>
 --FILE--
 <?php
@@ -115,7 +115,7 @@ if (!function_exists('mysqli_stmt_get_result'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_result::data_seek() expects parameter 1 to be int, float given in %s on line %d
index 7d21558593890656aac148742ba907a6b346131c..bde61c370676159a9d17b82984687960dc3889a7 100644 (file)
@@ -2,12 +2,12 @@
 mysqli_stmt_get_result - data types
 --SKIPIF--
 <?php
-       require_once('skipif.inc');
-       require_once('skipifemb.inc');
-       require_once('skipifconnectfailure.inc');
+    require_once('skipif.inc');
+    require_once('skipifemb.inc');
+    require_once('skipifconnectfailure.inc');
 
-       if (!function_exists('mysqli_stmt_get_result'))
-               die("skip mysqli_stmt_get_result() not available");
+    if (!function_exists('mysqli_stmt_get_result'))
+        die("skip mysqli_stmt_get_result() not available");
 ?>
 --FILE--
 <?php
@@ -251,7 +251,7 @@ mysqli_stmt_get_result - data types
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 1ebe6d051f2133632a3fc146034ce7a666d48931..a4a046dc7ddc3608b66a65ad4f11279c13080058 100644 (file)
@@ -9,16 +9,16 @@ require_once('skipifconnectfailure.inc');
 require_once("connect.inc");
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       die(sprintf("skip Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket));
+    die(sprintf("skip Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket));
 }
 
 if (!mysqli_query($link, "DROP TABLE IF EXISTS test") ||
-       !mysqli_query($link, "CREATE TABLE test(id SMALLINT)"))
-       die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
+    !mysqli_query($link, "CREATE TABLE test(id SMALLINT)"))
+    die(sprintf("skip [%d] %s\n", $link->errno, $link->error));
 
 if (!@mysqli_query($link, "SET sql_mode=''") || !@mysqli_query($link, "INSERT INTO test(id) VALUES (100001)"))
-       die("skip Strict sql mode seems to be active. We won't get a warning to check for.");
+    die("skip Strict sql mode seems to be active. We won't get a warning to check for.");
 
 mysqli_query($link, "DROP TABLE IF EXISTS test");
 ?>
@@ -100,7 +100,7 @@ mysqli_query($link, "DROP TABLE IF EXISTS test");
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_get_warnings(): invalid object or resource mysqli_stmt
index b82a855dd2ba374c4d24f9471afced312b69c0cf..6ec1a4c0383da075fdda46a94c87f092873ed01c 100644 (file)
@@ -46,7 +46,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_close(): invalid object or resource mysqli_stmt
index e3ef9a25ec27f6f07c6e44f2fb300756dbf58580..f70cc1a171976395de5e77950be7a4efe86ae27c 100644 (file)
@@ -69,7 +69,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_insert_id(): Couldn't fetch mysqli_stmt in %s on line %d
index 23a8ad27a8698963c4c212a8e47de0275725afc2..084361ef1104b3357c73c8bb92a3ac20a45d57a4 100644 (file)
@@ -94,10 +94,10 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("connect.inc");
-       if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
-               printf("[001] [%d] %s\n", $link->error, $link->errno);
-       }
+    require_once("connect.inc");
+    if (!$link->query('DROP PROCEDURE IF EXISTS p123')) {
+        printf("[001] [%d] %s\n", $link->error, $link->errno);
+    }
 ?>
 --EXPECT--
 string(4) "pre:"
index 5355b3deb7e17710a44153372fe114636345098d..682ab7bc921c6066ebced712f601be7be255ffb2 100644 (file)
@@ -109,7 +109,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 run_tests.php don't fool me with your 'ungreedy' expression '.+?'!
index e847d165f605151613013a1a407a35c8062caa9f..f3c00645419db251d84da14bff16b7d0eda2d2e6 100644 (file)
@@ -62,7 +62,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_param_count(): invalid object or resource mysqli_stmt
index d0e38075d9e3f443ac32a5358b43af95492a4ac5..ff4fdd8c81f09e69b53d662011495e3ba760be94 100644 (file)
@@ -49,7 +49,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_prepare(): Couldn't fetch mysqli_stmt in %s on line %d
index b7ec4e3ed7427e25e113194902b37bc29e405b02..0a94491f477b595a886de9bcdc866af76e51c5fc 100644 (file)
@@ -101,7 +101,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_reset(): invalid object or resource mysqli_stmt
index 8f4e13ef394696a3efb9d9ff338ac7cafb41bc05..4b0551082a9682a872a046eb423b5020a63ea0cf 100644 (file)
@@ -95,7 +95,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_result_metadata(): invalid object or resource mysqli_stmt
index 7f858e02169339ab6d21800552e365a70daafdb4..fb285436d3f848c5990abeef6509c86d6c24558a 100644 (file)
@@ -226,7 +226,7 @@ die("skip Check again when the Klingons visit earth - http://bugs.mysql.com/bug.
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 1fc27455115a9440997e148cf5be6b84eb7b9619..8e6dfcaffa8691f5b4e9672cbf7b603a8df7582d 100644 (file)
@@ -128,7 +128,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_send_long_data(): Invalid parameter number in %s on line %d
index 38048894aff6dc6bc6cc2ce80ce05d02e03b14c6..10a6471d2baf0c3ca03dd6bb59b7294b528908e8 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (stristr(mysqli_get_client_info(), 'mysqlnd'))
-       die("skip: test for libmysql");
+    die("skip: test for libmysql");
 ?>
 --FILE--
 <?php
@@ -92,7 +92,7 @@ if (stristr(mysqli_get_client_info(), 'mysqlnd'))
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index fa26a3a45e6cea875bb1205419dbaa5ae02b187a..e64d66fa12529c1db5ac73e182e4a45d67a7bc9d 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 
 if (!stristr(mysqli_get_client_info(), 'mysqlnd'))
-       die("skip: warnings only available in mysqlnd");
+    die("skip: warnings only available in mysqlnd");
 ?>
 --FILE--
 <?php
@@ -97,7 +97,7 @@ Warning: mysqli_stmt_send_long_data(): There was an error while sending long dat
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index 1784106162808c73aef86dcc710a271ed7307a62..c684e3585adfc6c225c4e51a08052b5dee071cf5 100644 (file)
@@ -53,7 +53,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_stmt_sqlstate(): invalid object or resource mysqli_stmt
index 89b8ed3bf87cc3f4d01dcad8b03c7163efec1a9f..b563e886bfa8ac6d191f50b186fbe2e309b7a532 100644 (file)
@@ -84,7 +84,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECT--
 done!
index b87d147e380c2740f8e8492047b114b53cadf0db..2ac22ba767f7726d1b50a3184c38004d51cd2a35 100644 (file)
@@ -57,7 +57,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_store_result(): Couldn't fetch mysqli in %s on line %d
index 548b9719d272b6fd4d72a57cd144d6ac3a8b9313..31645b026c54f7d420a2ef31f4fa2eb09c260130 100644 (file)
@@ -10,28 +10,28 @@ require_once('skipifconnectfailure.inc');
 mysqlnd.debug="d:t:O,{TMP}/mysqlnd.trace"
 --FILE--
 <?php
-       require_once("connect.inc");
+    require_once("connect.inc");
 
-       $tmp    = NULL;
-       $link   = NULL;
+    $tmp    = NULL;
+    $link   = NULL;
 
 
-       require('table.inc');
+    require('table.inc');
 
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
-               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
 
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[004] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
 
-       if (true !== ($tmp = mysqli_data_seek($res, 2)))
-               printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
-                       gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+    if (true !== ($tmp = mysqli_data_seek($res, 2)))
+        printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+            gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
 
-       mysqli_free_result($res);
+    mysqli_free_result($res);
 
-       print "done!";
+    print "done!";
 ?>
 --CLEAN--
 <?php
index dbbb9c7bc852f86a34dea7b0abedf075010b1a4f..136e2c5d4d9a564ff5f77e6741b285ed0bc428ef 100644 (file)
@@ -16,183 +16,183 @@ mysqlnd.mempool_default_size=1
 mysqlnd.fetch_data_copy=0
 --FILE--
 <?php
-       require_once("connect.inc");
-
-       $tmp    = NULL;
-       $link   = NULL;
-
-       require('table.inc');
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
-               printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[004] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
-       if (true !== ($tmp = mysqli_data_seek($res, 2)))
-               printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
-                       gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
-       var_dump($res->fetch_assoc());
-
-       if (true !== ($tmp = mysqli_data_seek($res, 0)))
-               printf("[006] Expecting boolean/true, got %s/%s. [%d] %s\n",
-                       gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
-
-       while ($row = $res->fetch_assoc()) {
-               printf("id = %d, label = %s\n", $row['id'], $row['label']);
-       }
-
-       mysqli_free_result($res);
-       mysqli_close($link);
-
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-       }
-
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
-               printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[009] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+    require_once("connect.inc");
+
+    $tmp    = NULL;
+    $link   = NULL;
+
+    require('table.inc');
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+        printf("[003] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[004] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+    if (true !== ($tmp = mysqli_data_seek($res, 2)))
+        printf("[005] Expecting boolean/true, got %s/%s. [%d] %s\n",
+            gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+    var_dump($res->fetch_assoc());
+
+    if (true !== ($tmp = mysqli_data_seek($res, 0)))
+        printf("[006] Expecting boolean/true, got %s/%s. [%d] %s\n",
+            gettype($tmp), $tmp, mysqli_errno($link), mysqli_error($link));
+
+    while ($row = $res->fetch_assoc()) {
+        printf("id = %d, label = %s\n", $row['id'], $row['label']);
+    }
+
+    mysqli_free_result($res);
+    mysqli_close($link);
+
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[007] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+    }
+
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id"))
+        printf("[008] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[009] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
 
-       $no_result = 0;
-       for ($i = 0; $i < 1000; $i++) {
-               $idx = mt_rand(-100, 100);
-               if (true === @mysqli_data_seek($res, $idx)) {
-                       $row = $res->fetch_assoc();
-                       if (!isset($row['id']) || !isset($row['label'])) {
-                               printf("[010] Brute force seek %d returned %d\n", $idx, var_export($row, true));
-                       }
-               } else {
-                       $no_result++;
-               }
-       }
-       printf("No result: %d\n", $no_result);
-
-       /* implicit free, implicit store */
-       /* meta and fetch lengths code */
-       if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
-               printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       printf("Default\n");
-       var_dump(mysqli_fetch_lengths($res));
-       $fields = $res->fetch_fields();
-       while ($row = $res->fetch_assoc()) {
-               var_dump(mysqli_fetch_lengths($res));
-       }
-       var_dump(mysqli_fetch_lengths($res));
-
-       if (!$res = mysqli_real_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
-               printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[013] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
-       printf("Copy\n");
-       var_dump(mysqli_fetch_lengths($res));
-       $fields_copy = $res->fetch_fields();
-       while ($row = $res->fetch_assoc()) {
-               var_dump(mysqli_fetch_lengths($res));
-       }
-       var_dump(mysqli_fetch_lengths($res));
-
-       /* There's no need for in-depth testing here. If you want in-depth switch mysqlnd
-       globally to copy mode and run all the tests */
-       foreach ($fields as $k => $field_info) {
-               if ($fields_copy[$k] != $field_info) {
-                       printf("[014] Metadata seems to differ, dumping\n");
-                       var_dump($field_info);
-                       var_dump($fields_copy[$k]);
-               }
-       }
-
-       /* fetch all */
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
-               printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[016] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
-       foreach (mysqli_fetch_all($res, MYSQLI_ASSOC) as $row) {
-               printf("id = %d label = %s\n", $row['id'], $row['label']);
-       }
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
-               printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[018] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
-       /* provoke out of sync */
-       if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
-               printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       var_dump($res->fetch_assoc());
-
-       if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2"))
-               printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
-               printf("[021] Expecting object, got %s/%s. [%d] %s\n",
-                       gettype($res), $res, mysqli_errno($link), mysqli_error($link));
-
-       /* user conn killed, res associated with conn, fetch from res */
-       unset($link);
-       var_dump($res->fetch_assoc());
-
-
-       if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-               printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-                       $host, $user, $db, $port, $socket);
-       }
-
-       if (!$res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
-               printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-
-       mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
-
-       if (mysqli_get_server_version($link) > 50000) {
-               // let's try to play with stored procedures
-               mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
-               if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param;
+    $no_result = 0;
+    for ($i = 0; $i < 1000; $i++) {
+        $idx = mt_rand(-100, 100);
+        if (true === @mysqli_data_seek($res, $idx)) {
+            $row = $res->fetch_assoc();
+            if (!isset($row['id']) || !isset($row['label'])) {
+                printf("[010] Brute force seek %d returned %d\n", $idx, var_export($row, true));
+            }
+        } else {
+            $no_result++;
+        }
+    }
+    printf("No result: %d\n", $no_result);
+
+    /* implicit free, implicit store */
+    /* meta and fetch lengths code */
+    if (!$res = mysqli_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
+        printf("[011] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    printf("Default\n");
+    var_dump(mysqli_fetch_lengths($res));
+    $fields = $res->fetch_fields();
+    while ($row = $res->fetch_assoc()) {
+        var_dump(mysqli_fetch_lengths($res));
+    }
+    var_dump(mysqli_fetch_lengths($res));
+
+    if (!$res = mysqli_real_query($link, "SELECT CONCAT(id, id) AS _c, label FROM test ORDER BY id DESC LIMIT 2"))
+        printf("[012] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[013] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+    printf("Copy\n");
+    var_dump(mysqli_fetch_lengths($res));
+    $fields_copy = $res->fetch_fields();
+    while ($row = $res->fetch_assoc()) {
+        var_dump(mysqli_fetch_lengths($res));
+    }
+    var_dump(mysqli_fetch_lengths($res));
+
+    /* There's no need for in-depth testing here. If you want in-depth switch mysqlnd
+    globally to copy mode and run all the tests */
+    foreach ($fields as $k => $field_info) {
+        if ($fields_copy[$k] != $field_info) {
+            printf("[014] Metadata seems to differ, dumping\n");
+            var_dump($field_info);
+            var_dump($fields_copy[$k]);
+        }
+    }
+
+    /* fetch all */
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
+        printf("[015] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[016] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+    foreach (mysqli_fetch_all($res, MYSQLI_ASSOC) as $row) {
+        printf("id = %d label = %s\n", $row['id'], $row['label']);
+    }
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
+        printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[018] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+    /* provoke out of sync */
+    if (!mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id DESC LIMIT 2"))
+        printf("[019] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    var_dump($res->fetch_assoc());
+
+    if (!$res = mysqli_real_query($link, "SELECT id, label FROM test ORDER BY id ASC LIMIT 2"))
+        printf("[020] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    if (!is_object($res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA)))
+        printf("[021] Expecting object, got %s/%s. [%d] %s\n",
+            gettype($res), $res, mysqli_errno($link), mysqli_error($link));
+
+    /* user conn killed, res associated with conn, fetch from res */
+    unset($link);
+    var_dump($res->fetch_assoc());
+
+
+    if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
+        printf("[022] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+            $host, $user, $db, $port, $socket);
+    }
+
+    if (!$res = mysqli_real_query($link, "INSERT INTO test(id, label) VALUES (100, 'z')"))
+        printf("[023] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+
+    mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
+
+    if (mysqli_get_server_version($link) > 50000) {
+        // let's try to play with stored procedures
+        mysqli_real_query($link, 'DROP PROCEDURE IF EXISTS p');
+        if (mysqli_real_query($link, 'CREATE PROCEDURE p(OUT ver_param VARCHAR(25)) READS SQL DATA BEGIN SELECT id FROM test WHERE id >= 100 ORDER BY id; SELECT id + 1, label FROM test WHERE id > 0 AND id < 3 ORDER BY id; SELECT VERSION() INTO ver_param;
 END;')) {
-                       mysqli_multi_query($link, "CALL p(@version)");
-                       do {
-                               if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) {
-                                       printf("---\n");
-                                       var_dump($res->fetch_all());
-                                       $res->free();
-                               } else {
-                                       if ($link->errno) {
-                                               echo "Store failed: (" . $link->errno . ") " . $link->error;
-                                       }
-                               }
-                       } while ($link->more_results() && $link->next_result());
-                       mysqli_real_query($link, 'SELECT @version AS p_version');
-                       $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
-
-                       $tmp = mysqli_fetch_assoc($res);
-                       if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
-                               printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-                               var_dump($tmp);
-                       }
-
-                       mysqli_free_result($res);
-               } else {
-                               printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-               }
-       }
-
-       print "done!";
+            mysqli_multi_query($link, "CALL p(@version)");
+            do {
+                if ($res = $link->store_result(MYSQLI_STORE_RESULT_COPY_DATA)) {
+                    printf("---\n");
+                    var_dump($res->fetch_all());
+                    $res->free();
+                } else {
+                    if ($link->errno) {
+                        echo "Store failed: (" . $link->errno . ") " . $link->error;
+                    }
+                }
+            } while ($link->more_results() && $link->next_result());
+            mysqli_real_query($link, 'SELECT @version AS p_version');
+            $res = mysqli_store_result($link, MYSQLI_STORE_RESULT_COPY_DATA);
+
+            $tmp = mysqli_fetch_assoc($res);
+            if (!is_array($tmp) || empty($tmp) || !isset($tmp['p_version']) || ('' == $tmp['p_version'])) {
+                printf("[024] Expecting array [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+                var_dump($tmp);
+            }
+
+            mysqli_free_result($res);
+        } else {
+                printf("[025] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+        }
+    }
+
+    print "done!";
 ?>
 --CLEAN--
 <?php
index 4a71d60f41dfb444577996ce9da1f2d434158322..f8e6d7fa1bf664d9f413339a4676010ca760e01b 100644 (file)
@@ -37,7 +37,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_thread_id(): Couldn't fetch mysqli in %s on line %d
index 190cafa5d5c4318c7c726b1f736e81212289be6b..f61d51208ebc30d1e1f6ac649a201c8624f70b90 100644 (file)
@@ -57,7 +57,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_data_seek(): Function cannot be used with MYSQL_USE_RESULT in %s on line %d
index 9d59f26e521296071797f941cb3cf273c261b3b6..128373ae36fb40f5604b95892252a819d11f7429 100644 (file)
@@ -45,7 +45,7 @@ require_once('skipifconnectfailure.inc');
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Warning: mysqli_warning_count(): Couldn't fetch mysqli in %s on line %d
index 1079ac374b912ebf8c70b3f8d549a18d2c2f529d..3e63339140350dbeed14c65591fdc8758c69f895 100644 (file)
@@ -7,7 +7,7 @@ require_once('skipifemb.inc');
 require_once('skipifconnectfailure.inc');
 require_once('connect.inc');
 if (!$TEST_EXPERIMENTAL)
-       die("skip - experimental (= unsupported) feature");
+    die("skip - experimental (= unsupported) feature");
 ?>
 --FILE--
 <?php
@@ -35,7 +35,7 @@ if (!$TEST_EXPERIMENTAL)
 ?>
 --CLEAN--
 <?php
-       require_once("clean_table.inc");
+    require_once("clean_table.inc");
 ?>
 --EXPECTF--
 Fatal error: Trying to clone an uncloneable object of class mysqli_warning in %s on line %d
index 6648526ed05f5adbf03ef6aa4dae3461882f4a43..0e46c2afa93c732871f3eab6208cff3484fb1d41 100644 (file)
 <?php
-       function inspectClass($class) {
-
-               /* not used: public ReflectionClass[] getInterfaces()  */
-
-               printf("\nInspecting class '%s'\n", $class->getName());
-               printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no');
-               printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no');
-               printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no');
-               printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no');
-               printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no');
-               printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no');
-               printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no');
-               printf("Modifiers: '%d'\n", $class->getModifiers());
-               printf("Parent Class: '%s'\n", $class->getParentClass());
-               printf("Extension: '%s'\n", $class->getExtensionName());
-
-               if ($method = $class->getConstructor())
-                       inspectMethod($method);
-
-               if ($methods = $class->getMethods()) {
-                       $tmp = array();
-                       foreach ($methods as $method)
-                               $tmp[$method->getName()] = $method;
-
-                       ksort($tmp, SORT_STRING);
-                       foreach ($tmp as $method)
-                               inspectMethod($method);
-               }
-
-               if ($properties = $class->getProperties()) {
-                       $tmp = array();
-                       foreach ($properties as $prop)
-                               $tmp[$prop->getName()] = $prop;
-                       ksort($tmp, SORT_STRING);
-                       foreach ($tmp as $prop)
-                       inspectProperty($prop);
-               }
-
-
-               if ($properties = $class->getDefaultProperties()) {
-                       ksort($properties, SORT_STRING);
-                       foreach ($properties as $name => $v)
-                               printf("Default property '%s'\n", $name);
-               }
-
-               if ($properties = $class->getStaticProperties()) {
-                       ksort($properties, SORT_STRING);
-                       foreach ($properties as $name => $v)
-                               printf("Static property '%s'\n", $name);
-               }
-
-               if ($constants = $class->getConstants()) {
-                       ksort($constants, SORT_STRING);
-                       foreach ($constant as $name => $value)
-                               printf("Constant '%s' = '%s'\n", $name, $value);
-               }
-
-       }
-
-       function inspectProperty(&$prop) {
-
-               printf("\nInspecting property '%s'\n", $prop->getName());
-               printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no');
-               printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no');
-               printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no');
-               printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no');
-               printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no');
-               printf("Modifiers: %d\n", $prop->getModifiers());
-               // printf("Value\n"); var_export($prop->getValue());
-
-       }
-
-       function inspectMethod(&$method) {
-
-               printf("\nInspecting method '%s'\n", $method->getName());
-               printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no');
-               printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no');
-               printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no');
-               printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no');
-               printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no');
-               printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no');
-               printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no');
-               printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no');
-               printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no');
-               printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no');
-               printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no');
-               printf("Modifiers: %d\n", $method->getModifiers());
-               printf("Number of Parameters: %d\n", $method->getNumberOfParameters());
-               printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters());
-
-               if ($params = $method->getParameters()) {
-                       $tmp = array();
-                       foreach ($params as $k => $param)
-                               $tmp[$param->getName()] = $param;
+    function inspectClass($class) {
+
+        /* not used: public ReflectionClass[] getInterfaces()  */
+
+        printf("\nInspecting class '%s'\n", $class->getName());
+        printf("isInternal: %s\n", ($class->isInternal()) ? 'yes' : 'no');
+        printf("isUserDefined: %s\n", ($class->isUserDefined()) ? 'yes' : 'no');
+        printf("isInstantiable: %s\n", ($class->isInstantiable()) ? 'yes' : 'no');
+        printf("isInterface: %s\n", ($class->isInterface()) ? 'yes' : 'no');
+        printf("isAbstract: %s\n", ($class->isAbstract()) ? 'yes' : 'no');
+        printf("isFinal: %s\n", ($class->isFinal()) ? 'yes' : 'no');
+        printf("isIteratable: %s\n", ($class->isIterateable()) ? 'yes' : 'no');
+        printf("Modifiers: '%d'\n", $class->getModifiers());
+        printf("Parent Class: '%s'\n", $class->getParentClass());
+        printf("Extension: '%s'\n", $class->getExtensionName());
+
+        if ($method = $class->getConstructor())
+            inspectMethod($method);
+
+        if ($methods = $class->getMethods()) {
+            $tmp = array();
+            foreach ($methods as $method)
+                $tmp[$method->getName()] = $method;
+
+            ksort($tmp, SORT_STRING);
+            foreach ($tmp as $method)
+                inspectMethod($method);
+        }
+
+        if ($properties = $class->getProperties()) {
+            $tmp = array();
+            foreach ($properties as $prop)
+                $tmp[$prop->getName()] = $prop;
+            ksort($tmp, SORT_STRING);
+            foreach ($tmp as $prop)
+            inspectProperty($prop);
+        }
+
+
+        if ($properties = $class->getDefaultProperties()) {
+            ksort($properties, SORT_STRING);
+            foreach ($properties as $name => $v)
+                printf("Default property '%s'\n", $name);
+        }
+
+        if ($properties = $class->getStaticProperties()) {
+            ksort($properties, SORT_STRING);
+            foreach ($properties as $name => $v)
+                printf("Static property '%s'\n", $name);
+        }
+
+        if ($constants = $class->getConstants()) {
+            ksort($constants, SORT_STRING);
+            foreach ($constant as $name => $value)
+                printf("Constant '%s' = '%s'\n", $name, $value);
+        }
+
+    }
+
+    function inspectProperty(&$prop) {
+
+        printf("\nInspecting property '%s'\n", $prop->getName());
+        printf("isPublic: %s\n", ($prop->isPublic()) ? 'yes' : 'no');
+        printf("isPrivate: %s\n", ($prop->isPrivate()) ? 'yes' : 'no');
+        printf("isProtected: %s\n", ($prop->isProtected()) ? 'yes' : 'no');
+        printf("isStatic: %s\n", ($prop->isStatic()) ? 'yes' : 'no');
+        printf("isDefault: %s\n", ($prop->isDefault()) ? 'yes' : 'no');
+        printf("Modifiers: %d\n", $prop->getModifiers());
+        // printf("Value\n"); var_export($prop->getValue());
+
+    }
+
+    function inspectMethod(&$method) {
+
+        printf("\nInspecting method '%s'\n", $method->getName());
+        printf("isFinal: %s\n", ($method->isFinal()) ? 'yes' : 'no');
+        printf("isAbstract: %s\n", ($method->isAbstract()) ? 'yes' : 'no');
+        printf("isPublic: %s\n", ($method->isPublic()) ? 'yes' : 'no');
+        printf("isPrivate: %s\n", ($method->isPrivate()) ? 'yes' : 'no');
+        printf("isProtected: %s\n", ($method->isProtected()) ? 'yes' : 'no');
+        printf("isStatic: %s\n", ($method->isStatic()) ? 'yes' : 'no');
+        printf("isConstructor: %s\n", ($method->isConstructor()) ? 'yes' : 'no');
+        printf("isDestructor: %s\n", ($method->isDestructor()) ? 'yes' : 'no');
+        printf("isInternal: %s\n", ($method->isInternal()) ? 'yes' : 'no');
+        printf("isUserDefined: %s\n", ($method->isUserDefined()) ? 'yes' : 'no');
+        printf("returnsReference: %s\n", ($method->returnsReference()) ? 'yes' : 'no');
+        printf("Modifiers: %d\n", $method->getModifiers());
+        printf("Number of Parameters: %d\n", $method->getNumberOfParameters());
+        printf("Number of Required Parameters: %d\n", $method->getNumberOfRequiredParameters());
+
+        if ($params = $method->getParameters()) {
+            $tmp = array();
+            foreach ($params as $k => $param)
+                $tmp[$param->getName()] = $param;
 
 //                     ksort($tmp, SORT_STRING);
-                       foreach ($tmp as $param)
-                               inspectParameter($method, $param);
-               }
+            foreach ($tmp as $param)
+                inspectParameter($method, $param);
+        }
 
-               if ($static = $method->getStaticVariables()) {
-                       sort($static, SORT_STRING);
-                       printf("Static variables: %s\n", implode('/', $static));
-               }
+        if ($static = $method->getStaticVariables()) {
+            sort($static, SORT_STRING);
+            printf("Static variables: %s\n", implode('/', $static));
+        }
 
-       }
+    }
 
-       function inspectParameter(&$method, &$param) {
+    function inspectParameter(&$method, &$param) {
 
-               printf("\nInspecting parameter '%s' of method '%s'\n",
-               $param->getName(), $method->getName());
-               printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no');
-               printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no');
-               printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no');
-               printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no');
-               printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no');
-               // printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no');
+        printf("\nInspecting parameter '%s' of method '%s'\n",
+        $param->getName(), $method->getName());
+        printf("isArray: %s\n", ($param->isArray()) ? 'yes': 'no');
+        printf("allowsNull: %s\n", ($param->allowsNull()) ? 'yes' : 'no');
+        printf("isPassedByReference: %s\n", ($param->isPassedByReference()) ? 'yes' : 'no');
+        printf("isOptional: %s\n", ($param->isOptional()) ? 'yes' : 'no');
+        printf("isDefaultValueAvailable: %s\n", ($param->isDefaultValueAvailable()) ? 'yes' : 'no');
+        // printf("getDefaultValue: %s\n", ($param->getDefaultValue()) ? 'yes' : 'no');
 
-       }
+    }
 ?>
index 5562aab84ba0624b71c689c7bb7c4b52011a35d4..a5a5df14c266a4d1f11efede39095abadf63cc5c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
 if (!extension_loaded('mysqli')){
-       die('skip mysqli extension not available');
+    die('skip mysqli extension not available');
 }
 ?>
index 32a976357c0309e1b3bbcdfc381f2334a99ebb39..ccde567baa89184e2055f30283393d5be6566de7 100644 (file)
@@ -1,10 +1,10 @@
 <?php
 require_once('connect.inc');
 if ($skip_on_connect_failure) {
-       include_once('connect.inc');
-       $link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
-       if (!is_object($link))
-               die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
-       mysqli_close($link);
+    include_once('connect.inc');
+    $link = @my_mysqli_connect($host, $user, $passwd, $db, $port, $socket);
+    if (!is_object($link))
+        die(sprintf("skip Can't connect to MySQL Server - [%d] %s", mysqli_connect_errno(), mysqli_connect_error()));
+    mysqli_close($link);
 }
 ?>
index ad143a42a46907e24b96ba10914616f9d40ab75c..2b7941d8254c38d1b6db709564b08c4b6b680062 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-       $driver = new mysqli_driver();
-       if ($driver->embedded)
-               die("skip test doesn't run with embedded server");
+    $driver = new mysqli_driver();
+    if ($driver->embedded)
+        die("skip test doesn't run with embedded server");
 ?>
index fa5fb9f0a34aecccb064a6eb70278cc58d72d97a..e88e4238360cc06af9ae16d17157861fc3d70b5c 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-       $driver = new mysqli_driver();
-       if (!$driver->embedded)
-               die("skip test for with embedded server only");
+    $driver = new mysqli_driver();
+    if (!$driver->embedded)
+        die("skip test for with embedded server only");
 ?>
index e0d7a06c57feac91b38c41eaa27ff87197d13767..16b688f74b33f049866a3b3e9e4261f9757a1ba8 100644 (file)
@@ -2,27 +2,27 @@
 require_once('connect.inc');
 
 if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
-       printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
-               $host, $user, $db, $port, $socket);
-       exit(1);
+    printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
+        $host, $user, $db, $port, $socket);
+    exit(1);
 }
 
 if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
-       printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       exit(1);
+    printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    exit(1);
 }
 
 if (!mysqli_query($link, 'SET SESSION sql_mode=\'\'')) {
-       printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       exit(1);
+    printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    exit(1);
 }
 
 if (!mysqli_query($link, 'CREATE TABLE test(id INT DEFAULT 0, label CHAR(1), PRIMARY KEY(id)) ENGINE=' . $engine)) {
-       printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
-       exit(1);
+    printf("Failed to create test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
+    exit(1);
 }
 
 if (!mysqli_query($link, "INSERT INTO test(id, label) VALUES (1, 'a'), (2, 'b'), (3, 'c'), (4, 'd'), (5, 'e'), (6, 'f')")) {
-       printf("[%d] %s\n",  mysqli_errno($link), mysqli_error($link));
+    printf("[%d] %s\n",  mysqli_errno($link), mysqli_error($link));
 }
 ?>