From: Ulf Wendel Date: Fri, 2 Sep 2011 10:38:51 +0000 (+0000) Subject: As of MySQL 5.6.1 the server variable have_innodb is no more. Updating InnoDB check... X-Git-Tag: php-5.3.9RC1~269 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=248a9a7f4da44d2cb491dc1025bda66287594c6b;p=php As of MySQL 5.6.1 the server variable have_innodb is no more. Updating InnoDB check... --- diff --git a/ext/mysqli/tests/014.phpt b/ext/mysqli/tests/014.phpt index 8fb8cceef6..da6a0052cc 100644 --- a/ext/mysqli/tests/014.phpt +++ b/ext/mysqli/tests/014.phpt @@ -5,19 +5,13 @@ mysqli autocommit/commit/rollback require_once('skipif.inc'); require_once('skipifconnectfailure.inc'); require_once("connect.inc"); + $link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket); - if (!$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'")) { - die("skip Cannot check for required InnoDB suppot"); - } - if (!$row = mysqli_fetch_row($result)) - die("skip Cannot check for required InnoDB suppot"); + if (!$link) + die(sprintf("Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); - mysqli_free_result($result); - mysqli_close($link); - if ($row[1] == "DISABLED" || $row[1] == "NO") { - printf ("skip innodb support is not installed or enabled."); - exit; - } + if (!have_innodb($link)) + die(sprintf("Needs InnoDB support, [%d] %s", $link->errno, $link->error)); ?> --FILE-- errno, $link->error)); ?> --FILE-- 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 (('InnoDB' == $row['Engine']) && ('YES' == $row['Support'])) { + return true; + } + } + return false; + } else { + return false; + } + } + return false; + } + } else { printf("skip Eeeek/BUG/FIXME - connect.inc included twice! skipif bug?\n"); } -?> \ No newline at end of file + + 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; + } +?> diff --git a/ext/mysqli/tests/mysqli_autocommit.phpt b/ext/mysqli/tests/mysqli_autocommit.phpt index f1f63e7f33..a93d89f101 100644 --- a/ext/mysqli/tests/mysqli_autocommit.phpt +++ b/ext/mysqli/tests/mysqli_autocommit.phpt @@ -12,17 +12,8 @@ mysqli_autocommit() $host, $user, $db, $port, $socket)); } - if (!$result = mysqli_query($link, "SHOW VARIABLES LIKE 'have_innodb'")) { - die("skip Cannot check for required InnoDB suppot"); - } - if (!$row = mysqli_fetch_row($result)) - die("skip Cannot check for required InnoDB suppot"); - - mysqli_free_result($result); - mysqli_close($link); - if ($row[1] == "DISABLED" || $row[1] == "NO") { - die(sprintf ("skip innodb support is not installed or enabled.")); - } + if (!have_innodb($link)) + die(sprintf("Needs InnoDB support, [%d] %s", $link->errno, $link->error)); ?> --FILE-- autocommit() exit(1); } - if (!$res = $mysqli->query("SHOW VARIABLES LIKE 'have_innodb'")) { - printf("skip Cannot fetch have_innodb variable\n"); - exit(1); - } - - $row = $res->fetch_row(); - $res->free_result(); - $mysqli->close(); - - if ($row[1] == "DISABLED" || $row[1] == "NO") { - printf ("skip Innodb support is not installed or enabled."); - exit(1); - } + if (!have_innodb($link)) + die(sprintf("Needs InnoDB support, [%d] %s", $link->errno, $link->error)); ?> --FILE-- errno, $link->error)); ?> --FILE-- errno, $link->error)); ?> --FILE-- query("SHOW VARIABLES LIKE 'have_innodb'")) { - die(sprintf("skip Cannot fetch have_innodb variable\n")); -} - -$row = $res->fetch_row(); -$res->free(); -$mysqli->close(); - -if ($row[1] == "DISABLED" || $row[1] == "NO") { - die(sprintf("skip Innodb support is not installed or enabled.")); -} + +require_once('connect.inc'); +if (!$link = my_mysqli_connect($host, $user, $passwd, $db, $port, $socket)) + die(sprintf("Cannot connect, [%d] %s", mysqli_connect_errno(), mysqli_connect_error())); + +if (!have_innodb($link)) + die(sprintf("Needs InnoDB support, [%d] %s", $link->errno, $link->error)); ?> --FILE-- errno, $link->error)); ?> --FILE-- errno, $link->error)); ?> --FILE--