1、更换编辑器

2、内核升级
This commit is contained in:
2016-12-10 12:21:08 +08:00
parent 766c26d25d
commit 06939cb0f1
389 changed files with 5944 additions and 41188 deletions
+25 -10
View File
@@ -37,22 +37,33 @@ abstract class Builder
/**
* 架构函数
* @access public
* @param Connection $connection 数据库连接对象实例
* @param Connection $connection 数据库连接对象实例
* @param Query $query 数据库查询对象实例
*/
public function __construct(Connection $connection)
public function __construct(Connection $connection, Query $query)
{
$this->connection = $connection;
$this->query = $query;
}
/**
* 设置当前的Query对象实例
* @access protected
* @param Query $query 当前查询对象实例
* 获取当前的连接对象实例
* @access public
* @return void
*/
public function setQuery(Query $query)
public function getConnection()
{
$this->query = $query;
return $this->connection;
}
/**
* 获取当前的Query对象实例
* @access public
* @return void
*/
public function getQuery()
{
return $this->query;
}
/**
@@ -90,7 +101,7 @@ abstract class Builder
$result = [];
foreach ($data as $key => $val) {
$item = $this->parseKey($key, $options);
if (!in_array($key, $fields, true)) {
if (false === strpos($key, '.') && !in_array($key, $fields, true)) {
if ($options['strict']) {
throw new Exception('fields not exists:[' . $key . ']');
}
@@ -100,9 +111,10 @@ abstract class Builder
$result[$item] = 'NULL';
} elseif (is_scalar($val)) {
// 过滤非标量数据
if ($this->query->isBind(substr($val, 1))) {
if (0 === strpos($val, ':') && $this->query->isBind(substr($val, 1))) {
$result[$item] = $val;
} else {
$key = str_replace('.', '_', $key);
$this->query->bind($key, $val, isset($bind[$key]) ? $bind[$key] : PDO::PARAM_STR);
$result[$item] = ':' . $key;
}
@@ -182,6 +194,9 @@ abstract class Builder
$item = [];
foreach ((array) $tables as $key => $table) {
if (!is_numeric($key)) {
if (strpos($key, '@think')) {
$key = strstr($key, '@think', true);
}
$key = $this->parseSqlTable($key);
$item[] = $this->parseKey($key) . ' ' . $this->parseKey($table);
} else {
@@ -422,7 +437,7 @@ abstract class Builder
$info = $type[$key];
}
if (isset($info)) {
if (is_numeric($value) && strtotime($value)) {
if (is_string($value)) {
$value = strtotime($value) ?: $value;
}