try {
// Use new connections to let LoadBalancer/LBFactory handle reuse
$this->conn = pg_connect( $this->connectString, PGSQL_CONNECT_FORCE_NEW );
try {
// Use new connections to let LoadBalancer/LBFactory handle reuse
$this->conn = pg_connect( $this->connectString, PGSQL_CONNECT_FORCE_NEW );
- if ( $res instanceof ResultWrapper ) {
- $res = $res->result;
- }
- Wikimedia\suppressWarnings();
- $ok = pg_free_result( $res );
- Wikimedia\restoreWarnings();
+ AtEase::suppressWarnings();
+ $ok = pg_free_result( ResultWrapper::unwrap( $res ) );
+ AtEase::restoreWarnings();
if ( !$ok ) {
throw new DBUnexpectedError( $this, "Unable to free Postgres result\n" );
}
}
public function fetchObject( $res ) {
if ( !$ok ) {
throw new DBUnexpectedError( $this, "Unable to free Postgres result\n" );
}
}
public function fetchObject( $res ) {
- if ( $res instanceof ResultWrapper ) {
- $res = $res->result;
- }
- Wikimedia\suppressWarnings();
- $row = pg_fetch_object( $res );
- Wikimedia\restoreWarnings();
+ AtEase::suppressWarnings();
+ $row = pg_fetch_object( ResultWrapper::unwrap( $res ) );
+ AtEase::restoreWarnings();
# @todo FIXME: HACK HACK HACK HACK debug
# @todo hashar: not sure if the following test really trigger if the object
# @todo FIXME: HACK HACK HACK HACK debug
# @todo hashar: not sure if the following test really trigger if the object
- if ( $res instanceof ResultWrapper ) {
- $res = $res->result;
- }
- Wikimedia\suppressWarnings();
- $row = pg_fetch_array( $res );
- Wikimedia\restoreWarnings();
+ AtEase::suppressWarnings();
+ $row = pg_fetch_array( ResultWrapper::unwrap( $res ) );
+ AtEase::restoreWarnings();
- if ( $res instanceof ResultWrapper ) {
- $res = $res->result;
- }
- Wikimedia\suppressWarnings();
- $n = pg_num_rows( $res );
- Wikimedia\restoreWarnings();
+ AtEase::suppressWarnings();
+ $n = pg_num_rows( ResultWrapper::unwrap( $res ) );
+ AtEase::restoreWarnings();
$eschemas = implode( ',', array_map( [ $this, 'addQuotes' ], $this->getCoreSchemas() ) );
$result = $this->query(
"SELECT DISTINCT tablename FROM pg_tables WHERE schemaname IN ($eschemas)", $fname );
$eschemas = implode( ',', array_map( [ $this, 'addQuotes' ], $this->getCoreSchemas() ) );
$result = $this->query(
"SELECT DISTINCT tablename FROM pg_tables WHERE schemaname IN ($eschemas)", $fname );
foreach ( $result as $table ) {
$vars = get_object_vars( $table );
$table = array_pop( $vars );
foreach ( $result as $table ) {
$vars = get_object_vars( $table );
$table = array_pop( $vars );
// We do not want the schema selection to change on ROLLBACK or INSERT SELECT.
// See https://www.postgresql.org/docs/8.3/sql-set.html
throw new DBUnexpectedError(
$this,
// We do not want the schema selection to change on ROLLBACK or INSERT SELECT.
// See https://www.postgresql.org/docs/8.3/sql-set.html
throw new DBUnexpectedError(
$this,