Prevent syntax error when creating user or changing password
This commit is contained in:
parent
5157c5a9c4
commit
9781312648
|
@ -140,12 +140,12 @@ class PostgreSQL extends AbstractDatabase {
|
||||||
|
|
||||||
private function createDBUser(IDBConnection $connection) {
|
private function createDBUser(IDBConnection $connection) {
|
||||||
try {
|
try {
|
||||||
if ($this->userExists($connection, $this->dbUser)) {
|
if ($this->userExists($connection)) {
|
||||||
// change the password
|
// change the password
|
||||||
$query = $connection->prepare("ALTER ROLE " . addslashes($this->dbUser) . " CREATEDB WITH PASSWORD " . addslashes($this->dbPassword));
|
$query = $connection->prepare("ALTER ROLE " . addslashes($this->dbUser) . " CREATEDB WITH PASSWORD '" . addslashes($this->dbPassword) . "'");
|
||||||
} else {
|
} else {
|
||||||
// create the user
|
// create the user
|
||||||
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD " . addslashes($this->dbPassword));
|
$query = $connection->prepare("CREATE USER " . addslashes($this->dbUser) . " CREATEDB PASSWORD '" . addslashes($this->dbPassword) . "'");
|
||||||
}
|
}
|
||||||
$query->execute();
|
$query->execute();
|
||||||
} catch (DatabaseException $e) {
|
} catch (DatabaseException $e) {
|
||||||
|
|
Loading…
Reference in New Issue