mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-08 15:42:48 +08:00
model类的query和execute方法支持参数绑定
This commit is contained in:
@@ -1136,24 +1136,26 @@ class Model
|
|||||||
* SQL查询
|
* SQL查询
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $sql SQL指令
|
* @param string $sql SQL指令
|
||||||
|
* @param array $bind 参数绑定
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function query($sql)
|
public function query($sql, $bind = [])
|
||||||
{
|
{
|
||||||
$sql = $this->parseSql($sql);
|
$sql = $this->parseSql($sql);
|
||||||
return $this->db->query($sql);
|
return $this->db->query($sql, $bind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 执行SQL语句
|
* 执行SQL语句
|
||||||
* @access public
|
* @access public
|
||||||
* @param string $sql SQL指令
|
* @param string $sql SQL指令
|
||||||
|
* @param array $bind 参数绑定
|
||||||
* @return false | integer
|
* @return false | integer
|
||||||
*/
|
*/
|
||||||
public function execute($sql)
|
public function execute($sql, $bind = [])
|
||||||
{
|
{
|
||||||
$sql = $this->parseSql($sql);
|
$sql = $this->parseSql($sql);
|
||||||
return $this->db->execute($sql);
|
return $this->db->execute($sql, $bind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user