mirror of
https://gitee.com/fastadminnet/framework.git
synced 2026-07-07 07:12:47 +08:00
基础model类 添加query和execute方法 调整map方法
This commit is contained in:
@@ -690,6 +690,30 @@ class Model {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SQL查询
|
||||||
|
* @access public
|
||||||
|
* @param string $sql SQL指令
|
||||||
|
* @param array $bind 参数绑定
|
||||||
|
* @return mixed
|
||||||
|
*/
|
||||||
|
public function query($sql,$bind=[]) {
|
||||||
|
$sql = strtr($sql,['__TABLE__'=>$this->getTableName(),'__PREFIX__'=>$this->tablePrefix]);
|
||||||
|
return $this->db->query($sql,$bind);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 执行SQL语句
|
||||||
|
* @access public
|
||||||
|
* @param string $sql SQL指令
|
||||||
|
* @param array $bind 参数绑定
|
||||||
|
* @return false | integer
|
||||||
|
*/
|
||||||
|
public function execute($sql,$bind=[]) {
|
||||||
|
$sql = strtr($sql,['__TABLE__'=>$this->getTableName(),'__PREFIX__'=>$this->tablePrefix]);
|
||||||
|
return $this->db->execute($sql,$bind);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置数据对象值
|
* 设置数据对象值
|
||||||
* @access public
|
* @access public
|
||||||
@@ -1001,7 +1025,7 @@ class Model {
|
|||||||
* @return Model
|
* @return Model
|
||||||
*/
|
*/
|
||||||
public function map($map){
|
public function map($map){
|
||||||
$this->map = array_merge($this->map,$map);
|
$this->map = $map;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -42,28 +42,6 @@ trait Query {
|
|||||||
return $this->db->rollback();
|
return $this->db->rollback();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* SQL查询
|
|
||||||
* @access public
|
|
||||||
* @param string $sql SQL指令
|
|
||||||
* @param array $bind 参数绑定
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function query($sql,$bind=[]) {
|
|
||||||
return $this->db->query($sql,$bind);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 执行SQL语句
|
|
||||||
* @access public
|
|
||||||
* @param string $sql SQL指令
|
|
||||||
* @param array $bind 参数绑定
|
|
||||||
* @return false | integer
|
|
||||||
*/
|
|
||||||
public function execute($sql,$bind=[]) {
|
|
||||||
return $this->db->execute($sql,$bind);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 解析SQL语句
|
* 解析SQL语句
|
||||||
* @access public
|
* @access public
|
||||||
|
|||||||
Reference in New Issue
Block a user