This commit is contained in:
2021-08-10 10:52:05 +08:00
parent 81132af603
commit c03a93ee98
2 changed files with 3 additions and 5 deletions
+2 -2
View File
@@ -496,10 +496,10 @@ trait QueryTrait
$conditionArray = $this->makeClosureFunction($conditionArray); $conditionArray = $this->makeClosureFunction($conditionArray);
} }
if (func_num_args() == 3) { if (func_num_args() > 1) {
[$conditionArray, $opera, $value] = $this->opera(...func_get_args()); [$conditionArray, $opera, $value] = $this->opera(...func_get_args());
$conditionArray = $this->sprintf($conditionArray, $opera, $value); $conditionArray = $this->sprintf($conditionArray, $value, $opera);
} }
$this->where = ['(' . implode(' AND ', $this->where) . ') OR (' . $conditionArray . ')']; $this->where = ['(' . implode(' AND ', $this->where) . ') OR (' . $conditionArray . ')'];
+1 -3
View File
@@ -6,10 +6,8 @@ namespace Database\Traits;
use Database\ActiveQuery; use Database\ActiveQuery;
use Database\ISqlBuilder; use Database\ISqlBuilder;
use Database\Query;
use Exception; use Exception;
use JetBrains\PhpStorm\Pure; use JetBrains\PhpStorm\Pure;
use Snowflake\Exception\NotFindClassException;
/** /**
@@ -73,7 +71,7 @@ class When
if (!empty($this->else)) { if (!empty($this->else)) {
$prefix .= ' ELSE ' . $this->else; $prefix .= ' ELSE ' . $this->else;
} }
return $prefix . ' END'; return '(' . $prefix . ' END)';
} }
} }