|
@@ -97,8 +97,7 @@ discard block |
|
|
block discarded – undo |
|
97
|
97
|
$maxlength = (!preg_match('~int~', $field->type) && |
|
98
|
98
|
preg_match('~^(\d+)(,(\d+))?$~', $field->length, $match) ? |
|
99
|
99
|
((preg_match("~binary~", $field->type) ? 2 : 1) * $match[1] + (($match[3] ?? null) ? 1 : 0) + |
|
100
|
|
- (($match[2] ?? false) && !$unsigned ? 1 : 0)) : |
|
101
|
|
- ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
|
100
|
+ (($match[2] ?? false) && !$unsigned ? 1 : 0)) : ($this->driver->typeExists($field->type) ? $this->driver->type($field->type) + ($unsigned ? 0 : 1) : 0)); |
|
102
|
101
|
if ($this->driver->jush() == 'sql' && $this->driver->minVersion(5.6) && preg_match('~time~', $field->type)) { |
|
103
|
102
|
$maxlength += 7; // microtime |
|
104
|
103
|
} |
|
@@ -333,12 +332,8 @@ discard block |
|
|
block discarded – undo |
|
333
|
332
|
// } |
|
334
|
333
|
$value = ($row !== null ? |
|
335
|
334
|
($row[$name] != "" && $this->driver->jush() == "sql" && preg_match("~enum|set~", $field->type) ? |
|
336
|
|
- (is_array($row[$name]) ? array_sum($row[$name]) : +$row[$name]) : |
|
337
|
|
- (is_bool($row[$name]) ? +$row[$name] : $row[$name])) : |
|
338
|
|
- (!$update && $field->autoIncrement ? "" : (isset($queryOptions["select"]) ? false : $default))); |
|
339
|
|
- $function = ($queryOptions["save"] ? (string)$queryOptions["function"][$name] : |
|
340
|
|
- ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : |
|
341
|
|
- ($value === false ? null : ($value !== null ? '' : 'NULL')))); |
|
|
335
|
+ (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))); |
|
|
336
|
+ $function = ($queryOptions["save"] ? (string) $queryOptions["function"][$name] : ($update && preg_match('~^CURRENT_TIMESTAMP~i', $field->onUpdate) ? "now" : ($value === false ? null : ($value !== null ? '' : 'NULL')))); |
|
342
|
337
|
if (!$update && $value == $field->default && preg_match('~^[\w.]+\(~', $value)) { |
|
343
|
338
|
$function = "SQL"; |
|
344
|
339
|
} |