[*] IN : only display the button to create the database if you can actually create the database

This commit is contained in:
Damien Metzger
2013-07-03 11:28:55 +02:00
parent bfa2f33c65
commit 5789e6eb51
4 changed files with 23 additions and 13 deletions
+5 -2
View File
@@ -53,7 +53,7 @@ class DbMySQLiCore extends Db
return $this->link;
}
public static function createDatabase($host, $user, $password, $dbname)
public static function createDatabase($host, $user, $password, $dbname, $dropit = false)
{
if (strpos($host, ':') !== false)
{
@@ -62,7 +62,10 @@ class DbMySQLiCore extends Db
}
else
$link = @new mysqli($host, $user, $password);
return $link->query('CREATE DATABASE `'.bqSQL($dbname).'`');
$success = $link->query('CREATE DATABASE `'.bqSQL($dbname).'`');
if ($dropit)
$success &= $link->query('DROP DATABASE `'.bqSQL($dbname).'`');
return $success;
}
/**