@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | * Because REPLACE INTO does DELETE and INSERT, |
| 174 | 174 | * which does not play nice with TRIGGERs and FOREIGN KEY CONSTRAINTS |
| 175 | 175 | */ |
| 176 | - $sql = 'INSERT INTO ' . $quotedTable . ' '; |
|
| 176 | + $sql = 'INSERT INTO '.$quotedTable.' '; |
|
| 177 | 177 | |
| 178 | 178 | $insertData = array(); |
| 179 | 179 | $updateData = array(); |
@@ -187,20 +187,20 @@ discard block |
||
| 187 | 187 | $insertData[$quotedColumn] = Rorm::quote($dbh, $value); |
| 188 | 188 | |
| 189 | 189 | if ($doMerge && !in_array($column, $idColumns)) { |
| 190 | - $updateData[] = $quotedColumn . ' = VALUES(' . $quotedColumn . ')'; |
|
| 190 | + $updateData[] = $quotedColumn.' = VALUES('.$quotedColumn.')'; |
|
| 191 | 191 | } |
| 192 | 192 | } |
| 193 | 193 | unset($column, $value, $quotedColumn); |
| 194 | 194 | |
| 195 | 195 | // insert |
| 196 | 196 | $sql .= |
| 197 | - '(' . implode(', ', array_keys($insertData)) . ')' . |
|
| 198 | - ' VALUES ' . |
|
| 199 | - '(' . implode(', ', $insertData) . ')'; |
|
| 197 | + '('.implode(', ', array_keys($insertData)).')'. |
|
| 198 | + ' VALUES '. |
|
| 199 | + '('.implode(', ', $insertData).')'; |
|
| 200 | 200 | |
| 201 | 201 | if ($doMerge && count($updateData) > 0) { |
| 202 | 202 | // update |
| 203 | - $sql .= ' ON DUPLICATE KEY UPDATE ' . implode(', ', $updateData); |
|
| 203 | + $sql .= ' ON DUPLICATE KEY UPDATE '.implode(', ', $updateData); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // execute (most likely throws PDOException if there is an error) |
@@ -220,9 +220,9 @@ discard block |
||
| 220 | 220 | * SQLite |
| 221 | 221 | */ |
| 222 | 222 | if ($doMerge) { |
| 223 | - $sql = 'INSERT OR REPLACE INTO ' . $quotedTable . ' '; |
|
| 223 | + $sql = 'INSERT OR REPLACE INTO '.$quotedTable.' '; |
|
| 224 | 224 | } else { |
| 225 | - $sql = 'INSERT INTO ' . $quotedTable . ' '; |
|
| 225 | + $sql = 'INSERT INTO '.$quotedTable.' '; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | // build (column) VALUES (values) |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | } |
| 237 | 237 | unset($column, $value); |
| 238 | 238 | |
| 239 | - $sql .= '(' . implode(', ', array_keys($quotedData)) . ') VALUES (' . implode(', ', $quotedData) . ')'; |
|
| 239 | + $sql .= '('.implode(', ', array_keys($quotedData)).') VALUES ('.implode(', ', $quotedData).')'; |
|
| 240 | 240 | |
| 241 | 241 | // execute (most likely throws PDOException if there is an error) |
| 242 | 242 | if ($dbh->exec($sql) === false) { |
@@ -268,10 +268,10 @@ discard block |
||
| 268 | 268 | |
| 269 | 269 | $where = array(); |
| 270 | 270 | foreach ($idColumns as $columnName) { |
| 271 | - $where[] = $quoteIdentifier($columnName) . ' = ' . Rorm::quote($dbh, $this->$columnName); |
|
| 271 | + $where[] = $quoteIdentifier($columnName).' = '.Rorm::quote($dbh, $this->$columnName); |
|
| 272 | 272 | } |
| 273 | 273 | |
| 274 | - $sql = 'DELETE FROM ' . $quoteIdentifier(static::getTable()) . ' WHERE ' . implode(' AND ', $where); |
|
| 274 | + $sql = 'DELETE FROM '.$quoteIdentifier(static::getTable()).' WHERE '.implode(' AND ', $where); |
|
| 275 | 275 | |
| 276 | 276 | return $dbh->exec($sql) > 0; |
| 277 | 277 | } |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | { |
| 115 | 115 | $select = $expression; |
| 116 | 116 | if ($as !== null) { |
| 117 | - $select .= ' AS ' . $this->quoteIdentifier($as); |
|
| 117 | + $select .= ' AS '.$this->quoteIdentifier($as); |
|
| 118 | 118 | } |
| 119 | 119 | $this->select[] = $select; |
| 120 | 120 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | */ |
| 131 | 131 | public function where($column, $value) |
| 132 | 132 | { |
| 133 | - $this->where[] = $this->quoteIdentifier($column) . ' = ?'; |
|
| 133 | + $this->where[] = $this->quoteIdentifier($column).' = ?'; |
|
| 134 | 134 | $this->buildParams[] = $value; |
| 135 | 135 | return $this; |
| 136 | 136 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | */ |
| 143 | 143 | public function whereNot($column, $value) |
| 144 | 144 | { |
| 145 | - $this->where[] = $this->quoteIdentifier($column) . ' != ?'; |
|
| 145 | + $this->where[] = $this->quoteIdentifier($column).' != ?'; |
|
| 146 | 146 | $this->buildParams[] = $value; |
| 147 | 147 | return $this; |
| 148 | 148 | } |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | */ |
| 178 | 178 | public function whereExpr($column, $expression) |
| 179 | 179 | { |
| 180 | - $this->where[] = $this->quoteIdentifier($column) . ' = ' . $expression; |
|
| 180 | + $this->where[] = $this->quoteIdentifier($column).' = '.$expression; |
|
| 181 | 181 | return $this; |
| 182 | 182 | } |
| 183 | 183 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | */ |
| 205 | 205 | public function whereLt($column, $value) |
| 206 | 206 | { |
| 207 | - $this->where[] = $this->quoteIdentifier($column) . ' < ?'; |
|
| 207 | + $this->where[] = $this->quoteIdentifier($column).' < ?'; |
|
| 208 | 208 | $this->buildParams[] = $value; |
| 209 | 209 | return $this; |
| 210 | 210 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | */ |
| 219 | 219 | public function whereLte($column, $value) |
| 220 | 220 | { |
| 221 | - $this->where[] = $this->quoteIdentifier($column) . ' <= ?'; |
|
| 221 | + $this->where[] = $this->quoteIdentifier($column).' <= ?'; |
|
| 222 | 222 | $this->buildParams[] = $value; |
| 223 | 223 | return $this; |
| 224 | 224 | } |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | */ |
| 233 | 233 | public function whereGt($column, $value) |
| 234 | 234 | { |
| 235 | - $this->where[] = $this->quoteIdentifier($column) . ' > ?'; |
|
| 235 | + $this->where[] = $this->quoteIdentifier($column).' > ?'; |
|
| 236 | 236 | $this->buildParams[] = $value; |
| 237 | 237 | return $this; |
| 238 | 238 | } |
@@ -246,7 +246,7 @@ discard block |
||
| 246 | 246 | */ |
| 247 | 247 | public function whereGte($column, $value) |
| 248 | 248 | { |
| 249 | - $this->where[] = $this->quoteIdentifier($column) . ' >= ?'; |
|
| 249 | + $this->where[] = $this->quoteIdentifier($column).' >= ?'; |
|
| 250 | 250 | $this->buildParams[] = $value; |
| 251 | 251 | return $this; |
| 252 | 252 | } |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | */ |
| 258 | 258 | public function whereNotNull($column) |
| 259 | 259 | { |
| 260 | - $this->where[] = $this->quoteIdentifier($column) . ' IS NOT NULL'; |
|
| 260 | + $this->where[] = $this->quoteIdentifier($column).' IS NOT NULL'; |
|
| 261 | 261 | return $this; |
| 262 | 262 | } |
| 263 | 263 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | */ |
| 268 | 268 | public function whereNull($column) |
| 269 | 269 | { |
| 270 | - $this->where[] = $this->quoteIdentifier($column) . ' IS NULL'; |
|
| 270 | + $this->where[] = $this->quoteIdentifier($column).' IS NULL'; |
|
| 271 | 271 | return $this; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -278,8 +278,8 @@ discard block |
||
| 278 | 278 | */ |
| 279 | 279 | public function whereIn($column, array $data) |
| 280 | 280 | { |
| 281 | - $this->where[] = $this->quoteIdentifier($column) . ' IN (' . |
|
| 282 | - substr(str_repeat('?, ', count($data)), 0, -2) . |
|
| 281 | + $this->where[] = $this->quoteIdentifier($column).' IN ('. |
|
| 282 | + substr(str_repeat('?, ', count($data)), 0, -2). |
|
| 283 | 283 | ')'; |
| 284 | 284 | $this->buildParams = array_merge($this->buildParams, $data); |
| 285 | 285 | return $this; |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | */ |
| 293 | 293 | public function orderByAsc($column) |
| 294 | 294 | { |
| 295 | - $this->order[] = $this->quoteIdentifier($column) . ' ASC'; |
|
| 295 | + $this->order[] = $this->quoteIdentifier($column).' ASC'; |
|
| 296 | 296 | return $this; |
| 297 | 297 | } |
| 298 | 298 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | public function orderByDesc($column) |
| 304 | 304 | { |
| 305 | - $this->order[] = $this->quoteIdentifier($column) . ' DESC'; |
|
| 305 | + $this->order[] = $this->quoteIdentifier($column).' DESC'; |
|
| 306 | 306 | return $this; |
| 307 | 307 | } |
| 308 | 308 | |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | // from |
| 365 | - $query .= ' FROM ' . $this->quoteIdentifier($this->table); |
|
| 365 | + $query .= ' FROM '.$this->quoteIdentifier($this->table); |
|
| 366 | 366 | |
| 367 | 367 | // where |
| 368 | 368 | if (!empty($this->where)) { |
| 369 | - $query .= ' WHERE ' . implode(' AND ', $this->where); |
|
| 369 | + $query .= ' WHERE '.implode(' AND ', $this->where); |
|
| 370 | 370 | |
| 371 | 371 | // params (CAUTION, we override the array, faster and not used before!) |
| 372 | 372 | $params = $this->buildParams; |
@@ -374,16 +374,16 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | // order |
| 376 | 376 | if (!empty($this->order)) { |
| 377 | - $query .= ' ORDER BY ' . implode(', ', $this->order); |
|
| 377 | + $query .= ' ORDER BY '.implode(', ', $this->order); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | // limit |
| 381 | 381 | if ($this->limit !== null) { |
| 382 | - $query .= ' LIMIT ' . (int)$this->limit; |
|
| 382 | + $query .= ' LIMIT '.(int)$this->limit; |
|
| 383 | 383 | |
| 384 | 384 | // offset |
| 385 | 385 | if ($this->offset !== null) { |
| 386 | - $query .= ' OFFSET ' . (int)$this->offset; |
|
| 386 | + $query .= ' OFFSET '.(int)$this->offset; |
|
| 387 | 387 | } |
| 388 | 388 | } |
| 389 | 389 | |
@@ -98,12 +98,12 @@ |
||
| 98 | 98 | if (static::isMySQL($dbh)) { |
| 99 | 99 | // mysql mode |
| 100 | 100 | return function ($identifier) { |
| 101 | - return '`' . str_replace('`', '``', $identifier) . '`'; |
|
| 101 | + return '`'.str_replace('`', '``', $identifier).'`'; |
|
| 102 | 102 | }; |
| 103 | 103 | } else { |
| 104 | 104 | // standard sql mode |
| 105 | 105 | return function ($identifier) { |
| 106 | - return '"' . str_replace('"', '""', $identifier) . '"'; |
|
| 106 | + return '"'.str_replace('"', '""', $identifier).'"'; |
|
| 107 | 107 | }; |
| 108 | 108 | } |
| 109 | 109 | } |