예제 #1
0
 /**
  * @since 2.5
  *
  * @param DatabaseBase $connection
  *
  * @return TableBuilder
  * @throws RuntimeException
  */
 public static function factory(DatabaseBase $connection)
 {
     $instance = null;
     switch ($connection->getType()) {
         case 'mysql':
             $instance = new MySQLTableBuilder($connection);
             break;
         case 'sqlite':
             $instance = new SQLiteTableBuilder($connection);
             break;
         case 'postgres':
             $instance = new PostgresTableBuilder($connection);
             break;
     }
     if ($instance === null) {
         throw new RuntimeException("Unknown DB type " . $connection->getType());
     }
     $instance->setDbName($GLOBALS['wgDBname']);
     $instance->setTableOptions($GLOBALS['wgDBTableOptions']);
     return $instance;
 }