@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace voku\db; |
| 6 | 6 | |
@@ -23,6 +23,6 @@ discard block |
||
| 23 | 23 | */ |
| 24 | 24 | public function __toString() |
| 25 | 25 | { |
| 26 | - return $this->source . ' ' . $this->operator . ' ' . $this->target; |
|
| 26 | + return $this->source.' '.$this->operator.' '.$this->target; |
|
| 27 | 27 | } |
| 28 | 28 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace voku\db; |
| 6 | 6 | |
@@ -21,9 +21,9 @@ discard block |
||
| 21 | 21 | $delimiter = (string)($this->delimiter ?: ','); |
| 22 | 22 | |
| 23 | 23 | if ($this->start) { |
| 24 | - return $this->start . implode($delimiter, $this->target->getArray()) . ($this->end ?: ')'); |
|
| 24 | + return $this->start.implode($delimiter, $this->target->getArray()).($this->end ?: ')'); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - return '(' . implode($delimiter, $this->target->getArray()) . ($this->end ?: ')'); |
|
| 27 | + return '('.implode($delimiter, $this->target->getArray()).($this->end ?: ')'); |
|
| 28 | 28 | } |
| 29 | 29 | } |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -declare(strict_types=1); |
|
| 3 | +declare(strict_types = 1); |
|
| 4 | 4 | |
| 5 | 5 | namespace voku\db; |
| 6 | 6 | |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | $optimized = 0; |
| 32 | 32 | if (!empty($tables)) { |
| 33 | 33 | foreach ($tables as $table) { |
| 34 | - $optimize = 'OPTIMIZE TABLE ' . $dbConnection->quote_string($table); |
|
| 34 | + $optimize = 'OPTIMIZE TABLE '.$dbConnection->quote_string($table); |
|
| 35 | 35 | $result = $dbConnection->query($optimize); |
| 36 | 36 | if ($result) { |
| 37 | 37 | $optimized++; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $optimized = 0; |
| 60 | 60 | if (!empty($tables)) { |
| 61 | 61 | foreach ($tables as $table) { |
| 62 | - $optimize = 'REPAIR TABLE ' . $dbConnection->quote_string($table); |
|
| 62 | + $optimize = 'REPAIR TABLE '.$dbConnection->quote_string($table); |
|
| 63 | 63 | $result = $dbConnection->query($optimize); |
| 64 | 64 | if ($result) { |
| 65 | 65 | $optimized++; |
@@ -176,23 +176,23 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | $whereSQL = $dbConnection->_parseArrayPair($whereArray, 'AND'); |
| 178 | 178 | if ($whereSQL) { |
| 179 | - $whereSQL = 'AND ' . $whereSQL; |
|
| 179 | + $whereSQL = 'AND '.$whereSQL; |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | if ($databaseName) { |
| 183 | - $databaseName = $dbConnection->quote_string(trim($databaseName)) . '.'; |
|
| 183 | + $databaseName = $dbConnection->quote_string(trim($databaseName)).'.'; |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | // get the row |
| 187 | - $query = 'SELECT ' . $dbConnection->quote_string($searchFieldName) . ', ' . $dbConnection->quote_string($idFieldName) . ' |
|
| 188 | - FROM ' . $databaseName . $dbConnection->quote_string($table) . ' |
|
| 187 | + $query = 'SELECT '.$dbConnection->quote_string($searchFieldName).', '.$dbConnection->quote_string($idFieldName).' |
|
| 188 | + FROM ' . $databaseName.$dbConnection->quote_string($table).' |
|
| 189 | 189 | WHERE 1 = 1 |
| 190 | - ' . $whereSQL . ' |
|
| 190 | + ' . $whereSQL.' |
|
| 191 | 191 | '; |
| 192 | 192 | |
| 193 | 193 | if ($useCache === true) { |
| 194 | 194 | $cache = new Cache(null, null, false, $useCache); |
| 195 | - $cacheKey = 'sql-phonetic-search-' . md5($query); |
|
| 195 | + $cacheKey = 'sql-phonetic-search-'.md5($query); |
|
| 196 | 196 | |
| 197 | 197 | if ( |
| 198 | 198 | $cache->getCacheIsReady() === true |
@@ -322,10 +322,10 @@ discard block |
||
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if ($databaseName) { |
| 325 | - $databaseName = $dbConnection->quote_string(trim($databaseName)) . '.'; |
|
| 325 | + $databaseName = $dbConnection->quote_string(trim($databaseName)).'.'; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - $sql = 'SHOW COLUMNS FROM ' . $databaseName . $dbConnection->escape($table); |
|
| 328 | + $sql = 'SHOW COLUMNS FROM '.$databaseName.$dbConnection->escape($table); |
|
| 329 | 329 | $result = $dbConnection->query($sql); |
| 330 | 330 | |
| 331 | 331 | if ($result && $result->num_rows > 0) { |
@@ -371,17 +371,17 @@ discard block |
||
| 371 | 371 | |
| 372 | 372 | $whereSQL = $dbConnection->_parseArrayPair($whereArray, 'AND'); |
| 373 | 373 | if ($whereSQL) { |
| 374 | - $whereSQL = 'AND ' . $whereSQL; |
|
| 374 | + $whereSQL = 'AND '.$whereSQL; |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | if ($databaseName) { |
| 378 | - $databaseName = $dbConnection->quote_string(trim($databaseName)) . '.'; |
|
| 378 | + $databaseName = $dbConnection->quote_string(trim($databaseName)).'.'; |
|
| 379 | 379 | } |
| 380 | 380 | |
| 381 | 381 | // get the row |
| 382 | - $query = 'SELECT * FROM ' . $databaseName . $dbConnection->quote_string($table) . ' |
|
| 382 | + $query = 'SELECT * FROM '.$databaseName.$dbConnection->quote_string($table).' |
|
| 383 | 383 | WHERE 1 = 1 |
| 384 | - ' . $whereSQL . ' |
|
| 384 | + ' . $whereSQL.' |
|
| 385 | 385 | '; |
| 386 | 386 | $result = $dbConnection->query($query); |
| 387 | 387 | |
@@ -401,11 +401,11 @@ discard block |
||
| 401 | 401 | |
| 402 | 402 | if (!\in_array($fieldName, $ignoreArray, true)) { |
| 403 | 403 | if (\array_key_exists($fieldName, $updateArray)) { |
| 404 | - $insert_keys .= ',' . $fieldName; |
|
| 404 | + $insert_keys .= ','.$fieldName; |
|
| 405 | 405 | $insert_values .= ',?'; |
| 406 | 406 | $bindings[] = $updateArray[$fieldName]; // INFO: do not escape non selected data |
| 407 | 407 | } else { |
| 408 | - $insert_keys .= ',' . $fieldName; |
|
| 408 | + $insert_keys .= ','.$fieldName; |
|
| 409 | 409 | $insert_values .= ',?'; |
| 410 | 410 | $bindings[] = $value; // INFO: do not escape non selected data |
| 411 | 411 | } |
@@ -416,10 +416,10 @@ discard block |
||
| 416 | 416 | $insert_values = ltrim($insert_values, ','); |
| 417 | 417 | |
| 418 | 418 | // insert the "copied" row |
| 419 | - $new_query = 'INSERT INTO ' . $databaseName . $dbConnection->quote_string($table) . ' |
|
| 420 | - (' . $insert_keys . ') |
|
| 419 | + $new_query = 'INSERT INTO '.$databaseName.$dbConnection->quote_string($table).' |
|
| 420 | + (' . $insert_keys.') |
|
| 421 | 421 | VALUES |
| 422 | - (' . $insert_values . ') |
|
| 422 | + (' . $insert_values.') |
|
| 423 | 423 | '; |
| 424 | 424 | return $dbConnection->query($new_query, $bindings); |
| 425 | 425 | } |