+----------------------------------------------------------
* 执行查询 返回数据集
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $str sql指令
+----------------------------------------------------------
* @return mixed
+----------------------------------------------------------
* @throws ThinkExecption
+----------------------------------------------------------
*/
public function query($str) {
if(0===stripos($str, 'call')){ // 存储过程查询支持
$this->close();
}
$this->initConnect(false);
if ( !$this->_li
$this->queryStr = $str;
//释放前次的查询结果
if ( $this->queryID ) { $this->free(); }
N('db_query',1);
// 记录开始执行时间
G('queryStartTime');
$this->queryID = mysql_query($str, $this->_li
$this->debug();
if ( false === $this->queryID ) {
$this->error();
return false;
} else {
$this->numRows = mysql_num_rows($this->queryID);
return $this->getAll();
}
}
public function close() {
if ($this->_li
mysql_close($this->_li
}
$this->_li
}
protected function initConnect($master=true) {
if(1 == C('DB_DEPLOY_TYPE'))
// 采用分布式数据库
$this->_li
else
// 默认单数据库
if ( !$this->connected ) $this->_li
}
还有一个函数太长,就是connect函数,
当我想执行 存储过程查询的时候,query先执行close 函数 ,然后再连接,这里就出问题了, if ( !$this->connected ) $this->_li
最佳答案
