[*] 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:22 +02:00
parent 9257dc80c2
commit 19ee2c953f
7 changed files with 105 additions and 85 deletions
+26 -26
View File
@@ -165,36 +165,36 @@ class MySQLCore extends Db
return 1;
if (!@mysql_select_db($db, $link))
return 2;
if (strtolower($engine) == 'innodb')
{
$value = 0;
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = mysql_query($sql);
if (!$result)
$value = 4;
$row = mysql_fetch_assoc($result);
if (!$row || strtolower($row['Value']) != 'yes')
$value = 4;
/* MySQL >= 5.6 */
$sql = 'SHOW ENGINES';
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
if ($row['Engine'] == 'InnoDB')
{
if (in_array($row['Support'], array('DEFAULT', 'YES')))
$value = 0;
break;
}
return $value;
}
@mysql_close($link);
return 0;
}
public function getBestEngine()
{
$value = 'InnoDB';
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = mysql_query($sql);
if (!$result)
$value = 'MyISAM';
$row = mysql_fetch_assoc($result);
if (!$row || strtolower($row['Value']) != 'yes')
$value = 'MyISAM';
/* MySQL >= 5.6 */
$sql = 'SHOW ENGINES';
$result = mysql_query($sql);
while ($row = mysql_fetch_assoc($result))
if ($row['Engine'] == 'InnoDB')
{
if (in_array($row['Support'], array('DEFAULT', 'YES')))
$value = 'InnoDB';
break;
}
return $value;
}
public static function checkCreatePrivilege($server, $user, $pwd, $db, $prefix, $engine)
public static function checkCreatePrivilege($server, $user, $pwd, $db, $prefix, $engine = null)
{
ini_set('mysql.connect_timeout', 5);
if (!$link = @mysql_connect($server, $user, $pwd, true))