pgsql模型execute方法bug

浏览:1160 发布日期:2014/06/24 分类:技术分享 关键字: pgsql execute
ThinkPHP/Library/Think/Db/Driver 目录下的Pgsql.class.php 的102行public function execute($str) {
        $this->initConnect(true);
        if ( !$this->_linkID ) return false;
        $this->queryStr = $str;
        //释放前次的查询结果
        if ( $this->queryID ) $this->free();
        N('db_write',1);
        // 记录开始执行时间
        G('queryStartTime');
        $result =   pg_query($this->_linkID,$str);
        $this->debug();
        if ( false === $result ) {
            $this->error();
            return false;
        } else {
            $this->numRows = pg_affected_rows($result);
            if(stristr($str,'insert')){ //修改部分
                 $this->lastInsID =   $this->last_insert_id();
            }
           
            return $this->numRows;
        }
    }
execute方法每次执行都会调用 $this->last_insert_id(),会出错,所以加了个判断,只在insert时调用
最佳答案
评论( 相关
后面还有条评论,点击查看>>