Extension:MSSQLBackCompat

From MediaWiki.org
Jump to: navigation, search


MediaWiki extensions manualManual:Extensions
Crystal Clear action run.png
MSSQLBackCompat

Release status:Extension status beta

ImplementationTemplate:Extension#type Database
DescriptionTemplate:Extension#description Back compat hack for those that need non core MSSQL support (SMW, ED or something)
MediaWikiTemplate:Extension#mediawiki 1.17+
LicenseTemplate:Extension#license GPLv2
Download

Translate the MSSQLBackCompat extension if it is available at translatewiki.net

Check usage and version matrix.

This extension allow MediaWiki to query a Microsoft SQL database from Linux. It is not recommended for general everyday because to install it, you'll have to modify a file in the main files of MediaWiki. It is broken to use as the main MediaWiki databse but quite useful for extensions that query a database for other informations such as External Data.

Introduction[edit]

On Windows platforms, in PHP 5.3 and later, the mssql extension is being phased out in favor of SQLDRV, a Windows only extension.[1] MediaWiki has followed and removed the old implementation[2] and replaced it with SQLDRV.[3]

On Unix/Linux platforms, the mssql extension is still supported and use the FreeTDS library. This extension makes use of it.

Installation[edit]

  1. Download the files from SVN and place them in $IP/extensions/MSSQLBackCompat/
  2. Add
    require_once( "$IP/extensions/MSSQLBackCompat/MSSQLBackCompat.php" );
    
    into your wiki's LocalSettings.php
  3. Modify the file includes/db/Database.php as shown below.

Database.php[edit]

To use this extension you have to modify $IP/includes/db/Database.php

Search for the following:

        public final static function newFromType( $dbType, $p = array() ) {
                $canonicalDBTypes = array(
                        'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2'
                );
                $dbType = strtolower( $dbType );

Replace with:

        public final static function newFromType( $dbType, $p = array() ) {
                $canonicalDBTypes = array(
                        'mysql', 'postgres', 'sqlite', 'oracle', 'mssql', 'ibm_db2', 'mssqlold',
                );
                $dbType = strtolower( $dbType );

Configuration[edit]

Suggested modification to your /etc/freetds.conf configuration file. UTF-8 allow you to use international characters.

[global]
        # TDS protocol version
        #tds version = 4.2
        tds version = 8.0
        client charset = UTF-8

References[edit]

  1. http://www.php.net/manual/en/intro.mssql.php
  2. See modifications in revision 65404.
  3. See modifications in revision 70608 and upward.