public function createDatabase(string $dbName, bool $ifNotExists = false): bool
{
if ($ifNotExists && $this->createDatabaseIfStr === null)
{
if ($this->databaseExists($dbName))
{
return true;
}
$ifNotExists = false;
}
if ($this->createDatabaseStr === false)
{
if ($this->db->DBDebug)
{
throw new DatabaseException('This feature is not available for the database you are using.');
}
return false;
}
elseif (! $this->db->query(sprintf($ifNotExists ? $this->createDatabaseIfStr : $this->createDatabaseStr, $dbName, $this->db->charset, $this->db->DBCollat))
)
{
if ($this->db->DBDebug)
{
throw new DatabaseException('Unable to create the specified database.');
}
return false;
}
if (! empty($this->db->dataCache['db_names']))
{
$this->db->dataCache['db_names'][] = $dbName;
}
return true;
}