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时调用 最佳答案