@@ -93,8 +93,7 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public function applySqlFunction(string $function, string $column) |
95 | 95 | { |
96 | - return ($function ? ($function == 'unixepoch' ? "DATETIME($column, '$function')" : |
|
97 | - ($function == 'count distinct' ? 'COUNT(DISTINCT ' : strtoupper("$function(")) . "$column)") : $column); |
|
96 | + return ($function ? ($function == 'unixepoch' ? "DATETIME($column, '$function')" : ($function == 'count distinct' ? 'COUNT(DISTINCT ' : strtoupper("$function(")) . "$column)") : $column); |
|
98 | 97 | } |
99 | 98 | |
100 | 99 | /** |
@@ -169,7 +168,7 @@ discard block |
||
169 | 168 | } |
170 | 169 | } |
171 | 170 | if (\preg_match("~ IDENTIFIED BY PASSWORD '([^']+)~", $row[0], $match)) { |
172 | - $password = $match[1]; |
|
171 | + $password = $match[1]; |
|
173 | 172 | } |
174 | 173 | } |
175 | 174 | } |
@@ -239,8 +239,7 @@ discard block |
||
239 | 239 | $row[$key] = '"' . \str_replace('"', '""', $val) . '"'; |
240 | 240 | } |
241 | 241 | } |
242 | - $separator = $this->options['format'] == 'csv' ? ',' : |
|
243 | - ($this->options['format'] == 'tsv' ? "\t" : ';'); |
|
242 | + $separator = $this->options['format'] == 'csv' ? ',' : ($this->options['format'] == 'tsv' ? "\t" : ';'); |
|
244 | 243 | $this->queries[] = \implode($separator, $row); |
245 | 244 | } |
246 | 245 | |
@@ -354,7 +353,7 @@ discard block |
||
354 | 353 | } else { |
355 | 354 | if (!$insert) { |
356 | 355 | $insert = 'INSERT INTO ' . $this->driver->table($table) . ' (' . |
357 | - \implode(', ', \array_map(function ($key) { |
|
356 | + \implode(', ', \array_map(function($key) { |
|
358 | 357 | return $this->driver->escapeId($key); |
359 | 358 | }, $keys)) . ') VALUES'; |
360 | 359 | } |
@@ -526,8 +526,7 @@ |
||
526 | 526 | } |
527 | 527 | |
528 | 528 | $this->dumpTablesAndViews($database); |
529 | - } |
|
530 | - catch (\Exception $e) { |
|
529 | + } catch (\Exception $e) { |
|
531 | 530 | return $e->getMessage(); |
532 | 531 | } |
533 | 532 | } |
@@ -101,8 +101,7 @@ discard block |
||
101 | 101 | $maxlength = (!\preg_match('~int~', $field->type) && |
102 | 102 | \preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ? |
103 | 103 | ((\preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) + |
104 | - (($match[2] ?? false) && !$unsigned ? 1 : 0)) : |
|
105 | - ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
104 | + (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
106 | 105 | if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && \preg_match('~time~', $field->type)) { |
107 | 106 | $maxlength += 7; // microtime |
108 | 107 | } |
@@ -243,8 +242,7 @@ discard block |
||
243 | 242 | $value = ( |
244 | 243 | $row !== null ? ( |
245 | 244 | $row[$name] != "" && $this->driver->jush() == "sql" && \preg_match("~enum|set~", $field->type) ? |
246 | - (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : |
|
247 | - (\is_bool($row[$name]) ? +$row[$name] : $row[$name]) |
|
245 | + (\is_array($row[$name]) ? \array_sum($row[$name]) : +$row[$name]) : (\is_bool($row[$name]) ? +$row[$name] : $row[$name]) |
|
248 | 246 | ) : ( |
249 | 247 | !$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default) |
250 | 248 | ) |
@@ -254,7 +252,7 @@ discard block |
||
254 | 252 | } |
255 | 253 | $function = ( |
256 | 254 | $queryOptions["save"] |
257 | - ? (string)$queryOptions["function"][$name] |
|
255 | + ? (string) $queryOptions["function"][$name] |
|
258 | 256 | : ( |
259 | 257 | $update && \preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) |
260 | 258 | ? "now" |