corrected dbh->exec checks to use === to force bool check

This commit is contained in:
Matthew Vale 2015-12-01 16:08:04 +00:00
parent 3f4a9865f5
commit 44b9574a53
1 changed files with 7 additions and 3 deletions

View File

@ -310,11 +310,15 @@ include "root.php";
}
//create the database, user, grant perms
if ($this->dbh->exec("CREATE DATABASE {$this->db_name}") == false) {
if($this->dbh->exec("CREATE DATABASE {$this->db_name}") === false) {
throw new Exception("Failed to create database {$this->db_name}: " . join(":", $this->dbh->errorInfo()));
}
$this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'");
$this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}");
if($this->dbh->exec("CREATE USER {$this->db_username} WITH PASSWORD '{$this->db_password}'") === false){
throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo()));
}
if($this->dbh->exec("GRANT ALL ON {$this->db_name} TO {$this->db_username}") === false){
throw new Exception("Failed to create user {$this->db_name}: " . join(":", $this->dbh->errorInfo()));
}
//close database connection_aborted
$this->dbh = null;