uw Fri, 02 Sep 2011 11:06:51 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=316034
Log:
Hopefully, this is an even better way to check for InnoDB support as of MySQL
5.6.1
Changed paths:
U php/php-src/branches/PHP_5_3/ext/mysqli/tests/connect.inc
U php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/mysql_pdo_test.inc
U php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc
U php/php-src/branches/PHP_5_4/ext/pdo_mysql/tests/mysql_pdo_test.inc
U php/php-src/trunk/ext/mysqli/tests/connect.inc
U php/php-src/trunk/ext/pdo_mysql/tests/mysql_pdo_test.inc
Modified: php/php-src/branches/PHP_5_3/ext/mysqli/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/mysqli/tests/connect.inc 2011-09-02
10:38:51 UTC (rev 316033)
+++ php/php-src/branches/PHP_5_3/ext/mysqli/tests/connect.inc 2011-09-02
11:06:51 UTC (rev 316034)
@@ -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;
}
}
Modified: php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/mysql_pdo_test.inc
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/mysql_pdo_test.inc
2011-09-02 10:38:51 UTC (rev 316033)
+++ php/php-src/branches/PHP_5_3/ext/pdo_mysql/tests/mysql_pdo_test.inc
2011-09-02 11:06:51 UTC (rev 316034)
@@ -141,12 +141,19 @@
}
- 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;
}
Modified: php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc 2011-09-02
10:38:51 UTC (rev 316033)
+++ php/php-src/branches/PHP_5_4/ext/mysqli/tests/connect.inc 2011-09-02
11:06:51 UTC (rev 316034)
@@ -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;
}
}
Modified: php/php-src/branches/PHP_5_4/ext/pdo_mysql/tests/mysql_pdo_test.inc
===================================================================
--- php/php-src/branches/PHP_5_4/ext/pdo_mysql/tests/mysql_pdo_test.inc
2011-09-02 10:38:51 UTC (rev 316033)
+++ php/php-src/branches/PHP_5_4/ext/pdo_mysql/tests/mysql_pdo_test.inc
2011-09-02 11:06:51 UTC (rev 316034)
@@ -141,12 +141,19 @@
}
- 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;
}
Modified: php/php-src/trunk/ext/mysqli/tests/connect.inc
===================================================================
--- php/php-src/trunk/ext/mysqli/tests/connect.inc 2011-09-02 10:38:51 UTC
(rev 316033)
+++ php/php-src/trunk/ext/mysqli/tests/connect.inc 2011-09-02 11:06:51 UTC
(rev 316034)
@@ -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;
}
}
Modified: php/php-src/trunk/ext/pdo_mysql/tests/mysql_pdo_test.inc
===================================================================
--- php/php-src/trunk/ext/pdo_mysql/tests/mysql_pdo_test.inc 2011-09-02
10:38:51 UTC (rev 316033)
+++ php/php-src/trunk/ext/pdo_mysql/tests/mysql_pdo_test.inc 2011-09-02
11:06:51 UTC (rev 316034)
@@ -141,12 +141,19 @@
}
- 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;
}
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php