| @@ 476-495 (lines=20) @@ | ||
| 473 | * @return stdClass |
|
| 474 | * @throws DBUnexpectedError |
|
| 475 | */ |
|
| 476 | function fetchObject( $res ) { |
|
| 477 | if ( $res instanceof ResultWrapper ) { |
|
| 478 | $res = $res->result; |
|
| 479 | } |
|
| 480 | MediaWiki\suppressWarnings(); |
|
| 481 | $row = pg_fetch_object( $res ); |
|
| 482 | MediaWiki\restoreWarnings(); |
|
| 483 | # @todo FIXME: HACK HACK HACK HACK debug |
|
| 484 | ||
| 485 | # @todo hashar: not sure if the following test really trigger if the object |
|
| 486 | # fetching failed. |
|
| 487 | if ( pg_last_error( $this->mConn ) ) { |
|
| 488 | throw new DBUnexpectedError( |
|
| 489 | $this, |
|
| 490 | 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) |
|
| 491 | ); |
|
| 492 | } |
|
| 493 | ||
| 494 | return $row; |
|
| 495 | } |
|
| 496 | ||
| 497 | function fetchRow( $res ) { |
|
| 498 | if ( $res instanceof ResultWrapper ) { |
|
| @@ 497-512 (lines=16) @@ | ||
| 494 | return $row; |
|
| 495 | } |
|
| 496 | ||
| 497 | function fetchRow( $res ) { |
|
| 498 | if ( $res instanceof ResultWrapper ) { |
|
| 499 | $res = $res->result; |
|
| 500 | } |
|
| 501 | MediaWiki\suppressWarnings(); |
|
| 502 | $row = pg_fetch_array( $res ); |
|
| 503 | MediaWiki\restoreWarnings(); |
|
| 504 | if ( pg_last_error( $this->mConn ) ) { |
|
| 505 | throw new DBUnexpectedError( |
|
| 506 | $this, |
|
| 507 | 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) |
|
| 508 | ); |
|
| 509 | } |
|
| 510 | ||
| 511 | return $row; |
|
| 512 | } |
|
| 513 | ||
| 514 | function numRows( $res ) { |
|
| 515 | if ( $res instanceof ResultWrapper ) { |
|
| @@ 514-529 (lines=16) @@ | ||
| 511 | return $row; |
|
| 512 | } |
|
| 513 | ||
| 514 | function numRows( $res ) { |
|
| 515 | if ( $res instanceof ResultWrapper ) { |
|
| 516 | $res = $res->result; |
|
| 517 | } |
|
| 518 | MediaWiki\suppressWarnings(); |
|
| 519 | $n = pg_num_rows( $res ); |
|
| 520 | MediaWiki\restoreWarnings(); |
|
| 521 | if ( pg_last_error( $this->mConn ) ) { |
|
| 522 | throw new DBUnexpectedError( |
|
| 523 | $this, |
|
| 524 | 'SQL error: ' . htmlspecialchars( pg_last_error( $this->mConn ) ) |
|
| 525 | ); |
|
| 526 | } |
|
| 527 | ||
| 528 | return $n; |
|
| 529 | } |
|
| 530 | ||
| 531 | function numFields( $res ) { |
|
| 532 | if ( $res instanceof ResultWrapper ) { |
|