exp表达式查询改进

This commit is contained in:
thinkphp
2018-04-14 12:43:52 +08:00
parent 111353f066
commit f34e91deb2
2 changed files with 18 additions and 7 deletions

View File

@@ -388,7 +388,11 @@ abstract class Builder
}
} elseif ('EXP' == $exp) {
// 表达式查询
$whereStr .= '( ' . $key . ' ' . ($value instanceof Expression ? $value->getValue() : $value) . ' )';
if ($value instanceof Expression) {
$whereStr .= '( ' . $key . ' ' . $value->getValue() . ' )';
} else {
throw new Exception('where express error:' . $exp);
}
} elseif (in_array($exp, ['NOT NULL', 'NULL'])) {
// NULL 查询
$whereStr .= $key . ' IS ' . $exp;