内核更新
This commit is contained in:
@@ -98,14 +98,18 @@ abstract class Builder
|
||||
$result = [];
|
||||
foreach ($data as $key => $val) {
|
||||
$item = $this->parseKey($key, $options);
|
||||
if (is_object($val) && method_exists($val, '__toString')) {
|
||||
// 对象数据写入
|
||||
$val = $val->__toString();
|
||||
}
|
||||
if (false === strpos($key, '.') && !in_array($key, $fields, true)) {
|
||||
if ($options['strict']) {
|
||||
throw new Exception('fields not exists:[' . $key . ']');
|
||||
}
|
||||
} elseif (isset($val[0]) && 'exp' == $val[0]) {
|
||||
$result[$item] = $val[1];
|
||||
} elseif (is_null($val)) {
|
||||
$result[$item] = 'NULL';
|
||||
} elseif (isset($val[0]) && 'exp' == $val[0]) {
|
||||
$result[$item] = $val[1];
|
||||
} elseif (is_scalar($val)) {
|
||||
// 过滤非标量数据
|
||||
if (0 === strpos($val, ':') && $this->query->isBind(substr($val, 1))) {
|
||||
@@ -115,9 +119,6 @@ abstract class Builder
|
||||
$this->query->bind('__data__' . $key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
|
||||
$result[$item] = ':__data__' . $key;
|
||||
}
|
||||
} elseif (is_object($val) && method_exists($val, '__toString')) {
|
||||
// 对象数据写入
|
||||
$result[$item] = $val->__toString();
|
||||
}
|
||||
}
|
||||
return $result;
|
||||
@@ -279,6 +280,13 @@ abstract class Builder
|
||||
|
||||
$whereStr .= empty($whereStr) ? substr(implode(' ', $str), strlen($key) + 1) : implode(' ', $str);
|
||||
}
|
||||
if (!empty($options['soft_delete'])) {
|
||||
// 附加软删除条件
|
||||
list($field, $condition) = $options['soft_delete'];
|
||||
|
||||
$whereStr = $whereStr ? '( ' . $whereStr . ' ) AND ' : '';
|
||||
$whereStr = $whereStr . $this->parseWhereItem($field, $condition, '', $options, $binds);
|
||||
}
|
||||
return $whereStr;
|
||||
}
|
||||
|
||||
@@ -379,7 +387,7 @@ abstract class Builder
|
||||
} else {
|
||||
$zone = implode(',', $this->parseValue($value, $field));
|
||||
}
|
||||
$whereStr .= $key . ' ' . $exp . ' (' . $zone . ')';
|
||||
$whereStr .= $key . ' ' . $exp . ' (' . (empty($zone) ? "''" : $zone) . ')';
|
||||
}
|
||||
} elseif (in_array($exp, ['NOT BETWEEN', 'BETWEEN'])) {
|
||||
// BETWEEN 查询
|
||||
|
||||
Reference in New Issue
Block a user