内核更新,标签的更新

This commit is contained in:
2016-06-29 15:02:59 +08:00
parent c8e979b159
commit c98ca32ede
16 changed files with 354 additions and 342 deletions

View File

@@ -138,8 +138,6 @@ abstract class Builder
{
if (is_string($value)) {
$value = strpos($value, ':') === 0 && $this->query->isBind(substr($value, 1)) ? $value : $this->connection->quote($value);
} elseif (is_array($value) && is_string($value[0]) && strtolower($value[0]) == 'exp') {
$value = $value[1];
} elseif (is_array($value)) {
$value = array_map([$this, 'parseValue'], $value);
} elseif (is_bool($value)) {

View File

@@ -178,16 +178,15 @@ class Query
* @access public
* @param string $sql sql指令
* @param array $bind 参数绑定
* @param boolean $fetch 不执行只是获取SQL
* @param boolean $master 是否在主服务器读操作
* @param bool|string $class 指定返回的数据集对象
* @return mixed
* @throws BindParamException
* @throws PDOException
*/
public function query($sql, $bind = [], $fetch = false, $master = false, $class = false)
public function query($sql, $bind = [], $master = false, $class = false)
{
return $this->connection->query($sql, $bind, $fetch, $master, $class);
return $this->connection->query($sql, $bind, $master, $class);
}
/**
@@ -195,16 +194,15 @@ class Query
* @access public
* @param string $sql sql指令
* @param array $bind 参数绑定
* @param boolean $fetch 不执行只是获取SQL
* @param boolean $getLastInsID 是否获取自增ID
* @param boolean $sequence 自增序列名
* @return int
* @throws BindParamException
* @throws PDOException
*/
public function execute($sql, $bind = [], $fetch = false, $getLastInsID = false, $sequence = null)
public function execute($sql, $bind = [], $getLastInsID = false, $sequence = null)
{
return $this->connection->execute($sql, $bind, $fetch, $getLastInsID, $sequence);
return $this->connection->execute($sql, $bind, $getLastInsID, $sequence);
}
/**
@@ -1466,7 +1464,7 @@ class Query
unset($this->options['with_field']);
}
}
$this->field($field, false, $joinTable, $joinAlias, $joinName . '__');
$this->field($field, false, $joinTable, $joinAlias, $relation . '__');
$i++;
} elseif ($closure) {
$with[$key] = $closure;
@@ -1873,7 +1871,7 @@ class Query
* @throws Exception
* @throws PDOException
*/
public function selectOrFail($data = [])
public function selectOrFail($data = null)
{
return $this->failException(true)->select($data);
}
@@ -1887,7 +1885,7 @@ class Query
* @throws Exception
* @throws PDOException
*/
public function findOrFail($data = [])
public function findOrFail($data = null)
{
return $this->failException(true)->find($data);
}
@@ -1950,22 +1948,22 @@ class Query
/**
* 删除记录
* @access public
* @param array $data 表达式
* @param mixed $data 表达式 true 表示强制删除
* @return int
* @throws Exception
* @throws PDOException
*/
public function delete($data = [])
public function delete($data = null)
{
// 分析查询表达式
$options = $this->parseExpress();
if (!empty($data)) {
if (!is_null($data) && true !== $data) {
// AR模式分析主键条件
$this->parsePkWhere($data, $options);
}
if (empty($options['where'])) {
if (true !== $data && empty($options['where'])) {
// 如果条件为空 不进行删除操作 除非设置 1=1
throw new Exception('delete without condition');
}