// Check if at least one table with same prefix already exists in new installer

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12194 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2012-01-05 14:28:10 +00:00
parent 4ab6988b63
commit 9d7ec6da61
5 changed files with 93 additions and 2 deletions
+20
View File
@@ -138,6 +138,23 @@ class DbMySQLiCore extends Db
return $this->link->query('USE '.pSQL($db_name));
}
/**
* @see Db::hasTableWithSamePrefix()
*/
public static function hasTableWithSamePrefix($server, $user, $pwd, $db, $prefix)
{
$link = @new mysqli($server, $user, $pwd, $db);
if (mysqli_connect_error())
return false;
$sql = 'SHOW TABLES LIKE \''.$prefix.'%\'';
$result = $link->query($sql);
return (bool)$result->fetch_assoc();
}
/**
* @see Db::checkConnection()
*/
static public function tryToConnect($server, $user, $pwd, $db, $newDbLink = true, $engine = null)
{
$link = @new mysqli($server, $user, $pwd, $db);
@@ -158,6 +175,9 @@ class DbMySQLiCore extends Db
return 0;
}
/**
* @see Db::checkEncoding()
*/
static public function tryUTF8($server, $user, $pwd)
{
$link = @new mysqli($server, $user, $pwd, $db);