protected $mLastResult;
/** @var PDO */
- protected $mConn;
+ protected $conn;
/** @var FSLockManager (hopefully on the same server as the DB) */
protected $lockMgr;
throw new InvalidArgumentException( "Need 'dbDirectory' or 'dbFilePath' parameter." );
} else {
$this->dbDir = $p['dbDirectory'];
- $this->mDBname = $p['dbname'];
- $lockDomain = $this->mDBname;
+ $this->dbName = $p['dbname'];
+ $lockDomain = $this->dbName;
// Stock wiki mode using standard file names per DB.
parent::__construct( $p );
// Super doesn't open when $user is false, but we can work with $dbName
$this->close();
$fileName = self::generateFileName( $this->dbDir, $dbName );
if ( !is_readable( $fileName ) ) {
- $this->mConn = false;
+ $this->conn = false;
throw new DBConnectionError( $this, "SQLite database not accessible" );
}
$this->openFile( $fileName );
- return (bool)$this->mConn;
+ return (bool)$this->conn;
}
/**
$this->dbPath = $fileName;
try {
- if ( $this->mFlags & self::DBO_PERSISTENT ) {
- $this->mConn = new PDO( "sqlite:$fileName", '', '',
+ if ( $this->flags & self::DBO_PERSISTENT ) {
+ $this->conn = new PDO( "sqlite:$fileName", '', '',
[ PDO::ATTR_PERSISTENT => true ] );
} else {
- $this->mConn = new PDO( "sqlite:$fileName", '', '' );
+ $this->conn = new PDO( "sqlite:$fileName", '', '' );
}
} catch ( PDOException $e ) {
$err = $e->getMessage();
}
- if ( !$this->mConn ) {
+ if ( !$this->conn ) {
$this->queryLogger->debug( "DB connection error: $err\n" );
throw new DBConnectionError( $this, $err );
}
- $this->mOpened = !!$this->mConn;
- if ( $this->mOpened ) {
+ $this->opened = !!$this->conn;
+ if ( $this->opened ) {
# Set error codes only, don't raise exceptions
- $this->mConn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT );
+ $this->conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_SILENT );
# Enforce LIKE to be case sensitive, just like MySQL
$this->query( 'PRAGMA case_sensitive_like = 1' );
- return $this->mConn;
+ return $this->conn;
}
return false;
* @return bool
*/
protected function closeConnection() {
- $this->mConn = null;
+ $this->conn = null;
return true;
}
* @return bool|ResultWrapper
*/
protected function doQuery( $sql ) {
- $res = $this->mConn->query( $sql );
+ $res = $this->conn->query( $sql );
if ( $res === false ) {
return false;
}
*/
function insertId() {
// PDO::lastInsertId yields a string :(
- return intval( $this->mConn->lastInsertId() );
+ return intval( $this->conn->lastInsertId() );
}
/**
* @return string
*/
function lastError() {
- if ( !is_object( $this->mConn ) ) {
+ if ( !is_object( $this->conn ) ) {
return "Cannot return last error, no db connection";
}
- $e = $this->mConn->errorInfo();
+ $e = $this->conn->errorInfo();
return isset( $e[2] ) ? $e[2] : '';
}
* @return string
*/
function lastErrno() {
- if ( !is_object( $this->mConn ) ) {
+ if ( !is_object( $this->conn ) ) {
return "Cannot return last error, no db connection";
} else {
- $info = $this->mConn->errorInfo();
+ $info = $this->conn->errorInfo();
return $info[1];
}
* @return string Version information from the database
*/
function getServerVersion() {
- $ver = $this->mConn->getAttribute( PDO::ATTR_SERVER_VERSION );
+ $ver = $this->conn->getAttribute( PDO::ATTR_SERVER_VERSION );
return $ver;
}
} else {
$this->query( 'BEGIN', $fname );
}
- $this->mTrxLevel = 1;
+ $this->trxLevel = 1;
}
/**
);
return "x'" . bin2hex( (string)$s ) . "'";
} else {
- return $this->mConn->quote( (string)$s );
+ return $this->conn->quote( (string)$s );
}
}
* @return string
*/
public function __toString() {
- return 'SQLite ' . (string)$this->mConn->getAttribute( PDO::ATTR_SERVER_VERSION );
+ return 'SQLite ' . (string)$this->conn->getAttribute( PDO::ATTR_SERVER_VERSION );
}
}