@@ -2,7 +2,7 @@ discard block |
||
| 2 | 2 | /** |
| 3 | 3 | * @author Rémy M. Böhler <[email protected]> |
| 4 | 4 | */ |
| 5 | -declare(strict_types=1); |
|
| 5 | +declare(strict_types = 1); |
|
| 6 | 6 | |
| 7 | 7 | namespace Rorm; |
| 8 | 8 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * Because REPLACE INTO does DELETE and INSERT, |
| 162 | 162 | * which does not play nice with TRIGGERs and FOREIGN KEY CONSTRAINTS |
| 163 | 163 | */ |
| 164 | - $sql = 'INSERT INTO ' . $quotedTable . ' '; |
|
| 164 | + $sql = 'INSERT INTO '.$quotedTable.' '; |
|
| 165 | 165 | |
| 166 | 166 | $insertData = []; |
| 167 | 167 | $updateData = []; |
@@ -175,20 +175,20 @@ discard block |
||
| 175 | 175 | $insertData[$quotedColumn] = $helper->quote($dbh, $value); |
| 176 | 176 | |
| 177 | 177 | if ($doMerge && !in_array($column, $idColumns, true)) { |
| 178 | - $updateData[] = $quotedColumn . ' = VALUES(' . $quotedColumn . ')'; |
|
| 178 | + $updateData[] = $quotedColumn.' = VALUES('.$quotedColumn.')'; |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | unset($column, $value, $quotedColumn); |
| 182 | 182 | |
| 183 | 183 | // insert |
| 184 | 184 | $sql .= |
| 185 | - '(' . implode(', ', array_keys($insertData)) . ')' . |
|
| 186 | - ' VALUES ' . |
|
| 187 | - '(' . implode(', ', $insertData) . ')'; |
|
| 185 | + '('.implode(', ', array_keys($insertData)).')'. |
|
| 186 | + ' VALUES '. |
|
| 187 | + '('.implode(', ', $insertData).')'; |
|
| 188 | 188 | |
| 189 | 189 | if ($doMerge && count($updateData) > 0) { |
| 190 | 190 | // update |
| 191 | - $sql .= ' ON DUPLICATE KEY UPDATE ' . implode(', ', $updateData); |
|
| 191 | + $sql .= ' ON DUPLICATE KEY UPDATE '.implode(', ', $updateData); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | // execute (most likely throws PDOException if there is an error) |
@@ -209,9 +209,9 @@ discard block |
||
| 209 | 209 | * SQLite |
| 210 | 210 | */ |
| 211 | 211 | if ($doMerge) { |
| 212 | - $sql = 'INSERT OR REPLACE INTO ' . $quotedTable . ' '; |
|
| 212 | + $sql = 'INSERT OR REPLACE INTO '.$quotedTable.' '; |
|
| 213 | 213 | } else { |
| 214 | - $sql = 'INSERT INTO ' . $quotedTable . ' '; |
|
| 214 | + $sql = 'INSERT INTO '.$quotedTable.' '; |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | // build (column) VALUES (values) |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | } |
| 226 | 226 | unset($column, $value); |
| 227 | 227 | |
| 228 | - $sql .= '(' . implode(', ', array_keys($quotedData)) . ') VALUES (' . implode(', ', $quotedData) . ')'; |
|
| 228 | + $sql .= '('.implode(', ', array_keys($quotedData)).') VALUES ('.implode(', ', $quotedData).')'; |
|
| 229 | 229 | |
| 230 | 230 | // execute (most likely throws PDOException if there is an error) |
| 231 | 231 | if ($dbh->exec($sql) === false) { |
@@ -251,10 +251,10 @@ discard block |
||
| 251 | 251 | |
| 252 | 252 | $where = []; |
| 253 | 253 | foreach ($idColumns as $columnName) { |
| 254 | - $where[] = $quoteIdentifier($columnName) . ' = ' . $helper->quote($dbh, $this->$columnName); |
|
| 254 | + $where[] = $quoteIdentifier($columnName).' = '.$helper->quote($dbh, $this->$columnName); |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $sql = 'DELETE FROM ' . $quoteIdentifier($this->getTable()) . ' WHERE ' . implode(' AND ', $where); |
|
| 257 | + $sql = 'DELETE FROM '.$quoteIdentifier($this->getTable()).' WHERE '.implode(' AND ', $where); |
|
| 258 | 258 | |
| 259 | 259 | return $dbh->exec($sql) > 0; |
| 260 | 260 | } |