注释修改

This commit is contained in:
thinkphp
2016-04-16 23:04:02 +08:00
parent c9e23e61b6
commit e82761c582

View File

@@ -21,7 +21,8 @@ use think\Model;
class Query class Query
{ {
// 数据库Connection对象实例 // 数据库Connection对象实例
protected $connection = null; protected $connection;
// 数据库驱动类型
protected $driver; protected $driver;
// 查询参数 // 查询参数
@@ -36,13 +37,8 @@ class Query
*/ */
public function __construct($connection = '') public function __construct($connection = '')
{ {
if ($connection) { $this->connection = $connection ?: Db::connect();
$this->connection = $connection; $this->driver = $this->connection->getDriverName();
} else {
$this->connection = Db::connect();
}
$this->driver = $this->connection->getDriverName();
} }
/** /**
@@ -937,7 +933,6 @@ class Query
{ {
// 分析查询表达式 // 分析查询表达式
$options = $this->parseExpress(); $options = $this->parseExpress();
//$data = $this->parseData($data, $options);
// 生成SQL语句 // 生成SQL语句
$sql = $this->builder()->insert($data, $options, $replace); $sql = $this->builder()->insert($data, $options, $replace);
// 执行操作 // 执行操作
@@ -1170,6 +1165,11 @@ class Query
return $data; return $data;
} }
/**
* 获取绑定的参数 并清空
* @access public
* @return array
*/
public function getBind() public function getBind()
{ {
$bind = $this->bind; $bind = $this->bind;
@@ -1177,6 +1177,12 @@ class Query
return $bind; return $bind;
} }
/**
* 创建子查询SQL
* @access public
* @param array $data 表达式
* @return string
*/
public function buildSql($sub = true) public function buildSql($sub = true)
{ {
return $sub ? '( ' . $this->select(false) . ' )' : $this->select(false); return $sub ? '( ' . $this->select(false) . ' )' : $this->select(false);
@@ -1211,7 +1217,6 @@ class Query
/** /**
* 分析表达式(可用于查询或者写入操作) * 分析表达式(可用于查询或者写入操作)
* @access public * @access public
* @param array $options 表达式参数
* @return array * @return array
*/ */
public function parseExpress() public function parseExpress()