Extension:SQL2Wiki

This extension IS EXTREMELY DANGEROUS as it enables as it gives a user direct access to the database. USE EXTREME CAUTION when enabling this extension. User permissions must be handled on the database level. In most cases the connections to external databases should be read-only on table level.

What can this extension do?
This is a remake of an old extension that has been untouched for a while now, the old extension page has been copied to Extension:SQL2Wiki/old

This extension can run a custom query on an external database (not the database MW is running on). For databases supporting PLSQL (currently only supported for Oracle) this extension can also provide execution of an PLSQL anonymous block. Extension uses direct SQL calls so the queries have to be in the correct format for desired database.

Installation

 * 1) Download the files from SVN and place them in $IP/extensions/SQL2Wiki/ (It is now available here).
 * 2) Add  into your wiki's LocalSettings.php
 * 3) Specify databases you want to access into  in your wiki's LocalSettings.php

Usage examples

 * Show data in a table


 * Show data inline


 * if there is more than one column or row in the target table the data will be separated with line/field separator characters that can be defined as tag parameters


 * Execute PLSQL anonymous block (output can be returned trough DBMS_OUTPUT system)

Parameters

 * General parameters:
 * database = Database id (array key in $wgExSql2WikiDatabases array) (required)
 * inline = inline tag to wrap the results into. If this parameter is omitted the result will be displayed as table in case of sql2wiki or span tag in case of plsql2wiki
 * quiet = in case of error display nothing (true|false)
 * preexpand = recursive parse of input text before executing query (true|false)
 * expand = recursive parse of query result (true|false)
 * cache = handle page caching. In case of plsql or table display setting this parameter to "manual" will cause a refresh link to be placed under the displayed data (on|off|manual)
 * Inline parameters:
 * fieldseparator = character that separates fields in inline display (not displayed after last field)
 * lineseparator = character that separates rows in inline display (by default newlines are appended on rows)
 * Table parameters:
 * noheader = omit table header row (by default filled with column names) (true|false)
 * (table|hrow|hcell|row|cell)style = style attribute applied to table, header row, header cell, data row or data cell.

All other parameters passed to the tag will be appended to attributes of inline or table tag on output.

Changelog
1.0 - Remake release - 30.05.11 (the old extension page has been copied to Extension:SQL2Wiki/old)