[+] Classes: add PDO support if extension is activated

[*] Classes: add engine check (innodb)

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@9317 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-10-13 15:00:08 +00:00
parent 9984312409
commit 552e264c95
5 changed files with 56 additions and 16 deletions
+12 -1
View File
@@ -136,12 +136,23 @@ class MySQLCore extends Db
return mysql_select_db($db_name, $this->link);
}
public static function tryToConnect($server, $user, $pwd, $db, $newDbLink = true)
public static function tryToConnect($server, $user, $pwd, $db, $newDbLink = true, $engine = null)
{
if (!$link = @mysql_connect($server, $user, $pwd, $newDbLink))
return 1;
if (!@mysql_select_db($db, $link))
return 2;
if (strtolower($engine) == 'innodb')
{
$sql = 'SHOW VARIABLES WHERE Variable_name = \'have_innodb\'';
$result = mysql_query($sql);
if (!$result)
return 4;
$row = mysql_fetch_assoc($result);
if (!$row || strtolower($row['Value']) != 'yes')
return 4;
}
@mysql_close($link);
return 0;
}