mirror of
https://github.com/php/php-src.git
synced 2024-11-29 04:46:07 +08:00
Test fixes and updates to work with a wider range of MySQL server configs
This commit is contained in:
parent
ae9ac28ec2
commit
b094e5296b
@ -23,6 +23,6 @@ array(2) {
|
|||||||
["Variable_name"]=>
|
["Variable_name"]=>
|
||||||
string(10) "Ssl_cipher"
|
string(10) "Ssl_cipher"
|
||||||
["Value"]=>
|
["Value"]=>
|
||||||
string(%d) "%s"
|
string(%d) "%S"
|
||||||
}
|
}
|
||||||
done!
|
done!
|
||||||
|
@ -38,8 +38,15 @@ memory_limit=256M
|
|||||||
|
|
||||||
$max_len = pow(2, 24);
|
$max_len = pow(2, 24);
|
||||||
if ($org_max_allowed_packet < $max_len) {
|
if ($org_max_allowed_packet < $max_len) {
|
||||||
if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100)))
|
if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . ($max_len + 100))) {
|
||||||
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
if (1227 == mysqli_errno($link)) {
|
||||||
|
/* [1227] Access denied; you need the SUPER privilege for this operation */
|
||||||
|
print "done!";
|
||||||
|
exit(0);
|
||||||
|
} else {
|
||||||
|
printf("[005] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket))
|
||||||
@ -94,7 +101,8 @@ memory_limit=256M
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
|
if (!mysqli_query($link, "SET GLOBAL max_allowed_packet = " . $org_max_allowed_packet))
|
||||||
printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
if (1227 != mysqli_errno($link))
|
||||||
|
printf("[017] [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
|
||||||
|
@ -22,14 +22,22 @@ memory_limit=256M
|
|||||||
require_once("connect.inc");
|
require_once("connect.inc");
|
||||||
|
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
||||||
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
printf("[001] Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
||||||
$host, $user, $db, $port, $socket);
|
$host, $user, $db, $port, $socket);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$cols = 2500;
|
||||||
|
|
||||||
list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
|
list($old_max_allowed_packet) = $link->query("SELECT @@max_allowed_packet")->fetch_row();
|
||||||
if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
|
if (!$link->query("SET GLOBAL max_allowed_packet=(2<<29)")) {
|
||||||
printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
if (1227 == mysqli_errno($link)) {
|
||||||
|
/* [1227] Access denied; you need the SUPER privilege for this operation */
|
||||||
|
$cols = 10;
|
||||||
|
} else {
|
||||||
|
$cols = 10;
|
||||||
|
printf("[002] Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
|
|
||||||
@ -40,22 +48,21 @@ memory_limit=256M
|
|||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
|
if (!mysqli_query($link, 'DROP TABLE IF EXISTS test')) {
|
||||||
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
printf("Failed to drop old test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
$cols = 2500;
|
|
||||||
$str = array();
|
$str = array();
|
||||||
for ($i = 1; $i <= $cols; $i++) {
|
for ($i = 1; $i <= $cols; $i++) {
|
||||||
$str[] ="a$i BLOB";
|
$str[] ="a$i BLOB";
|
||||||
}
|
}
|
||||||
$link->query("CREATE TABLE ps_test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
|
$link->query("CREATE TABLE test(" . implode(" , ", $str) . ") ENGINE=MyISAM");
|
||||||
if (mysqli_errno($link)) {
|
if (mysqli_errno($link)) {
|
||||||
printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
printf("Failed to create the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
die("");
|
die("");
|
||||||
}
|
}
|
||||||
$stmt = $link->prepare("INSERT INTO ps_test VALUES(".str_repeat("?, ", $cols-1) . "?)");
|
$stmt = $link->prepare("INSERT INTO test VALUES(".str_repeat("?, ", $cols-1) . "?)");
|
||||||
var_dump($stmt->id);
|
var_dump($stmt->id);
|
||||||
$s = str_repeat("a", 2 << 12);
|
$s = str_repeat("a", 2 << 12);
|
||||||
$eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
|
$eval_str="\$stmt->bind_param(\"".str_repeat("s",$cols)."\", ";
|
||||||
@ -77,7 +84,8 @@ memory_limit=256M
|
|||||||
|
|
||||||
|
|
||||||
if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
|
if (!$link->query("SET GLOBAL max_allowed_packet=$old_max_allowed_packet")) {
|
||||||
printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
if (1227 != mysqli_errno($link))
|
||||||
|
printf("Failed to set max_allowed_packet the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
||||||
}
|
}
|
||||||
|
|
||||||
mysqli_close($link);
|
mysqli_close($link);
|
||||||
@ -86,15 +94,7 @@ memory_limit=256M
|
|||||||
?>
|
?>
|
||||||
--CLEAN--
|
--CLEAN--
|
||||||
<?php
|
<?php
|
||||||
if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) {
|
require_once("clean_table.inc");
|
||||||
printf("Cannot connect to the server using host=%s, user=%s, passwd=***, dbname=%s, port=%s, socket=%s\n",
|
|
||||||
$host, $user, $db, $port, $socket);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (!mysqli_query($link, 'DROP TABLE IF EXISTS ps_test')) {
|
|
||||||
printf("Failed to drop the test table: [%d] %s\n", mysqli_errno($link), mysqli_error($link));
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
int(1)
|
int(1)
|
||||||
|
Loading…
Reference in New Issue
Block a user