内核更新
This commit is contained in:
@@ -194,25 +194,24 @@ class Query
|
||||
* @access public
|
||||
* @param string $sql sql指令
|
||||
* @param array $bind 参数绑定
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param boolean $sequence 自增序列名
|
||||
* @return int
|
||||
* @throws BindParamException
|
||||
* @throws PDOException
|
||||
*/
|
||||
public function execute($sql, $bind = [], $getLastInsID = false, $sequence = null)
|
||||
public function execute($sql, $bind = [])
|
||||
{
|
||||
return $this->connection->execute($sql, $bind, $getLastInsID, $sequence);
|
||||
return $this->connection->execute($sql, $bind);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最近插入的ID
|
||||
* @access public
|
||||
* @param string $sequence 自增序列名
|
||||
* @return string
|
||||
*/
|
||||
public function getLastInsID()
|
||||
public function getLastInsID($sequence = null)
|
||||
{
|
||||
return $this->connection->getLastInsID();
|
||||
return $this->connection->getLastInsID($sequence);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -728,11 +727,11 @@ class Query
|
||||
}
|
||||
if (true === $field) {
|
||||
// 获取全部字段
|
||||
$fields = isset($this->options['allow_field']) ? $this->options['allow_field'] : $this->getTableInfo($tableName, 'fields');
|
||||
$fields = isset($this->options['allow_field']) ? $this->options['allow_field'] : $this->getTableInfo($tableName ?: (isset($this->options['table']) ? $this->options['table'] : ''), 'fields');
|
||||
$field = $fields ?: ['*'];
|
||||
} elseif ($except) {
|
||||
// 字段排除
|
||||
$fields = isset($this->options['allow_field']) ? $this->options['allow_field'] : $this->getTableInfo($tableName, 'fields');
|
||||
$fields = isset($this->options['allow_field']) ? $this->options['allow_field'] : $this->getTableInfo($tableName ?: (isset($this->options['table']) ? $this->options['table'] : ''), 'fields');
|
||||
$field = $fields ? array_diff($fields, $field) : $field;
|
||||
}
|
||||
if ($tableName) {
|
||||
@@ -749,7 +748,7 @@ class Query
|
||||
if (isset($this->options['field'])) {
|
||||
$field = array_merge($this->options['field'], $field);
|
||||
}
|
||||
$this->options['field'] = $field;
|
||||
$this->options['field'] = array_unique($field);
|
||||
return $this;
|
||||
}
|
||||
|
||||
@@ -1415,8 +1414,10 @@ class Query
|
||||
{
|
||||
$types = $this->getFieldsType($options);
|
||||
$bind = [];
|
||||
foreach ($types as $key => $type) {
|
||||
$bind[$key] = $this->getFieldBindType($type);
|
||||
if ($types) {
|
||||
foreach ($types as $key => $type) {
|
||||
$bind[$key] = $this->getFieldBindType($type);
|
||||
}
|
||||
}
|
||||
return $bind;
|
||||
}
|
||||
@@ -1665,7 +1666,7 @@ class Query
|
||||
* @access public
|
||||
* @param mixed $data 数据
|
||||
* @param boolean $replace 是否replace
|
||||
* @param boolean $getLastInsID 是否获取自增ID
|
||||
* @param boolean $getLastInsID 返回自增主键
|
||||
* @param string $sequence 自增序列名
|
||||
* @return integer|string
|
||||
*/
|
||||
@@ -1681,9 +1682,14 @@ class Query
|
||||
// 获取实际执行的SQL语句
|
||||
return $this->connection->getRealSql($sql, $bind);
|
||||
}
|
||||
$sequence = $sequence ?: (isset($options['sequence']) ? $options['sequence'] : null);
|
||||
|
||||
// 执行操作
|
||||
return $this->execute($sql, $bind, $getLastInsID, $sequence);
|
||||
$result = $this->execute($sql, $bind);
|
||||
if ($getLastInsID) {
|
||||
$sequence = $sequence ?: (isset($options['sequence']) ? $options['sequence'] : null);
|
||||
return $this->getLastInsID($sequence);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2031,7 +2037,7 @@ class Query
|
||||
public function chunk($count, $callback, $column = null)
|
||||
{
|
||||
$options = $this->getOptions();
|
||||
$column = $column ?: ($options['pk'] ?: $this->getPk());
|
||||
$column = $column ?: $this->getPk();
|
||||
$bind = $this->bind;
|
||||
$resultSet = $this->limit($count)->order($column, 'asc')->select();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user