Merge "Update MagicWordArray to use MagicWordFactory"
[lhc/web/wiklou.git] / includes / libs / rdbms / database / DatabaseSqlite.php
index 2125c70..b0fd12a 100644 (file)
@@ -220,10 +220,6 @@ class DatabaseSqlite extends Database {
                return false;
        }
 
-       public function selectDB( $db ) {
-               return false; // doesn't make sense
-       }
-
        /**
         * @return string SQLite DB file path
         * @since 1.25
@@ -519,6 +515,19 @@ class DatabaseSqlite extends Database {
                return $this->lastAffectedRowCount;
        }
 
+       function tableExists( $table, $fname = __METHOD__ ) {
+               $tableRaw = $this->tableName( $table, 'raw' );
+               if ( isset( $this->sessionTempTables[$tableRaw] ) ) {
+                       return true; // already known to exist
+               }
+
+               $encTable = $this->addQuotes( $tableRaw );
+               $res = $this->query(
+                       "SELECT 1 FROM sqlite_master WHERE type='table' AND name=$encTable" );
+
+               return $res->numRows() ? true : false;
+       }
+
        /**
         * Returns information about an index
         * Returns false if the index does not exist
@@ -865,7 +874,7 @@ class DatabaseSqlite extends Database {
                $args = func_get_args();
                $function = array_shift( $args );
 
-               return call_user_func_array( $function, $args );
+               return $function( ...$args );
        }
 
        /**
@@ -1023,7 +1032,7 @@ class DatabaseSqlite extends Database {
        /**
         * List all tables on the database
         *
-        * @param string $prefix Only show tables with this prefix, e.g. mw_
+        * @param string|null $prefix Only show tables with this prefix, e.g. mw_
         * @param string $fname Calling function name
         *
         * @return array