Hopefully, this is an even better way to check for InnoDB support as of MySQL 5.6.1

This commit is contained in:
Ulf Wendel 2011-09-02 11:06:51 +00:00
parent 70b9029d9e
commit 56a2ff3b00
2 changed files with 15 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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;
}