[*] IN : removed the possibility to choose his own storage engine, automatically select the best one

This commit is contained in:
Damien Metzger
2013-06-26 14:26:37 +02:00
parent 9257dc80c2
commit 19ee2c953f
7 changed files with 105 additions and 85 deletions
+26 -26
View File
@@ -174,7 +174,7 @@ class DbPDOCore extends Db
return (bool)$result->fetch();
}
public static function checkCreatePrivilege($server, $user, $pwd, $db, $prefix, $engine)
public static function checkCreatePrivilege($server, $user, $pwd, $db, $prefix, $engine = null)
{
try {
$link = DbPDO::_getPDO($server, $user, $pwd, $db, 5);
@@ -206,34 +206,34 @@ class DbPDOCore extends Db
} catch (PDOException $e) {
return ($e->getCode() == 1049) ? 2 : 1;
}
if (strtolower($engine) == 'innodb')
{
$value = 0;
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = $link->query($sql);
if (!$result)
$value = 4;
$row = $result->fetch();
if (!$row || strtolower($row['Value']) != 'yes')
$value = 4;
/* MySQL >= 5.6 */
$sql = 'SHOW ENGINES';
$result = $link->query($sql);
while ($row = $result->fetch())
if ($row['Engine'] == 'InnoDB')
{
if (in_array($row['Support'], array('DEFAULT', 'YES')))
$value = 0;
break;
}
return $value;
}
unset($link);
return 0;
}
public function getBestEngine()
{
$value = 'InnoDB';
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = $link->query($sql);
if (!$result)
$value = 'MyISAM';
$row = $result->fetch();
if (!$row || strtolower($row['Value']) != 'yes')
$value = 'MyISAM';
/* MySQL >= 5.6 */
$sql = 'SHOW ENGINES';
$result = $link->query($sql);
while ($row = $result->fetch())
if ($row['Engine'] == 'InnoDB')
{
if (in_array($row['Support'], array('DEFAULT', 'YES')))
$value = 'InnoDB';
break;
}
return $value;
}
/**
* @see Db::checkEncoding()