From: Ulf Wendel Date: Fri, 2 Sep 2011 11:06:51 +0000 (+0000) Subject: Hopefully, this is an even better way to check for InnoDB support as of MySQL 5.6.1 X-Git-Tag: php-5.3.9RC1~268 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=864f8106bef8a8d8dea783f803f501447f55d4fb;p=php Hopefully, this is an even better way to check for InnoDB support as of MySQL 5.6.1 --- diff --git a/ext/mysqli/tests/connect.inc b/ext/mysqli/tests/connect.inc index ec837d64b3..ee1dce4640 100644 --- a/ext/mysqli/tests/connect.inc +++ b/ext/mysqli/tests/connect.inc @@ -234,7 +234,12 @@ /* MySQL 5.6.1+ */ if ($res = $link->query("SHOW ENGINES")) { while ($row = $res->fetch_assoc()) { - if (('InnoDB' == $row['Engine']) && ('YES' == $row['Support'])) { + if (!isset($row['Engine']) || !isset($row['Support'])) + return false; + + if (('InnoDB' == $row['Engine']) && + (('YES' == $row['Support']) || ('DEFAULT' == $row['Support'])) + ) { return true; } } diff --git a/ext/pdo_mysql/tests/mysql_pdo_test.inc b/ext/pdo_mysql/tests/mysql_pdo_test.inc index 0af2e6df65..115aeadc5a 100644 --- a/ext/pdo_mysql/tests/mysql_pdo_test.inc +++ b/ext/pdo_mysql/tests/mysql_pdo_test.inc @@ -141,12 +141,19 @@ class MySQLPDOTest extends PDOTest { } - static function detect_transactional_mysql_engine($db) { + static function detect_transactional_mysql_engine($db) { foreach ($db->query("show variables like 'have%'") as $row) { - if ($row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) { + if (!empty($row) && $row[1] == 'YES' && ($row[0] == 'have_innodb' || $row[0] == 'have_bdb')) { return str_replace("have_", "", $row[0]); } } + /* MySQL 5.6.1+ */ + foreach ($db->query("SHOW ENGINES") as $row) { + if (isset($row['engine']) && isset($row['support'])) { + if ('InnoDB' == $row['engine'] && ('YES' == $row['support'] || 'DEFAULT' == $row['support'])) + return 'innodb'; + } + } return false; }