mirror of
https://github.com/php/php-src.git
synced 2026-04-28 02:33:17 +02:00
Reindent ext/mysqli tests
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.
This commit is contained in:
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
+12
-12
@@ -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
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
+34
-34
@@ -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
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
+14
-14
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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--
|
||||
|
||||
+142
-142
@@ -10,175 +10,175 @@ require_once('skipifconnectfailure.inc');
|
||||
memory_limit=83886080
|
||||
--FILE--
|
||||
<?php
|
||||
require_once("connect.inc");
|
||||
require_once("connect.inc");
|
||||
|
||||
function create_table($link, $column, $min, $max, $engine, $offset) {
|
||||
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";
|
||||
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();
|
||||
}
|
||||
$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();
|
||||
}
|
||||
}
|
||||
$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;
|
||||
}
|
||||
return $values;
|
||||
}
|
||||
|
||||
function test_format($link, $format, $from, $order_by, $expected, $offset) {
|
||||
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 (!$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 ($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_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_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 (!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)) {
|
||||
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;
|
||||
}
|
||||
$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 (!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);
|
||||
}
|
||||
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 {
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
$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);
|
||||
}
|
||||
}
|
||||
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);
|
||||
mysqli_stmt_free_result($stmt);
|
||||
mysqli_stmt_close($stmt);
|
||||
|
||||
return true;
|
||||
}
|
||||
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());
|
||||
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);
|
||||
/* 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', -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, '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);
|
||||
$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!";
|
||||
mysqli_close($link);
|
||||
print "done!";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -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");
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECTF--
|
||||
[004] [%s
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -40,7 +40,7 @@ require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECT--
|
||||
done
|
||||
|
||||
@@ -48,7 +48,7 @@ require_once('skipifconnectfailure.inc');
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
|
||||
@@ -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");
|
||||
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());
|
||||
}
|
||||
$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, '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));
|
||||
}
|
||||
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);
|
||||
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 (!@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));
|
||||
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;
|
||||
}
|
||||
$rows = array();
|
||||
while ($row = mysqli_fetch_assoc($res)) {
|
||||
var_dump($row);
|
||||
$rows[] = $row;
|
||||
}
|
||||
|
||||
mysqli_free_result($res);
|
||||
mysqli_free_result($res);
|
||||
|
||||
mysqli_query($link, "DELETE FROM test");
|
||||
mysqli_close($link);
|
||||
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().
|
||||
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());
|
||||
}
|
||||
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));
|
||||
}
|
||||
/* 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... */
|
||||
/* 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));
|
||||
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);
|
||||
}
|
||||
$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!";
|
||||
print "done!";
|
||||
?>
|
||||
--CLEAN--
|
||||
<?php
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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();
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -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");
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -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);
|
||||
?>
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
+126
-126
@@ -1,150 +1,150 @@
|
||||
<?php
|
||||
/*
|
||||
Default values are "localhost", "root",
|
||||
database "test" and empty password.
|
||||
Change the MYSQL_TEST environment values
|
||||
if you want to use another configuration
|
||||
*/
|
||||
/*
|
||||
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;
|
||||
$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);
|
||||
}
|
||||
$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;
|
||||
/* 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");
|
||||
$IS_MYSQLND = stristr(mysqli_get_client_info(), "mysqlnd");
|
||||
|
||||
if (!function_exists('sys_get_temp_dir')) {
|
||||
function sys_get_temp_dir() {
|
||||
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'] );
|
||||
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;
|
||||
}
|
||||
}
|
||||
$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')) {
|
||||
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;
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
$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;
|
||||
}
|
||||
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;
|
||||
/**
|
||||
* 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;
|
||||
if ($enable_env_flags)
|
||||
$flags = $flags | $connect_flags;
|
||||
|
||||
return mysqli_real_connect($link, $host, $user, $passwd, $db, $port, $socket, $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;
|
||||
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;
|
||||
$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);
|
||||
}
|
||||
}
|
||||
}
|
||||
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;
|
||||
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;
|
||||
}
|
||||
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");
|
||||
}
|
||||
} 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);
|
||||
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;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -27,7 +27,7 @@ require_once('skipifconnectfailure.inc');
|
||||
=== DONE ===
|
||||
--CLEAN--
|
||||
<?php
|
||||
require_once("clean_table.inc");
|
||||
require_once("clean_table.inc");
|
||||
?>
|
||||
--EXPECT--
|
||||
bool(false)
|
||||
|
||||
@@ -1,146 +1,146 @@
|
||||
<?php
|
||||
/* Utility function for mysqli_set_local_infile*.phpt tests */
|
||||
function shutdown_clean($file) {
|
||||
if ($file) {
|
||||
unlink($file);
|
||||
}
|
||||
}
|
||||
/* 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') {
|
||||
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'";
|
||||
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']);
|
||||
$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, 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";
|
||||
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";
|
||||
}
|
||||
$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 "";
|
||||
}
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
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);
|
||||
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;
|
||||
}
|
||||
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) {
|
||||
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 ('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("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 (!@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 (!$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;
|
||||
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;
|
||||
}
|
||||
}
|
||||
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 && $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);
|
||||
if ($res)
|
||||
mysqli_free_result($res);
|
||||
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,18 +2,18 @@
|
||||
mysqli_autocommit()
|
||||
--SKIPIF--
|
||||
<?php
|
||||
require_once('skipif.inc');
|
||||
require_once('skipifemb.inc');
|
||||
require_once('connect.inc');
|
||||
require_once('skipifconnectfailure.inc');
|
||||
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 (!$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));
|
||||
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!
|
||||
|
||||
@@ -2,19 +2,19 @@
|
||||
mysqli->autocommit()
|
||||
--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 = 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 (!$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));
|
||||
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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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--
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user