@@ -147,11 +147,11 @@ discard block |
||
| 147 | 147 | public function addForeignKey($fkName, $srcTable, $srcColumn, $refTable, $refColumn) |
| 148 | 148 | { |
| 149 | 149 | $sql = sprintf('ALTER TABLE %s ADD CONSTRAINT %s FOREIGN KEY (%s) REFERENCES %s(%s)', |
| 150 | - $this->escape($srcTable), |
|
| 151 | - $fkName, |
|
| 152 | - $this->escape($srcColumn), |
|
| 153 | - $this->escape($refTable), |
|
| 154 | - $this->escape($refColumn) |
|
| 150 | + $this->escape($srcTable), |
|
| 151 | + $fkName, |
|
| 152 | + $this->escape($srcColumn), |
|
| 153 | + $this->escape($refTable), |
|
| 154 | + $this->escape($refColumn) |
|
| 155 | 155 | ); |
| 156 | 156 | return $this->prepareAndExecuteSql($sql); |
| 157 | 157 | } |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | public function dropForeignKey($fkName, $tableName) |
| 169 | 169 | { |
| 170 | 170 | $sql = sprintf('ALTER TABLE %s DROP FOREIGN KEY %s', |
| 171 | - $this->escape($tableName), |
|
| 172 | - $fkName |
|
| 171 | + $this->escape($tableName), |
|
| 172 | + $fkName |
|
| 173 | 173 | ); |
| 174 | 174 | return $this->prepareAndExecuteSql($sql); |
| 175 | 175 | } |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | "'" . $userPassword ."'" |
| 224 | 224 | )); |
| 225 | 225 | return $this->prepareAndExecuteSql($sql); |
| 226 | - } |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | 228 | /** |
| 229 | 229 | * Drop a user |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * |
| 254 | 254 | * @return bool True if the user has been granted, otherwise false. |
| 255 | 255 | */ |
| 256 | - public function grantUser($databaseName, $userName) |
|
| 256 | + public function grantUser($databaseName, $userName) |
|
| 257 | 257 | { |
| 258 | 258 | $sql = trim(sprintf('GRANT ALL ON %s.* TO %s@%s; FLUSH PRIVILEGES;', |
| 259 | 259 | $this->escape($databaseName), |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | */ |
| 60 | 60 | public function escapeIdentifier($identifier) |
| 61 | 61 | { |
| 62 | - return '`' . $identifier .'`'; |
|
| 62 | + return '`'.$identifier.'`'; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | /** |
@@ -85,12 +85,12 @@ discard block |
||
| 85 | 85 | */ |
| 86 | 86 | public function createConnection(array $settings) |
| 87 | 87 | { |
| 88 | - $charset = !empty($settings['charset']) ? ';charset='.$settings['charset'] : ';charset=utf8'; |
|
| 89 | - $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
|
| 90 | - $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
|
| 88 | + $charset = !empty($settings['charset']) ? ';charset='.$settings['charset'] : ';charset=utf8'; |
|
| 89 | + $port = !empty($settings['port']) ? ';port='.$settings['port'] : ''; |
|
| 90 | + $dbname = !empty($settings['database']) ? ';dbname='.$settings['database'] : ''; |
|
| 91 | 91 | |
| 92 | 92 | $this->pdo = new \PDO( |
| 93 | - 'mysql:host='.$settings['hostname'] .$port .$dbname .$charset, |
|
| 93 | + 'mysql:host='.$settings['hostname'].$port.$dbname.$charset, |
|
| 94 | 94 | $settings['username'], |
| 95 | 95 | $settings['password'], |
| 96 | 96 | array() |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | { |
| 187 | 187 | $sql = 'SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME = :dbName'; |
| 188 | 188 | $query = $this->pdo->prepare($sql); |
| 189 | - $query->bindValue(':dbName', $databaseName, \PDO::PARAM_STR); |
|
| 189 | + $query->bindValue(':dbName', $databaseName, \PDO::PARAM_STR); |
|
| 190 | 190 | $query->execute(); |
| 191 | 191 | return (bool) $query->fetchColumn(); |
| 192 | 192 | } |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | */ |
| 203 | 203 | public function createDatabase($databaseName, $owner = null) |
| 204 | 204 | { |
| 205 | - $sql = trim(sprintf('CREATE DATABASE %s', $this->escape($databaseName))); |
|
| 205 | + $sql = trim(sprintf('CREATE DATABASE %s', $this->escape($databaseName))); |
|
| 206 | 206 | return $this->prepareAndExecuteSql($sql); |
| 207 | 207 | } |
| 208 | 208 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | $sql = trim(sprintf('CREATE USER %s@%s IDENTIFIED BY %s', |
| 221 | 221 | $this->escape($userName), |
| 222 | 222 | $this->escape($this->getHostName()), |
| 223 | - "'" . $userPassword ."'" |
|
| 223 | + "'".$userPassword."'" |
|
| 224 | 224 | )); |
| 225 | 225 | return $this->prepareAndExecuteSql($sql); |
| 226 | 226 | } |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | public function dropUser($userName, $ifExists = false) |
| 238 | 238 | { |
| 239 | 239 | $sql = trim(sprintf('DROP USER %s %s@%s', |
| 240 | - $ifExists === true ? 'IF EXISTS': '', |
|
| 240 | + $ifExists === true ? 'IF EXISTS' : '', |
|
| 241 | 241 | $this->escape($userName), |
| 242 | 242 | $this->escape($this->getHostName()) |
| 243 | 243 | )); |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | */ |
| 305 | 305 | public function sqlCreateTableOptions() |
| 306 | 306 | { |
| 307 | - $engine = !empty($settings['engine']) ? $settings['engine'] : 'InnoDB'; |
|
| 307 | + $engine = !empty($settings['engine']) ? $settings['engine'] : 'InnoDB'; |
|
| 308 | 308 | $charset = !empty($settings['charset']) ? $settings['charset'] : 'utf8'; |
| 309 | 309 | $collate = !empty($settings['collate']) ? $settings['collate'] : 'utf8_unicode_ci'; |
| 310 | 310 | return sprintf('ENGINE=%s DEFAULT CHARSET=%s COLLATE=%s;', $engine, $charset, $collate); |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | */ |
| 334 | 334 | public function sqlColumnAutoIncrement($type) |
| 335 | 335 | { |
| 336 | - return $type .' AUTO_INCREMENT'; |
|
| 336 | + return $type.' AUTO_INCREMENT'; |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | } |