$this->mName = $dbName;
parent::__construct( $server, $user, $password, $dbName, $flags );
// parent doesn't open when $user is false, but we can work with $dbName
- if( !$user && $dbName ) {
+ if( $dbName ) {
global $wgSharedDB;
if( $this->open( $server, $user, $password, $dbName ) && $wgSharedDB ) {
$this->attachDatabase( $wgSharedDB );
*
* @param $fileName string
*
- * @return PDO|false SQL connection or false if failed
+ * @return PDO|bool SQL connection or false if failed
*/
function openFile( $fileName ) {
$this->mDatabaseFile = $fileName;
/**
* Check if the searchindext table is FTS enabled.
- * @return false if not enabled.
+ * @return bool if not enabled.
*/
function checkForEnabledSearch() {
if ( self::$fulltextEnabled === null ) {
*
* @return ResultWrapper
*/
- function doQuery( $sql ) {
+ protected function doQuery( $sql ) {
$res = $this->mConn->query( $sql );
if ( $res === false ) {
return false;
* Use MySQL's naming (accounts for prefix etc) but remove surrounding backticks
*
* @param $name
- * @param bool $quoted
+ * @param $format String
* @return string
*/
- function tableName( $name, $quoted = true ) {
+ function tableName( $name, $format = 'quoted' ) {
// table names starting with sqlite_ are reserved
if ( strpos( $name, 'sqlite_' ) === 0 ) {
return $name;
}
- return str_replace( '"', '', parent::tableName( $name, $quoted ) );
+ return str_replace( '"', '', parent::tableName( $name, $format ) );
}
/**
/**
* Based on generic method (parent) with some prior SQLite-sepcific adjustments
+ * @return bool
*/
function insert( $table, $a, $fname = 'DatabaseSqlite::insert', $options = array() ) {
if ( !count( $a ) ) {
if ( isset( $rows[0] ) && is_array( $rows[0] ) ) {
$ret = true;
foreach ( $rows as $v ) {
- if ( !parent::replace( $table, $uniqueIndexes, $v, "$fname/multi-row" ) ) {
+ if ( !$this->nativeReplace( $table, $v, "$fname/multi-row" ) ) {
$ret = false;
}
}
} else {
- $ret = parent::replace( $table, $uniqueIndexes, $rows, "$fname/single-row" );
+ $ret = $this->nativeReplace( $table, $rows, "$fname/single-row" );
}
return $ret;
* Get information about a given field
* Returns false if the field does not exist.
*
- * @return SQLiteField|false
+ * @return SQLiteField|bool
*/
function fieldInfo( $table, $field ) {
$tableName = $this->tableName( $table );
return parent::buildLike( $params ) . "ESCAPE '\' ";
}
- public function dropTable( $tableName, $fName = 'DatabaseSqlite::dropTable' ) {
- $sql = 'DROP TABLE IF EXISTS ' . $this->tableName( $tableName );
- return $this->query( $sql, $fName );
- }
-
/**
* @return string
*/
/**
* No-op version of deadlockLoop
+ * @return mixed
*/
public function deadlockLoop( /*...*/ ) {
$args = func_get_args();
/**
* List all tables on the database
*
- * @param $prefix Only show tables with this prefix, e.g. mw_
+ * @param $prefix string Only show tables with this prefix, e.g. mw_
* @param $fname String: calling function name
*
* @return array