// 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:
+21
-2
@@ -149,7 +149,26 @@ class DbPDOCore extends Db
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DbCore::tryToConnect()
|
||||
* @see Db::hasTableWithSamePrefix()
|
||||
*/
|
||||
public static function hasTableWithSamePrefix($server, $user, $pwd, $db, $prefix)
|
||||
{
|
||||
try
|
||||
{
|
||||
$link = @new PDO('mysql:dbname='.$db.';host='.$server, $user, $pwd);
|
||||
}
|
||||
catch (PDOException $e)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
$sql = 'SHOW TABLES LIKE \''.$prefix.'%\'';
|
||||
$result = $link->query($sql);
|
||||
return (bool)$result->fetch();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see Db::checkConnection()
|
||||
*/
|
||||
static public function tryToConnect($server, $user, $pwd, $db, $newDbLink = true, $engine = null)
|
||||
{
|
||||
@@ -177,7 +196,7 @@ class DbPDOCore extends Db
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DbCore::tryUTF8()
|
||||
* @see Db::checkEncoding()
|
||||
*/
|
||||
static public function tryUTF8($server, $user, $pwd)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user