mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 15:12:48 +08:00
改进多表更新的字段不存在问题
This commit is contained in:
@@ -90,7 +90,7 @@ abstract class Builder
|
|||||||
$result = [];
|
$result = [];
|
||||||
foreach ($data as $key => $val) {
|
foreach ($data as $key => $val) {
|
||||||
$item = $this->parseKey($key, $options);
|
$item = $this->parseKey($key, $options);
|
||||||
if (!in_array($key, $fields, true)) {
|
if (false === strpos($key, '.') && !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 . ']');
|
||||||
}
|
}
|
||||||
@@ -100,9 +100,10 @@ abstract class Builder
|
|||||||
$result[$item] = 'NULL';
|
$result[$item] = 'NULL';
|
||||||
} elseif (is_scalar($val)) {
|
} elseif (is_scalar($val)) {
|
||||||
// 过滤非标量数据
|
// 过滤非标量数据
|
||||||
if ($this->query->isBind(substr($val, 1))) {
|
if (0 === strpos($val, ':') && $this->query->isBind(substr($val, 1))) {
|
||||||
$result[$item] = $val;
|
$result[$item] = $val;
|
||||||
} else {
|
} else {
|
||||||
|
$key = str_replace('.', '_', $key);
|
||||||
$this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
|
$this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
|
||||||
$result[$item] = ':' . $key;
|
$result[$item] = ':' . $key;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user