Index: trunk/phase3/includes/db/DatabasePostgres.php |
— | — | @@ -159,7 +159,6 @@ |
160 | 160 | return; |
161 | 161 | } |
162 | 162 | |
163 | | - $this->close(); |
164 | 163 | $this->mServer = $server; |
165 | 164 | $port = $wgDBport; |
166 | 165 | $this->mUser = $user; |
— | — | @@ -177,10 +176,14 @@ |
178 | 177 | if ( $port != false && $port != '' ) { |
179 | 178 | $connectVars['port'] = $port; |
180 | 179 | } |
181 | | - $connectString = $this->makeConnectionString( $connectVars, PGSQL_CONNECT_FORCE_NEW ); |
| 180 | + $this->connectString = $this->makeConnectionString( $connectVars, PGSQL_CONNECT_FORCE_NEW ); |
| 181 | + $this->reOpen(); |
| 182 | + } |
182 | 183 | |
| 184 | + function reOpen() { |
| 185 | + $this->close(); |
183 | 186 | $this->installErrorHandler(); |
184 | | - $this->mConn = pg_connect( $connectString ); |
| 187 | + $this->mConn = pg_connect( $this->connectString ); |
185 | 188 | $phpError = $this->restoreErrorHandler(); |
186 | 189 | |
187 | 190 | if ( !$this->mConn ) { |
— | — | @@ -253,6 +256,13 @@ |
254 | 257 | return $this->mLastResult; |
255 | 258 | } |
256 | 259 | |
| 260 | + function reportQueryError( $error, $errno, $sql, $fname, $tempIgnore = false ) { |
| 261 | + $this->rollback( __METHOD__ ); |
| 262 | + $this->reOpen(); |
| 263 | + parent::reportQueryError( $error, $errno, $sql, $fname, $tempIgnore ); |
| 264 | + } |
| 265 | + |
| 266 | + |
257 | 267 | function queryIgnore( $sql, $fname = 'DatabasePostgres::queryIgnore' ) { |
258 | 268 | return $this->query( $sql, $fname, true ); |
259 | 269 | } |