protected $port;
/** @var resource */
- protected $mLastResult = null;
+ protected $lastResultHandle = null;
/** @var int The number of rows affected as an integer */
- protected $mAffectedRows = null;
+ protected $lastAffectedRowCount = null;
/** @var float|string */
private $numericVersion = null;
/** @var string Connect string to open a PostgreSQL connection */
private $connectString;
/** @var string */
- private $mCoreSchema;
+ private $coreSchema;
/** @var string[] Map of (reserved table name => alternate table name) */
private $keywordTableMap = [];
if ( pg_send_query( $conn, $sql ) === false ) {
throw new DBUnexpectedError( $this, "Unable to post new query to PostgreSQL\n" );
}
- $this->mLastResult = pg_get_result( $conn );
- $this->mAffectedRows = null;
- if ( pg_result_error( $this->mLastResult ) ) {
+ $this->lastResultHandle = pg_get_result( $conn );
+ $this->lastAffectedRowCount = null;
+ if ( pg_result_error( $this->lastResultHandle ) ) {
return false;
}
- return $this->mLastResult;
+ return $this->lastResultHandle;
}
protected function dumpError() {
];
foreach ( $diags as $d ) {
$this->queryLogger->debug( sprintf( "PgSQL ERROR(%d): %s\n",
- $d, pg_result_error_field( $this->mLastResult, $d ) ) );
+ $d, pg_result_error_field( $this->lastResultHandle, $d ) ) );
}
}
public function lastError() {
if ( $this->conn ) {
- if ( $this->mLastResult ) {
- return pg_result_error( $this->mLastResult );
+ if ( $this->lastResultHandle ) {
+ return pg_result_error( $this->lastResultHandle );
} else {
return pg_last_error();
}
}
public function lastErrno() {
- if ( $this->mLastResult ) {
- return pg_result_error_field( $this->mLastResult, PGSQL_DIAG_SQLSTATE );
+ if ( $this->lastResultHandle ) {
+ return pg_result_error_field( $this->lastResultHandle, PGSQL_DIAG_SQLSTATE );
} else {
return false;
}
}
protected function fetchAffectedRowCount() {
- if ( !is_null( $this->mAffectedRows ) ) {
+ if ( !is_null( $this->lastAffectedRowCount ) ) {
// Forced result for simulated queries
- return $this->mAffectedRows;
+ return $this->lastAffectedRowCount;
}
- if ( empty( $this->mLastResult ) ) {
+ if ( empty( $this->lastResultHandle ) ) {
return 0;
}
- return pg_affected_rows( $this->mLastResult );
+ return pg_affected_rows( $this->lastResultHandle );
}
/**
$tempres = (bool)$this->query( $tempsql, $fname, $savepoint );
if ( $savepoint ) {
- $bar = pg_result_error( $this->mLastResult );
+ $bar = pg_result_error( $this->lastResultHandle );
if ( $bar != false ) {
$savepoint->rollback();
} else {
$sql .= '(' . $this->makeList( $args ) . ')';
$res = (bool)$this->query( $sql, $fname, $savepoint );
if ( $savepoint ) {
- $bar = pg_result_error( $this->mLastResult );
+ $bar = pg_result_error( $this->lastResultHandle );
if ( $bar != false ) {
$savepoint->rollback();
} else {
$savepoint->commit();
// Set the affected row count for the whole operation
- $this->mAffectedRows = $numrowsinserted;
+ $this->lastAffectedRowCount = $numrowsinserted;
// IGNORE always returns true
return true;
$this->begin( __METHOD__, self::TRANSACTION_INTERNAL );
if ( $this->schemaExists( $desiredSchema ) ) {
if ( in_array( $desiredSchema, $this->getSchemas() ) ) {
- $this->mCoreSchema = $desiredSchema;
+ $this->coreSchema = $desiredSchema;
$this->queryLogger->debug(
"Schema \"" . $desiredSchema . "\" already in the search path\n" );
} else {
array_unshift( $search_path,
$this->addIdentifierQuotes( $desiredSchema ) );
$this->setSearchPath( $search_path );
- $this->mCoreSchema = $desiredSchema;
+ $this->coreSchema = $desiredSchema;
$this->queryLogger->debug(
"Schema \"" . $desiredSchema . "\" added to the search path\n" );
}
} else {
- $this->mCoreSchema = $this->getCurrentSchema();
+ $this->coreSchema = $this->getCurrentSchema();
$this->queryLogger->debug(
"Schema \"" . $desiredSchema . "\" not found, using current \"" .
- $this->mCoreSchema . "\"\n" );
+ $this->coreSchema . "\"\n" );
}
/* Commit SET otherwise it will be rollbacked on error or IGNORE SELECT */
$this->commit( __METHOD__, self::FLUSHING_INTERNAL );
* @return string Core schema name
*/
public function getCoreSchema() {
- return $this->mCoreSchema;
+ return $this->coreSchema;
}
public function getServerVersion() {
class MssqlResultWrapper extends ResultWrapper {
/** @var int|null */
- private $mSeekTo = null;
+ private $seekTo = null;
/**
* @return stdClass|bool
public function fetchObject() {
$res = $this->result;
- if ( $this->mSeekTo !== null ) {
+ if ( $this->seekTo !== null ) {
$result = sqlsrv_fetch_object( $res, stdClass::class, [],
- SQLSRV_SCROLL_ABSOLUTE, $this->mSeekTo );
- $this->mSeekTo = null;
+ SQLSRV_SCROLL_ABSOLUTE, $this->seekTo );
+ $this->seekTo = null;
} else {
$result = sqlsrv_fetch_object( $res );
}
public function fetchRow() {
$res = $this->result;
- if ( $this->mSeekTo !== null ) {
+ if ( $this->seekTo !== null ) {
$result = sqlsrv_fetch_array( $res, SQLSRV_FETCH_BOTH,
- SQLSRV_SCROLL_ABSOLUTE, $this->mSeekTo );
- $this->mSeekTo = null;
+ SQLSRV_SCROLL_ABSOLUTE, $this->seekTo );
+ $this->seekTo = null;
} else {
$result = sqlsrv_fetch_array( $res );
}
}
// Unlike MySQL, the seek actually happens on the next access
- $this->mSeekTo = $row;
+ $this->seekTo = $row;
return true;
}
}