@@ -122,9 +122,9 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function lastInsertedId(): string |
124 | 124 | { |
125 | - // Postgres does not set pdo->lastInsertedId |
|
126 | - // use sequence |
|
127 | - try { |
|
125 | + // Postgres does not set pdo->lastInsertedId |
|
126 | + // use sequence |
|
127 | + try { |
|
128 | 128 | $rq = $this->pdo->prepare('SELECT LASTVAL()'); |
129 | 129 | $rq->execute(); |
130 | 130 | // return string |
@@ -158,7 +158,6 @@ discard block |
||
158 | 158 | /** |
159 | 159 | * Get whether foreign keys are enabled or not |
160 | 160 | * For compatibility with Sqlite, not implemented in that driver (allways enabled), return true |
161 | - |
|
162 | 161 | * @access public |
163 | 162 | * @return bool true if foreign keys are enabled, otherwise false |
164 | 163 | */ |
@@ -182,11 +181,11 @@ discard block |
||
182 | 181 | public function addForeignKey(string $fkName, string $srcTable, string $srcColumn, string $refTable, string $refColumn): bool |
183 | 182 | { |
184 | 183 | $sql = sprintf('ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', |
185 | - $this->escape($srcTable), |
|
186 | - $fkName, |
|
187 | - $this->escape($srcColumn), |
|
188 | - $this->escape($refTable), |
|
189 | - $this->escape($refColumn) |
|
184 | + $this->escape($srcTable), |
|
185 | + $fkName, |
|
186 | + $this->escape($srcColumn), |
|
187 | + $this->escape($refTable), |
|
188 | + $this->escape($refColumn) |
|
190 | 189 | ); |
191 | 190 | return $this->prepareAndExecuteSql($sql); |
192 | 191 | } |
@@ -203,9 +202,9 @@ discard block |
||
203 | 202 | public function dropForeignKey(string $fkName, string $tableName, bool $ifExists = false): bool |
204 | 203 | { |
205 | 204 | $sql = sprintf('ALTER TABLE %s DROP CONSTRAINT %s %s', |
206 | - $this->escape($tableName), |
|
207 | - $ifExists ? 'IF EXISTS' : '', |
|
208 | - $fkName |
|
205 | + $this->escape($tableName), |
|
206 | + $ifExists ? 'IF EXISTS' : '', |
|
207 | + $fkName |
|
209 | 208 | ); |
210 | 209 | return $this->prepareAndExecuteSql($sql); |
211 | 210 | } |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
87 | 87 | $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
88 | 88 | $options = [ |
89 | - // \PDO::ATTR_EMULATE_PREPARES => false, |
|
89 | + // \PDO::ATTR_EMULATE_PREPARES => false, |
|
90 | 90 | ]; |
91 | 91 | |
92 | 92 | $this->pdo = new \PDO( |
@@ -162,11 +162,11 @@ discard block |
||
162 | 162 | public function addForeignKey(string $fkName, string $srcTable, string $srcColumn, string $refTable, string $refColumn): bool |
163 | 163 | { |
164 | 164 | $sql = sprintf('ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', |
165 | - $this->escape($srcTable), |
|
166 | - $fkName, |
|
167 | - $this->escape($srcColumn), |
|
168 | - $this->escape($refTable), |
|
169 | - $this->escape($refColumn) |
|
165 | + $this->escape($srcTable), |
|
166 | + $fkName, |
|
167 | + $this->escape($srcColumn), |
|
168 | + $this->escape($refTable), |
|
169 | + $this->escape($refColumn) |
|
170 | 170 | ); |
171 | 171 | return $this->prepareAndExecuteSql($sql); |
172 | 172 | } |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | public function dropForeignKey(string $fkName, string $tableName): bool |
184 | 184 | { |
185 | 185 | $sql = sprintf('ALTER TABLE %s DROP FOREIGN KEY %s', |
186 | - $this->escape($tableName), |
|
187 | - $fkName |
|
186 | + $this->escape($tableName), |
|
187 | + $fkName |
|
188 | 188 | ); |
189 | 189 | return $this->prepareAndExecuteSql($sql); |
190 | 190 | } |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | "'" . $userPassword ."'" |
240 | 240 | )); |
241 | 241 | return $this->prepareAndExecuteSql($sql); |
242 | - } |
|
242 | + } |
|
243 | 243 | |
244 | 244 | /** |
245 | 245 | * Drop a user |
@@ -269,7 +269,7 @@ discard block |
||
269 | 269 | * |
270 | 270 | * @return bool True if the user has been granted, otherwise false. |
271 | 271 | */ |
272 | - public function grantUser(string $databaseName, string $userName): bool |
|
272 | + public function grantUser(string $databaseName, string $userName): bool |
|
273 | 273 | { |
274 | 274 | $sql = trim(sprintf('GRANT ALL ON %s.* TO %s@%s; FLUSH PRIVILEGES;', |
275 | 275 | $this->escape($databaseName), |