第一步:
在Model.class.php增加方法
/**
* 我定义的针对表结构执行SQL语句,后有返回值的execute
* @author MIAO
* @access public
* @param string $sql SQL指令
* @param mixed $parse 是否需要解析SQL
* @return false | integer
*/
public function tableExecute($sql) {
$sql = $this->parseSql($sql,$parse);
return $this->db->tableExecute($sql);
}
第二步:
在DbMysql.class.php中增加方法
/**
* 我自定义的执行对表结构操作的sql语句
* @author MIAO
* @access public
* @param string $str sql指令
* @return mix
*/
public function tableExecute($str){//
$this->initConnect(true);
if ( !$this->_li
$this->queryStr = $str;
//释放前次的查询结果
if ( $this->queryID ) { $this->free(); }
N('db_write',1);
// 记录开始执行时间
G('queryStartTime');
return mysql_query($str, $this->_li
}
最佳答案