This commit is contained in:
2024-12-18 11:31:15 +08:00
parent 5b4a6b9caa
commit c6b88256e3
+2 -2
View File
@@ -189,7 +189,7 @@ class SqlBuilder extends Component
if (is_null($value)) { if (is_null($value)) {
return $keys; return $keys;
} }
if (is_string($value) && $this->isMath($value)) { if ($this->isMath($value)) {
$keys[] = $key . '=' . $key . ' ' . $value; $keys[] = $key . '=' . $key . ' ' . $value;
} else { } else {
$this->query->pushParam($value); $this->query->pushParam($value);
@@ -205,7 +205,7 @@ class SqlBuilder extends Component
*/ */
private function isMath(string $value): bool private function isMath(string $value): bool
{ {
return str_starts_with($value, '+ ') || str_starts_with($value, '- '); return (bool)preg_match('/^[+|-]\s\d+$/', $value);
} }