mysqli数据库驱动bug

浏览:982 发布日期:2013/03/02
3.1.0 - 普通 - 未处理
假如在同一个页面,调用两次及以上的存储过程时(使用M->query()方式执行),free方法和query方法会出现报错,目前本人暂时的临时解决方案如下:public function free() {
        is_object($this->queryID)&&$this->queryID->free_result();
        $this->queryID = null;
    }
public function query($str) {
        $this->initConnect(false);
        if (!$this->_linkID)
            return false;
        $this->queryStr = $str;
        //释放前次的查询结果
        if ($this->queryID)
            $this->free();
        N('db_query', 1);
        // 记录开始执行时间
        G('queryStartTime');
        $this->queryID = $this->_linkID->query($str);
        // 对存储过程改进
        while ($this->_linkID->more_results() && ($res = $this->_linkID->next_result()) != null) {
            // 临时修正bug,$res可能为boolean值 by ifindever@gmail.com
            is_object($res)&&$res->free_result();
        }
        $this->debug();
        if (false === $this->queryID) {
            $this->error();
            return false;
        } else {
            $this->numRows = $this->queryID->num_rows;
            $this->numCols = $this->queryID->field_count;
            return $this->getAll();
        }
    }
评论()
后面还有条评论,点击查看>>