From 1e4d8c8165b695e141e3fb8161dec3bfddeec083 Mon Sep 17 00:00:00 2001 From: ThinkPHP Date: Sat, 20 Apr 2013 17:11:18 +0800 Subject: [PATCH] =?UTF-8?q?Traits/Think/Model/Query=20=E4=B8=AD=E7=9A=84qu?= =?UTF-8?q?ery=E5=92=8Cexecute=E6=96=B9=E6=B3=95=E9=87=87=E7=94=A8?= =?UTF-8?q?=E5=8F=82=E6=95=B0=E7=BB=91=E5=AE=9A=E6=9C=BA=E5=88=B6=20parseS?= =?UTF-8?q?ql=E6=96=B9=E6=B3=95=E7=8B=AC=E7=AB=8B=E4=BD=BF=E7=94=A8=20?= =?UTF-8?q?=E4=BF=9D=E7=95=99=E5=8E=9F=E6=9D=A5=E7=9A=84=E9=A2=84=E5=A4=84?= =?UTF-8?q?=E7=90=86=E6=9C=BA=E5=88=B6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Traits/Think/Model/Query.php | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/Traits/Think/Model/Query.php b/Traits/Think/Model/Query.php index 3c19b4e8..e67cd495 100644 --- a/Traits/Think/Model/Query.php +++ b/Traits/Think/Model/Query.php @@ -46,32 +46,22 @@ trait Query { * SQL查询 * @access public * @param string $sql SQL指令 - * @param mixed $parse 是否需要解析SQL + * @param array $bind 参数绑定 * @return mixed */ - public function query($sql,$parse=false) { - if(!is_bool($parse) && !is_array($parse)) { - $parse = func_get_args(); - array_shift($parse); - } - $sql = $this->parseSql($sql,$parse); - return $this->db->query($sql); + public function query($sql,$bind=[]) { + return $this->db->query($sql,$bind); } /** * 执行SQL语句 * @access public * @param string $sql SQL指令 - * @param mixed $parse 是否需要解析SQL + * @param array $bind 参数绑定 * @return false | integer */ - public function execute($sql,$parse=false) { - if(!is_bool($parse) && !is_array($parse)) { - $parse = func_get_args(); - array_shift($parse); - } - $sql = $this->parseSql($sql,$parse); - return $this->db->execute($sql); + public function execute($sql,$bind=[]) { + return $this->db->execute($sql,$bind); } /** @@ -81,7 +71,7 @@ trait Query { * @param boolean $parse 是否需要解析SQL * @return string */ - protected function parseSql($sql,$parse) { + public function parseSql($sql,$parse) { // 分析表达式 if(true === $parse) { $options = $this->_parseOptions();