[-] IN : Fixed bug with database creation

This commit is contained in:
Francois Gaillard
2013-07-03 12:19:34 +02:00
parent 5789e6eb51
commit 8d3f330b2d
3 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -63,8 +63,8 @@ class DbMySQLiCore extends Db
else else
$link = @new mysqli($host, $user, $password); $link = @new mysqli($host, $user, $password);
$success = $link->query('CREATE DATABASE `'.bqSQL($dbname).'`'); $success = $link->query('CREATE DATABASE `'.bqSQL($dbname).'`');
if ($dropit) if ($dropit && ($link->exec('DROP DATABASE `'.bqSQL($dbname).'`') !== false))
$success &= $link->query('DROP DATABASE `'.bqSQL($dbname).'`'); return true;
return $success; return $success;
} }
+3 -3
View File
@@ -51,10 +51,10 @@ class DbPDOCore extends Db
try { try {
$link = DbPDO::_getPDO($host, $user, $password, false); $link = DbPDO::_getPDO($host, $user, $password, false);
$success = $link->exec('CREATE DATABASE `'.bqSQL($dbname).'`'); $success = $link->exec('CREATE DATABASE `'.bqSQL($dbname).'`');
if ($dropit) if ($dropit && ($link->exec('DROP DATABASE `'.bqSQL($dbname).'`') !== false))
$success &= $link->exec('DROP DATABASE `'.bqSQL($dbname).'`'); return true;
} catch (PDOException $e) { } catch (PDOException $e) {
$success = false; return false;
} }
return $success; return $success;
} }
+2 -2
View File
@@ -51,8 +51,8 @@ class MySQLCore extends Db
{ {
$link = mysql_connect($host, $user, $password); $link = mysql_connect($host, $user, $password);
$success = mysql_query('CREATE DATABASE `'.bqSQL($dbname).'`', $link); $success = mysql_query('CREATE DATABASE `'.bqSQL($dbname).'`', $link);
if ($dropit) if ($dropit && ($link->exec('DROP DATABASE `'.bqSQL($dbname).'`') !== false))
$success &= mysql_query('DROP DATABASE `'.bqSQL($dbname).'`', $link); return true;
return $success; return $success;
} }