@@ 254-274 (lines=21) @@ | ||
251 | } |
|
252 | } |
|
253 | ||
254 | public function fetchObject( $res ) { |
|
255 | if ( $res instanceof ResultWrapper ) { |
|
256 | $res = $res->result; |
|
257 | } |
|
258 | MediaWiki\suppressWarnings(); |
|
259 | $row = pg_fetch_object( $res ); |
|
260 | MediaWiki\restoreWarnings(); |
|
261 | # @todo FIXME: HACK HACK HACK HACK debug |
|
262 | ||
263 | # @todo hashar: not sure if the following test really trigger if the object |
|
264 | # fetching failed. |
|
265 | $conn = $this->getBindingHandle(); |
|
266 | if ( pg_last_error( $conn ) ) { |
|
267 | throw new DBUnexpectedError( |
|
268 | $this, |
|
269 | 'SQL error: ' . htmlspecialchars( pg_last_error( $conn ) ) |
|
270 | ); |
|
271 | } |
|
272 | ||
273 | return $row; |
|
274 | } |
|
275 | ||
276 | public function fetchRow( $res ) { |
|
277 | if ( $res instanceof ResultWrapper ) { |
|
@@ 276-293 (lines=18) @@ | ||
273 | return $row; |
|
274 | } |
|
275 | ||
276 | public function fetchRow( $res ) { |
|
277 | if ( $res instanceof ResultWrapper ) { |
|
278 | $res = $res->result; |
|
279 | } |
|
280 | MediaWiki\suppressWarnings(); |
|
281 | $row = pg_fetch_array( $res ); |
|
282 | MediaWiki\restoreWarnings(); |
|
283 | ||
284 | $conn = $this->getBindingHandle(); |
|
285 | if ( pg_last_error( $conn ) ) { |
|
286 | throw new DBUnexpectedError( |
|
287 | $this, |
|
288 | 'SQL error: ' . htmlspecialchars( pg_last_error( $conn ) ) |
|
289 | ); |
|
290 | } |
|
291 | ||
292 | return $row; |
|
293 | } |
|
294 | ||
295 | public function numRows( $res ) { |
|
296 | if ( $res instanceof ResultWrapper ) { |
|
@@ 295-312 (lines=18) @@ | ||
292 | return $row; |
|
293 | } |
|
294 | ||
295 | public function numRows( $res ) { |
|
296 | if ( $res instanceof ResultWrapper ) { |
|
297 | $res = $res->result; |
|
298 | } |
|
299 | MediaWiki\suppressWarnings(); |
|
300 | $n = pg_num_rows( $res ); |
|
301 | MediaWiki\restoreWarnings(); |
|
302 | ||
303 | $conn = $this->getBindingHandle(); |
|
304 | if ( pg_last_error( $conn ) ) { |
|
305 | throw new DBUnexpectedError( |
|
306 | $this, |
|
307 | 'SQL error: ' . htmlspecialchars( pg_last_error( $conn ) ) |
|
308 | ); |
|
309 | } |
|
310 | ||
311 | return $n; |
|
312 | } |
|
313 | ||
314 | public function numFields( $res ) { |
|
315 | if ( $res instanceof ResultWrapper ) { |