@@ -114,7 +114,7 @@ |
||
114 | 114 | * |
115 | 115 | * @return array |
116 | 116 | */ |
117 | - public function userTypes() ; |
|
117 | + public function userTypes(); |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * Get existing schemas |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | private function fkFields(ForeignKeyEntity $foreignKey) |
94 | 94 | { |
95 | - $escape = function ($idf) { return $this->escapeId($idf); }; |
|
95 | + $escape = function($idf) { return $this->escapeId($idf); }; |
|
96 | 96 | return [ |
97 | 97 | implode(', ', array_map($escape, $foreignKey->source)), |
98 | 98 | implode(', ', array_map($escape, $foreignKey->target)), |
@@ -186,8 +186,7 @@ discard block |
||
186 | 186 | $query .= ' WHERE ' . implode(' AND ', $where); |
187 | 187 | } |
188 | 188 | return ($isGroup && ($this->driver->jush() == 'sql' || count($groups) == 1) ? |
189 | - 'SELECT COUNT(DISTINCT ' . implode(', ', $groups) . ")$query" : |
|
190 | - 'SELECT COUNT(*)' . ($isGroup ? " FROM (SELECT 1$query GROUP BY " . |
|
189 | + 'SELECT COUNT(DISTINCT ' . implode(', ', $groups) . ")$query" : 'SELECT COUNT(*)' . ($isGroup ? " FROM (SELECT 1$query GROUP BY " . |
|
191 | 190 | implode(', ', $groups) . ') x' : $query) |
192 | 191 | ); |
193 | 192 | } |
@@ -234,8 +233,7 @@ discard block |
||
234 | 233 | */ |
235 | 234 | private function notQuery(QueryEntity $queryEntity, string $found, array &$match) |
236 | 235 | { |
237 | - return preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : |
|
238 | - (preg_match('~^-- |^#~', $found) ? "\n" : preg_quote($found) . "|\\\\."))) . '|$)s', |
|
236 | + return preg_match('(' . ($found == '/*' ? '\*/' : ($found == '[' ? ']' : (preg_match('~^-- |^#~', $found) ? "\n" : preg_quote($found) . "|\\\\."))) . '|$)s', |
|
239 | 237 | $queryEntity->queries, $match, PREG_OFFSET_CAPTURE, $queryEntity->offset) > 0; |
240 | 238 | } |
241 | 239 |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | * |
66 | 66 | * @return boolean |
67 | 67 | */ |
68 | - public function createDatabase(string $database, string $collation) ; |
|
68 | + public function createDatabase(string $database, string $collation); |
|
69 | 69 | |
70 | 70 | /** |
71 | 71 | * Drop a database |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * |
92 | 92 | * @return array |
93 | 93 | */ |
94 | - public function routineLanguages() ; |
|
94 | + public function routineLanguages(); |
|
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Get server variables |
@@ -228,11 +228,9 @@ discard block |
||
228 | 228 | $bUseSqlLike = $this->driver->jush() === 'sql' && is_numeric($value) && preg_match('~\.~', $value); |
229 | 229 | return $column . ($bUseSqlLike ? |
230 | 230 | // LIKE because of floats but slow with ints |
231 | - " LIKE " . $this->driver->quote($value) : |
|
232 | - ($this->driver->jush() === 'mssql' ? |
|
231 | + " LIKE " . $this->driver->quote($value) : ($this->driver->jush() === 'mssql' ? |
|
233 | 232 | // LIKE because of text |
234 | - " LIKE " . $this->driver->quote(preg_replace('~[_%[]~', '[\0]', $value)) : |
|
235 | - //! enum and set |
|
233 | + " LIKE " . $this->driver->quote(preg_replace('~[_%[]~', '[\0]', $value)) : //! enum and set |
|
236 | 234 | " = " . $this->driver->unconvertField($field, $this->driver->quote($value)))); |
237 | 235 | } |
238 | 236 | |
@@ -247,8 +245,7 @@ discard block |
||
247 | 245 | { |
248 | 246 | $bCollate = $this->driver->jush() === 'sql' && |
249 | 247 | preg_match('~char|text~', $field->type) && preg_match("~[^ -@]~", $value); |
250 | - return !$bCollate ? '' : |
|
251 | - // not just [a-z] to catch non-ASCII characters |
|
248 | + return !$bCollate ? '' : // not just [a-z] to catch non-ASCII characters |
|
252 | 249 | "$column = " . $this->driver->quote($value) . " COLLATE " . $this->driver->charset() . "_bin"; |
253 | 250 | } |
254 | 251 | |
@@ -264,7 +261,7 @@ discard block |
||
264 | 261 | { |
265 | 262 | $clauses = []; |
266 | 263 | $wheres = $where["where"] ?? []; |
267 | - foreach ((array) $wheres as $key => $value) { |
|
264 | + foreach ((array)$wheres as $key => $value) { |
|
268 | 265 | $key = $this->driver->bracketEscape($key, 1); // 1 - back |
269 | 266 | $column = $this->driver->escapeKey($key); |
270 | 267 | $clauses[] = $this->getWhereColumnClause($fields[$key], $column, $value); |
@@ -273,7 +270,7 @@ discard block |
||
273 | 270 | } |
274 | 271 | } |
275 | 272 | $nulls = $where["null"] ?? []; |
276 | - foreach ((array) $nulls as $key) { |
|
273 | + foreach ((array)$nulls as $key) { |
|
277 | 274 | $clauses[] = $this->driver->escapeKey($key) . " IS NULL"; |
278 | 275 | } |
279 | 276 | return implode(" AND ", $clauses); |
@@ -14,10 +14,10 @@ |
||
14 | 14 | */ |
15 | 15 | public function html($string): string |
16 | 16 | { |
17 | - if(!$string) { |
|
17 | + if (!$string) { |
|
18 | 18 | return ''; |
19 | 19 | } |
20 | - $string = str_replace("\n", '<br>', $string); |
|
20 | + $string = str_replace("\n", '<br>', $string); |
|
21 | 21 | return str_replace("\0", '�', htmlspecialchars($string, ENT_QUOTES, 'utf-8')); |
22 | 22 | } |
23 | 23 |
@@ -258,7 +258,7 @@ |
||
258 | 258 | public function applyQueries(string $query, array $tables, $escape = null) |
259 | 259 | { |
260 | 260 | if (!$escape) { |
261 | - $escape = function ($table) { |
|
261 | + $escape = function($table) { |
|
262 | 262 | return $this->escapeTableName($table); |
263 | 263 | }; |
264 | 264 | } |