mirror of
https://github.com/php/php-src.git
synced 2025-01-12 22:14:41 +08:00
Hopefully, this is an even better way to check for InnoDB support as of MySQL 5.6.1
This commit is contained in:
parent
70b9029d9e
commit
56a2ff3b00
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user