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