From: Domas Mituzas Date: Thu, 10 Jun 2004 06:37:12 +0000 (+0000) Subject: * PostgreSQL does not have buffered/unbuffered modes. X-Git-Tag: 1.5.0alpha1~2950 X-Git-Url: https://git.cyclocoop.org/%28%28?a=commitdiff_plain;h=654052ad238c14eedcb2cb955307a1289bae63fb;p=lhc%2Fweb%2Fwiklou.git * PostgreSQL does not have buffered/unbuffered modes. There's no need for that due to row-level locking. * pg_result_error is for asynchronous operation. Maybe in future it could be nice, but now we perform only one request at a time. --- diff --git a/includes/DatabasePostgreSQL.php b/includes/DatabasePostgreSQL.php index 83a07aa9fe..1f43e0b50a 100644 --- a/includes/DatabasePostgreSQL.php +++ b/includes/DatabasePostgreSQL.php @@ -169,18 +169,10 @@ class Database { $sqlx = wordwrap(strtr($sqlx,"\t\n"," ")); wfDebug( "SQL: $sqlx\n" ); } - if( $this->mBufferResults ) { - print $sql."
\n"; - $ret = pg_query( $this->mConn , $sql); - } else { - // TODO FIXME : php doesnt get a postgre unbuffered query - // $ret = mysql_unbuffered_query( $sql, $this->mConn ); - // I(hashar) am assuming that pg_send_query does the same - $ret = pg_send_query( $this->mConn , $sql); - } - + + $ret = pg_query( $this->mConn , $sql); if ( false === $ret ) { - $error = pg_result_error( $this->mConn ); + $error = pg_last_error( $this->mConn ); // TODO FIXME : no error number function in postgre // $errno = mysql_errno( $this->mConn ); if( $this->mIgnoreErrors ) { @@ -212,15 +204,15 @@ class Database { # TODO: # hashar : not sure if the following test really trigger if the object # fetching failled. - if( pg_result_error($this->mConn) ) { - wfDebugDieBacktrace( "SQL error: " . htmlspecialchars( pg_result_error($this->mConn) ) ); + if( pg_last_error($this->mConn) ) { + wfDebugDieBacktrace( "SQL error: " . htmlspecialchars( pg_last_error($this->mConn) ) ); } return $row; } function numRows( $res ) { @$n = pg_num_rows( $res ); - if( pg_result_error($this->mConn) ) { - wfDebugDieBacktrace( "SQL error: " . htmlspecialchars( pg_result_error($this->mConn) ) ); + if( pg_last_error($this->mConn) ) { + wfDebugDieBacktrace( "SQL error: " . htmlspecialchars( pg_last_error($this->mConn) ) ); } return $n; } @@ -233,7 +225,7 @@ class Database { } function dataSeek( $res, $row ) { return pg_result_seek( $res, $row ); } function lastErrno() { return $this->lastError(); } - function lastError() { return pg_result_error(); } + function lastError() { return pg_last_error(); } function affectedRows() { return pg_affected_rows( $this->mConn ); } # Simple UPDATE wrapper