diff options
author | Ulf Wendel <uw@php.net> | 2011-09-02 11:06:51 +0000 |
---|---|---|
committer | Ulf Wendel <uw@php.net> | 2011-09-02 11:06:51 +0000 |
commit | 6e3708cc59fbb5c68665ea47a5ec905317d8ca9b (patch) | |
tree | 06c21ee9bc6d85e3db81e243969d316a85b294dc | |
parent | 893c890d0126bc1f9c7587008e730143faa64816 (diff) | |
download | php-git-6e3708cc59fbb5c68665ea47a5ec905317d8ca9b.tar.gz |
Hopefully, this is an even better way to check for InnoDB support as of MySQL 5.6.1
-rw-r--r-- | ext/mysqli/tests/connect.inc | 7 | ||||
-rw-r--r-- | ext/pdo_mysql/tests/mysql_pdo_test.inc | 11 |
2 files changed, 15 insertions, 3 deletions
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; } |