@@ -110,8 +110,7 @@ |
||
110 | 110 | $maxlength = (!preg_match('~int~', $field->type) && |
111 | 111 | preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ? |
112 | 112 | ((preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) + |
113 | - (($match[2] ?? false) && !$unsigned ? 1 : 0)) : |
|
114 | - ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
113 | + (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
115 | 114 | if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && preg_match('~time~', $field->type)) { |
116 | 115 | $maxlength += 7; // microtime |
117 | 116 | } |
@@ -128,12 +128,8 @@ discard block |
||
128 | 128 | // } |
129 | 129 | $value = ($row !== null ? |
130 | 130 | ($row[$name] != "" && $this->driver->jush() == "sql" && preg_match("~enum|set~", $field->type) ? |
131 | - (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) : |
|
132 | - (is_bool($row[$name]) ? +$row[$name] : $row[$name])) : |
|
133 | - (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default))); |
|
134 | - $function = ($queryOptions["save"] ? (string)$queryOptions["function"][$name] : |
|
135 | - ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : |
|
136 | - ($value === false ? null : ($value !== null ? '' : 'NULL')))); |
|
131 | + (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) : (is_bool($row[$name]) ? +$row[$name] : $row[$name])) : (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default))); |
|
132 | + $function = ($queryOptions["save"] ? (string) $queryOptions["function"][$name] : ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL')))); |
|
137 | 133 | if (!$update && $value == $field->default && preg_match('~^[\w.]+\(~', $value)) { |
138 | 134 | $function = "SQL"; |
139 | 135 | } |
@@ -224,7 +220,7 @@ discard block |
||
224 | 220 | */ |
225 | 221 | public function insertItem(string $table, array $queryOptions): array |
226 | 222 | { |
227 | - list($fields, ,) = $this->getFields($table, $queryOptions); |
|
223 | + list($fields,,) = $this->getFields($table, $queryOptions); |
|
228 | 224 | |
229 | 225 | // From edit.inc.php |
230 | 226 | $values = []; |