mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 07:32:48 +08:00
优化Builder类
This commit is contained in:
@@ -89,24 +89,22 @@ abstract class Builder
|
|||||||
|
|
||||||
$result = [];
|
$result = [];
|
||||||
foreach ($data as $key => $val) {
|
foreach ($data as $key => $val) {
|
||||||
|
$item = $this->parseKey($key);
|
||||||
if (!in_array($key, $fields, true)) {
|
if (!in_array($key, $fields, true)) {
|
||||||
if ($options['strict']) {
|
if ($options['strict']) {
|
||||||
throw new Exception('fields not exists:[' . $key . ']');
|
throw new Exception('fields not exists:[' . $key . ']');
|
||||||
}
|
}
|
||||||
} else {
|
} else if (isset($val[0]) && 'exp' == $val[0]) {
|
||||||
$item = $this->parseKey($key);
|
$result[$item] = $val[1];
|
||||||
if (isset($val[0]) && 'exp' == $val[0]) {
|
} elseif (is_null($val)) {
|
||||||
$result[$item] = $val[1];
|
$result[$item] = 'NULL';
|
||||||
} elseif (is_null($val)) {
|
} elseif (is_scalar($val)) {
|
||||||
$result[$item] = 'NULL';
|
// 过滤非标量数据
|
||||||
} elseif (is_scalar($val)) {
|
if ($this->query->isBind(substr($val, 1))) {
|
||||||
// 过滤非标量数据
|
$result[$item] = $val;
|
||||||
if ($this->query->isBind(substr($val, 1))) {
|
} else {
|
||||||
$result[$item] = $val;
|
$this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
|
||||||
} else {
|
$result[$item] = ':' . $key;
|
||||||
$this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
|
|
||||||
$result[$item] = ':' . $key;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user