r85885 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r85884‎ | r85885 | r85886 >
Date:16:35, 12 April 2011
Author:leonsp
Status:deferred (Comments)
Tags:
Comment:
Fixes to DB2 support. DB2 support integration with 1.17 Installer and Updater. Developed by Andre, Tiago, Diego, and Cesar as described in wikitech-l message. Reviewed by me.
Modified paths:
  • /trunk/phase3/includes/AutoLoader.php (modified) (history)
  • /trunk/phase3/includes/db/DatabaseIbm_db2.php (modified) (history)
  • /trunk/phase3/includes/installer/Ibm_db2Installer.php (added) (history)
  • /trunk/phase3/includes/installer/Ibm_db2Updater.php (added) (history)
  • /trunk/phase3/includes/installer/Installer.i18n.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-categorylinks-better-collation.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-change_tag-indexes.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-change_tag.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-change_tag_summary.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-change_valid_tag.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-cl_collation-field.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-cl_sortkey_prefix-field.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-cl_type-field.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-external_user.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-ipb_allow_usertalk.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-iw_api-field.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-iw_api_and_wikiid.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-iw_wikiid-field.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-iwlinks.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-l10n_cache.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-log_search-rename-index.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-log_search.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-log_user_text.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-module_deps.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-msg_resource.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-msg_resource_links.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-rd_interwiki.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-ss_active_users.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-ul_value.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-uq61_msg_resource_links.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-uq81_msg_resource.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-uq96_module_deps.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/patch-user_properties.sql (added) (history)
  • /trunk/phase3/maintenance/ibm_db2/tables.sql (modified) (history)

Diff [purge]

Index: trunk/phase3/maintenance/ibm_db2/patch-uq96_module_deps.sql
@@ -0,0 +1,7 @@
 2+CREATE UNIQUE INDEX "UQ96_MODULE_DEPS" ON "MODULE_DEPS"
 3+(
 4+"MD_MODULE"
 5+,"MD_SKIN"
 6+)
 7+ALLOW REVERSE SCANS
 8+;
Index: trunk/phase3/maintenance/ibm_db2/patch-iw_api-field.sql
@@ -0,0 +1 @@
 2+ALTER TABLE interwiki ADD iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL
Index: trunk/phase3/maintenance/ibm_db2/patch-user_properties.sql
@@ -0,0 +1,10 @@
 2+CREATE TABLE user_properties (
 3+ -- Foreign key to user.user_id
 4+ up_user BIGINT NOT NULL,
 5+
 6+ -- Name of the option being saved. This is indexed for bulk lookup.
 7+ up_property VARCHAR(32) FOR BIT DATA NOT NULL,
 8+
 9+ -- Property value as a string.
 10+ up_value CLOB(64K) INLINE LENGTH 4096
 11+);
Index: trunk/phase3/maintenance/ibm_db2/patch-rd_interwiki.sql
@@ -0,0 +1,8 @@
 2+CREATE TABLE redirect (
 3+ rd_from BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
 4+ --REFERENCES page(page_id) ON DELETE CASCADE,
 5+ rd_namespace SMALLINT NOT NULL DEFAULT 0,
 6+ rd_title VARCHAR(255) NOT NULL DEFAULT '',
 7+ rd_interwiki varchar(32),
 8+ rd_fragment VARCHAR(255)
 9+);
Index: trunk/phase3/maintenance/ibm_db2/patch-iw_api_and_wikiid.sql
@@ -0,0 +1,8 @@
 2+CREATE TABLE interwiki (
 3+ iw_prefix VARCHAR(32) NOT NULL UNIQUE,
 4+ iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL,
 5+ iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL,
 6+ iw_wikiid varchar(64) NOT NULL,
 7+ iw_local SMALLINT NOT NULL,
 8+ iw_trans SMALLINT NOT NULL DEFAULT 0
 9+);
Index: trunk/phase3/maintenance/ibm_db2/patch-msg_resource_links.sql
@@ -0,0 +1,6 @@
 2+CREATE TABLE "MSG_RESOURCE_LINKS"
 3+(
 4+"MRL_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,
 5+"MRL_MESSAGE" VARCHAR(255) FOR BIT DATA NOT NULL
 6+)
 7+;
Index: trunk/phase3/maintenance/ibm_db2/patch-msg_resource.sql
@@ -0,0 +1,8 @@
 2+CREATE TABLE "MSG_RESOURCE"
 3+(
 4+"MR_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,
 5+"MR_LANG" VARCHAR(32) FOR BIT DATA NOT NULL ,
 6+"MR_BLOB" BLOB NOT NULL ,
 7+"MR_TIMESTAMP" TIMESTAMP(3) NOT NULL
 8+)
 9+;
Index: trunk/phase3/maintenance/ibm_db2/patch-change_tag_summary.sql
@@ -0,0 +1,7 @@
 2+-- Rollup table to pull a LIST of tags simply
 3+CREATE TABLE tag_summary (
 4+ ts_rc_id INTEGER,
 5+ ts_log_id INTEGER,
 6+ ts_rev_id INTEGER,
 7+ ts_tags CLOB(64K) INLINE LENGTH 4096 NOT NULL
 8+);
Index: trunk/phase3/maintenance/ibm_db2/patch-l10n_cache.sql
@@ -0,0 +1,8 @@
 2+CREATE TABLE l10n_cache (
 3+ -- Language code
 4+ lc_lang VARCHAR(32) NOT NULL,
 5+ -- Cache key
 6+ lc_key VARCHAR(255) NOT NULL,
 7+ -- Value
 8+ lc_value CLOB(16M) INLINE LENGTH 4096 NOT NULL
 9+);
Index: trunk/phase3/maintenance/ibm_db2/patch-change_valid_tag.sql
@@ -0,0 +1,3 @@
 2+CREATE TABLE valid_tag (
 3+ vt_tag varchar(255) NOT NULL PRIMARY KEY
 4+);
Index: trunk/phase3/maintenance/ibm_db2/patch-module_deps.sql
@@ -0,0 +1,6 @@
 2+CREATE TABLE "MODULE_DEPS" (
 3+"MD_MODULE" VARCHAR(255) FOR BIT DATA NOT NULL ,
 4+"MD_SKIN" VARCHAR(32) FOR BIT DATA NOT NULL ,
 5+"MD_DEPS" CLOB(16M) INLINE LENGTH 4096 NOT NULL
 6+)
 7+;
Index: trunk/phase3/maintenance/ibm_db2/patch-iw_wikiid-field.sql
@@ -0,0 +1 @@
 2+ALTER TABLE interwiki ADD iw_wikiid varchar(64) NOT NULL
Index: trunk/phase3/maintenance/ibm_db2/patch-ss_active_users.sql
@@ -0,0 +1,11 @@
 2+CREATE TABLE site_stats (
 3+ ss_row_id BIGINT NOT NULL UNIQUE,
 4+ ss_total_views BIGINT DEFAULT 0,
 5+ ss_total_edits BIGINT DEFAULT 0,
 6+ ss_good_articles BIGINT DEFAULT 0,
 7+ ss_total_pages INTEGER DEFAULT -1,
 8+ ss_users INTEGER DEFAULT -1,
 9+ ss_active_users INTEGER DEFAULT -1,
 10+ ss_admins INTEGER DEFAULT -1,
 11+ ss_images INTEGER DEFAULT 0
 12+);
Index: trunk/phase3/maintenance/ibm_db2/patch-log_search.sql
@@ -0,0 +1,8 @@
 2+CREATE TABLE log_search (
 3+ -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username)
 4+ ls_field VARCHAR(32) FOR BIT DATA NOT NULL,
 5+ -- The value of the ID
 6+ ls_value varchar(255) NOT NULL,
 7+ -- Key to log_id
 8+ ls_log_id BIGINT NOT NULL default 0
 9+);
Index: trunk/phase3/maintenance/ibm_db2/patch-uq61_msg_resource_links.sql
@@ -0,0 +1,7 @@
 2+CREATE UNIQUE INDEX "UQ61_MSG_RESOURCE_LINKS" ON "MSG_RESOURCE_LINKS"
 3+(
 4+"MRL_MESSAGE",
 5+"MRL_RESOURCE"
 6+)
 7+ALLOW REVERSE SCANS
 8+;
Index: trunk/phase3/maintenance/ibm_db2/patch-uq81_msg_resource.sql
@@ -0,0 +1,7 @@
 2+CREATE UNIQUE INDEX "UQ81_MSG_RESOURCE" ON "MSG_RESOURCE"
 3+(
 4+"MR_RESOURCE"
 5+,"MR_LANG"
 6+)
 7+ALLOW REVERSE SCANS
 8+;
Index: trunk/phase3/maintenance/ibm_db2/patch-cl_sortkey_prefix-field.sql
@@ -0,0 +1 @@
 2+ALTER TABLE categorylinks ADD cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL
Index: trunk/phase3/maintenance/ibm_db2/patch-ul_value.sql
@@ -0,0 +1,3 @@
 2+CREATE TABLE updatelog (
 3+ ul_key VARCHAR(255) NOT NULL PRIMARY KEY
 4+);
Index: trunk/phase3/maintenance/ibm_db2/patch-change_tag-indexes.sql
@@ -0,0 +1,5 @@
 2+CREATE UNIQUE INDEX change_tag_rc_tag ON change_tag (ct_rc_id,ct_tag);
 3+CREATE UNIQUE INDEX change_tag_log_tag ON change_tag (ct_log_id,ct_tag);
 4+CREATE UNIQUE INDEX change_tag_rev_tag ON change_tag (ct_rev_id,ct_tag);
 5+-- Covering index, so we can pull all the info only out of the index.
 6+CREATE INDEX change_tag_tag_id ON change_tag (ct_tag,ct_rc_id,ct_rev_id,ct_log_id);
Index: trunk/phase3/maintenance/ibm_db2/tables.sql
@@ -9,7 +9,7 @@
1010
1111 CREATE TABLE user (
1212 -- Needs to start with 0
13 - user_id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 0),
 13+ user_id BIGINT PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 0),
1414 user_name VARCHAR(255) NOT NULL UNIQUE,
1515 user_real_name VARCHAR(255),
1616 user_password VARCHAR(1024),
@@ -220,8 +220,12 @@
221221 cl_to VARCHAR(255) NOT NULL,
222222 -- cl_sortkey has to be at least 86 wide
223223 -- in order to be compatible with the old MySQL schema from MW 1.10
224 - cl_sortkey VARCHAR(86),
225 - cl_timestamp TIMESTAMP(3) NOT NULL
 224+ --cl_sortkey VARCHAR(86),
 225+ cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL ,
 226+ cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL ,
 227+ cl_timestamp TIMESTAMP(3) NOT NULL,
 228+ cl_collation VARCHAR(32) FOR BIT DATA NOT NULL ,
 229+ cl_type VARCHAR(6) FOR BIT DATA NOT NULL
226230 );
227231 CREATE UNIQUE INDEX cl_from ON categorylinks (cl_from, cl_to);
228232 CREATE INDEX cl_sortkey ON categorylinks (cl_to, cl_sortkey, cl_from);
@@ -453,6 +457,8 @@
454458 CREATE TABLE interwiki (
455459 iw_prefix VARCHAR(32) NOT NULL UNIQUE,
456460 iw_url CLOB(64K) INLINE LENGTH 4096 NOT NULL,
 461+ iw_api CLOB(64K) INLINE LENGTH 4096 NOT NULL,
 462+ iw_wikiid varchar(64) NOT NULL,
457463 iw_local SMALLINT NOT NULL,
458464 iw_trans SMALLINT NOT NULL DEFAULT 0
459465 );
@@ -489,7 +495,7 @@
490496 CREATE TABLE objectcache (
491497 keyname VARCHAR(255) NOT NULL UNIQUE, -- was nullable
492498 value CLOB(16M) INLINE LENGTH 4096 NOT NULL DEFAULT '',
493 - exptime TIMESTAMP(3) NOT NULL
 499+ exptime TIMESTAMP(3) NOT NULL
494500 );
495501 CREATE INDEX objectcacache_exptime ON objectcache (exptime);
496502
@@ -686,3 +692,58 @@
687693 );
688694 CREATE INDEX lc_lang_key ON l10n_cache (lc_lang, lc_key);
689695
 696+
 697+CREATE TABLE "MSG_RESOURCE_LINKS"
 698+(
 699+"MRL_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,
 700+"MRL_MESSAGE" VARCHAR(255) FOR BIT DATA NOT NULL
 701+)
 702+;
 703+
 704+CREATE UNIQUE INDEX "UQ61_MSG_RESOURCE_LINKS" ON "MSG_RESOURCE_LINKS"
 705+(
 706+"MRL_MESSAGE",
 707+"MRL_RESOURCE"
 708+)
 709+ALLOW REVERSE SCANS
 710+;
 711+
 712+CREATE TABLE "MSG_RESOURCE"
 713+(
 714+"MR_RESOURCE" VARCHAR(255) FOR BIT DATA NOT NULL ,
 715+"MR_LANG" VARCHAR(32) FOR BIT DATA NOT NULL ,
 716+"MR_BLOB" BLOB NOT NULL ,
 717+"MR_TIMESTAMP" TIMESTAMP(3) NOT NULL
 718+)
 719+;
 720+
 721+CREATE UNIQUE INDEX "UQ81_MSG_RESOURCE" ON "MSG_RESOURCE"
 722+(
 723+"MR_RESOURCE"
 724+,"MR_LANG"
 725+)
 726+ALLOW REVERSE SCANS
 727+;
 728+
 729+CREATE TABLE "MODULE_DEPS" (
 730+"MD_MODULE" VARCHAR(255) FOR BIT DATA NOT NULL ,
 731+"MD_SKIN" VARCHAR(32) FOR BIT DATA NOT NULL ,
 732+"MD_DEPS" CLOB(16M) INLINE LENGTH 4096 NOT NULL
 733+)
 734+;
 735+
 736+CREATE UNIQUE INDEX "UQ96_MODULE_DEPS" ON "MODULE_DEPS"
 737+(
 738+"MD_MODULE"
 739+,"MD_SKIN"
 740+)
 741+ALLOW REVERSE SCANS
 742+;
 743+
 744+CREATE TABLE "IWLINKS"
 745+(
 746+"IWL_FROM" INT NOT NULL ,
 747+"IWL_PREFIX" VARCHAR(20) FOR BIT DATA NOT NULL ,
 748+"IWL_TITLE" VARCHAR(255) FOR BIT DATA NOT NULL
 749+)
 750+;
Index: trunk/phase3/maintenance/ibm_db2/patch-iwlinks.sql
@@ -0,0 +1,7 @@
 2+CREATE TABLE "IWLINKS"
 3+(
 4+"IWL_FROM" INT NOT NULL ,
 5+"IWL_PREFIX" VARCHAR(20) FOR BIT DATA NOT NULL ,
 6+"IWL_TITLE" VARCHAR(255) FOR BIT DATA NOT NULL
 7+)
 8+;
Index: trunk/phase3/maintenance/ibm_db2/patch-external_user.sql
@@ -0,0 +1,7 @@
 2+CREATE TABLE external_user (
 3+ -- Foreign key to user_id
 4+ eu_local_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
 5+
 6+ -- Some opaque identifier provided by the external database
 7+ eu_external_id VARCHAR(255) NOT NULL
 8+);
Index: trunk/phase3/maintenance/ibm_db2/patch-cl_type-field.sql
@@ -0,0 +1 @@
 2+ALTER TABLE categorylinks ADD cl_type VARCHAR(6) FOR BIT DATA NOT NULL
Index: trunk/phase3/maintenance/ibm_db2/patch-change_tag.sql
@@ -0,0 +1,8 @@
 2+-- A table to track tags for revisions, logs and recent changes.
 3+CREATE TABLE change_tag (
 4+ ct_rc_id INTEGER,
 5+ ct_log_id INTEGER,
 6+ ct_rev_id INTEGER,
 7+ ct_tag varchar(255) NOT NULL,
 8+ ct_params CLOB(64K) INLINE LENGTH 4096
 9+);
Index: trunk/phase3/maintenance/ibm_db2/patch-log_search-rename-index.sql
@@ -0,0 +1,8 @@
 2+CREATE TABLE log_search (
 3+ -- The type of ID (rev ID, log ID, rev TIMESTAMP(3), username)
 4+ ls_field VARCHAR(32) FOR BIT DATA NOT NULL,
 5+ -- The value of the ID
 6+ ls_value varchar(255) NOT NULL,
 7+ -- Key to log_id
 8+ ls_log_id BIGINT NOT NULL default 0
 9+);
Index: trunk/phase3/maintenance/ibm_db2/patch-ipb_allow_usertalk.sql
@@ -0,0 +1,23 @@
 2+CREATE TABLE ipblocks (
 3+ ipb_id INTEGER NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
 4+ --DEFAULT nextval('ipblocks_ipb_id_val'),
 5+ ipb_address VARCHAR(1024),
 6+ ipb_user BIGINT NOT NULL DEFAULT 0,
 7+ -- REFERENCES user(user_id) ON DELETE SET NULL,
 8+ ipb_by BIGINT NOT NULL DEFAULT 0,
 9+ -- REFERENCES user(user_id) ON DELETE CASCADE,
 10+ ipb_by_text VARCHAR(255) NOT NULL DEFAULT '',
 11+ ipb_reason VARCHAR(1024) NOT NULL,
 12+ ipb_timestamp TIMESTAMP(3) NOT NULL,
 13+ ipb_auto SMALLINT NOT NULL DEFAULT 0,
 14+ ipb_anon_only SMALLINT NOT NULL DEFAULT 0,
 15+ ipb_create_account SMALLINT NOT NULL DEFAULT 1,
 16+ ipb_enable_autoblock SMALLINT NOT NULL DEFAULT 1,
 17+ ipb_expiry TIMESTAMP(3) NOT NULL,
 18+ ipb_range_start VARCHAR(1024),
 19+ ipb_range_end VARCHAR(1024),
 20+ ipb_deleted SMALLINT NOT NULL DEFAULT 0,
 21+ ipb_block_email SMALLINT NOT NULL DEFAULT 0,
 22+ ipb_allow_usertalk SMALLINT NOT NULL DEFAULT 0
 23+
 24+);
Index: trunk/phase3/maintenance/ibm_db2/patch-cl_collation-field.sql
@@ -0,0 +1 @@
 2+ALTER TABLE categorylinks ADD cl_collation VARCHAR(32) FOR BIT DATA NOT NULL
Index: trunk/phase3/maintenance/ibm_db2/patch-categorylinks-better-collation.sql
@@ -0,0 +1,21 @@
 2+--
 3+-- patch-categorylinks-better-collation.sql
 4+--
 5+--
 6+-- Track category inclusions *used inline*
 7+-- This tracks a single level of category membership
 8+-- (folksonomic tagging, really).
 9+--
 10+CREATE TABLE categorylinks (
 11+ cl_from BIGINT NOT NULL DEFAULT 0,
 12+ -- REFERENCES page(page_id) ON DELETE CASCADE,
 13+ cl_to VARCHAR(255) NOT NULL,
 14+ -- cl_sortkey has to be at least 86 wide
 15+ -- in order to be compatible with the old MySQL schema from MW 1.10
 16+ --cl_sortkey VARCHAR(86),
 17+ cl_sortkey VARCHAR(230) FOR BIT DATA NOT NULL ,
 18+ cl_sortkey_prefix VARCHAR(255) FOR BIT DATA NOT NULL ,
 19+ cl_timestamp TIMESTAMP(3) NOT NULL,
 20+ cl_collation VARCHAR(32) FOR BIT DATA NOT NULL ,
 21+ cl_type VARCHAR(6) FOR BIT DATA NOT NULL
 22+);
Index: trunk/phase3/maintenance/ibm_db2/patch-log_user_text.sql
@@ -0,0 +1,17 @@
 2+CREATE TABLE logging (
 3+ log_id BIGINT NOT NULL PRIMARY KEY GENERATED BY DEFAULT AS IDENTITY (START WITH 1),
 4+ --PRIMARY KEY DEFAULT nextval('log_log_id_seq'),
 5+ log_type VARCHAR(32) NOT NULL,
 6+ log_action VARCHAR(32) NOT NULL,
 7+ log_timestamp TIMESTAMP(3) NOT NULL,
 8+ log_user BIGINT NOT NULL DEFAULT 0,
 9+ -- REFERENCES user(user_id) ON DELETE SET NULL,
 10+ -- Name of the user who performed this action
 11+ log_user_text VARCHAR(255) NOT NULL default '',
 12+ log_namespace SMALLINT NOT NULL,
 13+ log_title VARCHAR(255) NOT NULL,
 14+ log_page BIGINT,
 15+ log_comment VARCHAR(255),
 16+ log_params CLOB(64K) INLINE LENGTH 4096,
 17+ log_deleted SMALLINT NOT NULL DEFAULT 0
 18+);
Index: trunk/phase3/includes/db/DatabaseIbm_db2.php
@@ -144,7 +144,7 @@
145145 public $mStmtOptions = array();
146146
147147 /** Default schema */
148 - const USE_GLOBAL = 'mediawiki';
 148+ const USE_GLOBAL = 'get from global';
149149
150150 /** Option that applies to nothing */
151151 const NONE_OPTION = 0x00;
@@ -268,6 +268,10 @@
269269 }
270270
271271 // configure the connection and statement objects
 272+ /*
 273+ $this->setDB2Option( 'cursor', 'DB2_SCROLLABLE',
 274+ self::CONN_OPTION | self::STMT_OPTION );
 275+ */
272276 $this->setDB2Option( 'db2_attr_case', 'DB2_CASE_LOWER',
273277 self::CONN_OPTION | self::STMT_OPTION );
274278 $this->setDB2Option( 'deferred_prepare', 'DB2_DEFERRED_PREPARE_ON',
@@ -321,27 +325,17 @@
322326 * @return a fresh connection
323327 */
324328 public function open( $server, $user, $password, $dbName ) {
325 - // Load the port number
326 - global $wgDBport;
327329 wfProfileIn( __METHOD__ );
328330
329 - // Load IBM DB2 driver if missing
 331+ # Load IBM DB2 driver if missing
330332 wfDl( 'ibm_db2' );
331333
332 - // Test for IBM DB2 support, to avoid suppressed fatal error
 334+ # Test for IBM DB2 support, to avoid suppressed fatal error
333335 if ( !function_exists( 'db2_connect' ) ) {
334 - $error = <<<ERROR
335 -DB2 functions missing, have you enabled the ibm_db2 extension for PHP?
336 -
337 -ERROR;
338 - $this->installPrint( $error );
339 - $this->reportConnectionError( $error );
 336+ throw new DBConnectionError( $this, "DB2 functions missing, have you enabled the ibm_db2 extension for PHP?" );
340337 }
341338
342 - if ( strlen( $user ) < 1 ) {
343 - wfProfileOut( __METHOD__ );
344 - return null;
345 - }
 339+ global $wgDBport;
346340
347341 // Close existing connection
348342 $this->close();
@@ -354,24 +348,26 @@
355349
356350 $this->openUncataloged( $dbName, $user, $password, $server, $port );
357351
358 - // Apply connection config
359 - db2_set_option( $this->mConn, $this->mConnOptions, 1 );
360 - // Some MediaWiki code is still transaction-less (?).
361 - // The strategy is to keep AutoCommit on for that code
362 - // but switch it off whenever a transaction is begun.
363 - db2_autocommit( $this->mConn, DB2_AUTOCOMMIT_ON );
364 -
365352 if ( !$this->mConn ) {
366353 $this->installPrint( "DB connection error\n" );
367354 $this->installPrint(
368355 "Server: $server, Database: $dbName, User: $user, Password: "
369356 . substr( $password, 0, 3 ) . "...\n" );
370357 $this->installPrint( $this->lastError() . "\n" );
371 -
372358 wfProfileOut( __METHOD__ );
373 - return null;
 359+ wfDebug( "DB connection error\n" );
 360+ wfDebug( "Server: $server, Database: $dbName, User: $user, Password: " . substr( $password, 0, 3 ) . "...\n" );
 361+ wfDebug( $this->lastError() . "\n" );
 362+ throw new DBConnectionError( $this, $this->lastError() );
374363 }
375364
 365+ // Apply connection config
 366+ db2_set_option( $this->mConn, $this->mConnOptions, 1 );
 367+ // Some MediaWiki code is still transaction-less (?).
 368+ // The strategy is to keep AutoCommit on for that code
 369+ // but switch it off whenever a transaction is begun.
 370+ db2_autocommit( $this->mConn, DB2_AUTOCOMMIT_ON );
 371+
376372 $this->mOpened = true;
377373 $this->applySchema();
378374
@@ -391,16 +387,8 @@
392388 */
393389 protected function openUncataloged( $dbName, $user, $password, $server, $port )
394390 {
395 - $str = "DRIVER={IBM DB2 ODBC DRIVER};";
396 - $str .= "DATABASE=$dbName;";
397 - $str .= "HOSTNAME=$server;";
398 - // port was formerly validated to not be 0
399 - $str .= "PORT=$port;";
400 - $str .= "PROTOCOL=TCPIP;";
401 - $str .= "UID=$user;";
402 - $str .= "PWD=$password;";
403 -
404 - @$this->mConn = db2_pconnect( $str, $user, $password );
 391+ $dsn = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=$dbName;CHARSET=UTF-8;HOSTNAME=$server;PORT=$port;PROTOCOL=TCPIP;UID=$user;PWD=$password;";
 392+ @$this->mConn = db2_pconnect($dsn, "", "", array());
405393 }
406394
407395 /**
@@ -470,10 +458,19 @@
471459 /*private*/
472460 public function doQuery( $sql ) {
473461 $this->applySchema();
474 -
 462+
 463+ // Needed to handle any UTF-8 encoding issues in the raw sql
 464+ // Note that we fully support prepared statements for DB2
 465+ // prepare() and execute() should be used instead of doQuery() whenever possible
 466+ $sql = utf8_decode($sql);
 467+
475468 $ret = db2_exec( $this->mConn, $sql, $this->mStmtOptions );
476469 if( $ret == false ) {
 470+ //TODO: Remove commented-out debug code once done debugging
 471+ //echo '<pre>ERROR</pre>';
 472+ //echo '<pre>' . $sql . '</pre>';
477473 $error = db2_stmt_errormsg();
 474+ //echo '<pre>' . $error . '</pre>';
478475 $this->installPrint( "<pre>$sql</pre>" );
479476 $this->installPrint( $error );
480477 throw new DBUnexpectedError( $this, 'SQL error: '
@@ -498,10 +495,14 @@
499496 */
500497 public function tableExists( $table ) {
501498 $schema = $this->mSchema;
502 - $sql = <<< EOF
 499+ /*$sql = <<< EOF
503500 SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST
504501 WHERE ST.NAME = '$table' AND ST.CREATOR = '$schema'
505 -EOF;
 502+EOF;*/
 503+ $sql = "SELECT COUNT( * ) FROM SYSIBM.SYSTABLES ST WHERE ST.NAME = '" .
 504+ strtoupper( $table ) .
 505+ "' AND ST.CREATOR = '" .
 506+ strtoupper( $schema ) . "'";
506507 $res = $this->query( $sql );
507508 if ( !$res ) {
508509 return false;
@@ -550,12 +551,15 @@
551552 if ( $res instanceof ResultWrapper ) {
552553 $res = $res->result;
553554 }
554 - @$row = db2_fetch_array( $res );
555 - if ( $this->lastErrno() ) {
556 - throw new DBUnexpectedError( $this, 'Error in fetchRow(): '
557 - . htmlspecialchars( $this->lastError() ) );
558 - }
559 - return $row;
 555+ if ( db2_num_rows( $res ) > 0) {
 556+ @$row = db2_fetch_array( $res );
 557+ if ( $this->lastErrno() ) {
 558+ throw new DBUnexpectedError( $this, 'Error in fetchRow(): '
 559+ . htmlspecialchars( $this->lastError() ) );
 560+ }
 561+ return $row;
 562+ }
 563+ return false;
560564 }
561565
562566 /**
@@ -898,9 +902,9 @@
899903 } else {
900904 $sql .= '( ?' . str_repeat( ',?', $key_count-1 ) . ' )';
901905 }
902 - //$this->installPrint( "Preparing the following SQL:" );
903 - //$this->installPrint( "$sql" );
904 - //$this->installPrint( print_r( $args, true ));
 906+ $this->installPrint( "Preparing the following SQL:" );
 907+ $this->installPrint( "$sql" );
 908+ $this->installPrint( print_r( $args, true ));
905909 $stmt = $this->prepare( $sql );
906910
907911 // start a transaction/enter transaction mode
@@ -974,17 +978,18 @@
975979 private function removeNullPrimaryKeys( $table, $args ) {
976980 $schema = $this->mSchema;
977981 // find out the primary keys
978 - $keyres = db2_primary_keys( $this->mConn, null, strtoupper( $schema ),
 982+ /*$keyres = db2_primary_keys( $this->mConn, null, strtoupper( $schema ),
979983 strtoupper( $table )
980 - );
 984+ );*/
 985+ $keyres = $this->doQuery( "SELECT NAME FROM SYSIBM.SYSCOLUMNS WHERE TBNAME = '" . strtoupper( $table ) . "' AND TBCREATOR = '" . strtoupper( $schema ) . "' AND KEYSEQ > 0" );
981986 $keys = array();
982987 for (
983 - $row = $this->fetchObject( $keyres );
 988+ $row = $this->fetchRow( $keyres );
984989 $row != null;
985 - $row = $this->fetchObject( $keyres )
 990+ $row = $this->fetchRow( $keyres )
986991 )
987992 {
988 - $keys[] = strtolower( $row->column_name );
 993+ $keys[] = strtolower( $row[0] );
989994 }
990995 // remove primary keys
991996 foreach ( $args as $ai => $row ) {
@@ -1118,11 +1123,12 @@
11191124 $this->query( $sql, $fname );
11201125 }
11211126
 1127+ $this->insert($table, $row);
11221128 # Now insert the row
1123 - $sql = "INSERT INTO $table ( "
 1129+ /*$sql = "INSERT INTO $table ( "
11241130 . $this->makeList( array_keys( $row ), LIST_NAMES )
11251131 .' ) VALUES ( ' . $this->makeList( $row, LIST_COMMA ) . ' )';
1126 - $this->query( $sql, $fname );
 1132+ $this->query( $sql, $fname );*/
11271133 }
11281134 }
11291135
@@ -1136,6 +1142,7 @@
11371143 if ( $res instanceof ResultWrapper ) {
11381144 $res = $res->result;
11391145 }
 1146+
11401147 if ( $this->mNumRows ) {
11411148 return $this->mNumRows;
11421149 } else {
@@ -1569,7 +1576,7 @@
15701577 */
15711578 public function prepare( $sql, $func = 'DB2::prepare' ) {
15721579 $stmt = db2_prepare( $this->mConn, $sql, $this->mStmtOptions );
1573 - return $stmt;
 1580+ return $stmt;
15741581 }
15751582
15761583 /**
Index: trunk/phase3/includes/installer/Installer.php
@@ -73,6 +73,7 @@
7474 'postgres',
7575 'oracle',
7676 'sqlite',
 77+ 'ibm_db2',
7778 );
7879
7980 /**
Index: trunk/phase3/includes/installer/Installer.i18n.php
@@ -228,6 +228,7 @@
229229 'config-type-postgres' => 'PostgreSQL',
230230 'config-type-sqlite' => 'SQLite',
231231 'config-type-oracle' => 'Oracle',
 232+ 'config-type-ibm_db2' => 'IBM DB2',
232233 'config-support-info' => 'MediaWiki supports the following database systems:
233234
234235 $1
@@ -237,10 +238,12 @@
238239 'config-support-postgres' => '* $1 is a popular open source database system as an alternative to MySQL ([http://www.php.net/manual/en/pgsql.installation.php how to compile PHP with PostgreSQL support]). There may be some minor outstanding bugs, and it is not recommended for use in a production environment.',
239240 'config-support-sqlite' => '* $1 is a lightweight database system which is very well supported. ([http://www.php.net/manual/en/pdo.installation.php How to compile PHP with SQLite support], uses PDO)',
240241 'config-support-oracle' => '* $1 is a commercial enterprise database. ([http://www.php.net/manual/en/oci8.installation.php How to compile PHP with OCI8 support])',
 242+ 'config-support-ibm_db2' => '* $1 is a commercial enterprise database.',
241243 'config-header-mysql' => 'MySQL settings',
242244 'config-header-postgres' => 'PostgreSQL settings',
243245 'config-header-sqlite' => 'SQLite settings',
244246 'config-header-oracle' => 'Oracle settings',
 247+ 'config-header-ibm_db2' => 'IBM DB2 settings',
245248 'config-invalid-db-type' => 'Invalid database type',
246249 'config-missing-db-name' => 'You must enter a value for "Database name"',
247250 'config-missing-db-host' => 'You must enter a value for "Database host"',
@@ -325,6 +328,9 @@
326329 This is more efficient than MySQL's UTF-8 mode, and allows you to use the full range of Unicode characters.
327330
328331 In '''UTF-8 mode''', MySQL will know what character set your data is in, and can present and convert it appropriately, but it will not let you store characters above the [http://en.wikipedia.org/wiki/Mapping_of_Unicode_character_planes Basic Multilingual Plane].",
 332+
 333+ 'config-ibm_db2-low-db-pagesize' => 'There must be a tableblespace with at least 32k of pagesize.',
 334+
329335 'config-site-name' => 'Name of wiki:',
330336 'config-site-name-help' => "This will appear in the title bar of the browser and in various other places.",
331337 'config-site-name-blank' => 'Enter a site name.',
Index: trunk/phase3/includes/installer/Ibm_db2Installer.php
@@ -0,0 +1,250 @@
 2+<?php
 3+/**
 4+ * IBM_DB2-specific installer.
 5+ *
 6+ * @file
 7+ * @ingroup Deployment
 8+ */
 9+
 10+/**
 11+ * Class for setting up the MediaWiki database using IBM_DB2.
 12+ *
 13+ * @ingroup Deployment
 14+ * @since 1.17
 15+ */
 16+class Ibm_db2Installer extends DatabaseInstaller {
 17+
 18+
 19+ protected $globalNames = array(
 20+ 'wgDBserver',
 21+ 'wgDBport',
 22+ 'wgDBname',
 23+ 'wgDBuser',
 24+ 'wgDBpassword',
 25+ 'wgDBmwschema',
 26+ );
 27+
 28+ /**
 29+ * Get the DB2 database extension name
 30+ * @return string
 31+ */
 32+ public function getName(){
 33+ return 'ibm_db2';
 34+ }
 35+
 36+ /**
 37+ * Determine whether the DB2 database extension is currently available in PHP
 38+ * @return boolean
 39+ */
 40+ public function isCompiled() {
 41+ return self::checkExtension( 'ibm_db2' );
 42+ }
 43+
 44+ /**
 45+ * Generate a connection form for a DB2 database
 46+ * @return string
 47+ */
 48+ public function getConnectForm() {
 49+ return
 50+ $this->getTextBox( 'wgDBserver', 'config-db-host', array(), $this->parent->getHelpBox( 'config-db-host-help' ) ) .
 51+ $this->getTextBox( 'wgDBport', 'config-db-port', array(), $this->parent->getHelpBox( 'config-db-port' ) ) .
 52+ Html::openElement( 'fieldset' ) .
 53+ Html::element( 'legend', array(), wfMsg( 'config-db-wiki-settings' ) ) .
 54+ $this->getTextBox( 'wgDBname', 'config-db-name', array(), $this->parent->getHelpBox( 'config-db-name-help' ) ) .
 55+ $this->getTextBox( 'wgDBmwschema', 'config-db-schema', array(), $this->parent->getHelpBox( 'config-db-schema-help' ) ) .
 56+ Html::closeElement( 'fieldset' ) .
 57+ $this->getInstallUserBox();
 58+ }
 59+
 60+ /**
 61+ * Validate and then execute the connection form for a DB2 database
 62+ * @return Status
 63+ */
 64+ public function submitConnectForm() {
 65+ // Get variables from the request
 66+ $newValues = $this->setVarsFromRequest(
 67+ array( 'wgDBserver', 'wgDBport', 'wgDBname',
 68+ 'wgDBmwschema', 'wgDBuser', 'wgDBpassword' ) );
 69+
 70+ // Validate them
 71+ $status = Status::newGood();
 72+ if ( !strlen( $newValues['wgDBname'] ) ) {
 73+ $status->fatal( 'config-missing-db-name' );
 74+ } elseif ( !preg_match( '/^[a-zA-Z0-9_]+$/', $newValues['wgDBname'] ) ) {
 75+ $status->fatal( 'config-invalid-db-name', $newValues['wgDBname'] );
 76+ }
 77+ if ( !strlen( $newValues['wgDBmwschema'] ) ) {
 78+ $status->fatal( 'config-invalid-schema' );
 79+ }
 80+ elseif ( !preg_match( '/^[a-zA-Z0-9_]*$/', $newValues['wgDBmwschema'] ) ) {
 81+ $status->fatal( 'config-invalid-schema', $newValues['wgDBmwschema'] );
 82+ }
 83+ if ( !strlen( $newValues['wgDBport'] ) ) {
 84+ $status->fatal( 'config-invalid-port' );
 85+ }
 86+ elseif ( !preg_match( '/^[0-9_]*$/', $newValues['wgDBport'] ) ) {
 87+ $status->fatal( 'config-invalid-port', $newValues['wgDBport'] );
 88+ }
 89+
 90+ // Submit user box
 91+ if ( $status->isOK() ) {
 92+ $status->merge( $this->submitInstallUserBox() );
 93+ }
 94+ if ( !$status->isOK() ) {
 95+ return $status;
 96+ }
 97+
 98+ global $wgDBport;
 99+ $wgDBport = $newValues['wgDBport'];
 100+
 101+ // Try to connect
 102+ $status->merge( $this->getConnection() );
 103+ if ( !$status->isOK() ) {
 104+ return $status;
 105+ }
 106+
 107+ $this->parent->setVar( 'wgDBuser', $this->getVar( '_InstallUser' ) );
 108+ $this->parent->setVar( 'wgDBpassword', $this->getVar( '_InstallPassword' ) );
 109+
 110+ return $status;
 111+
 112+ }
 113+
 114+ /**
 115+ * Open a DB2 database connection
 116+ * @return Status
 117+ */
 118+ public function openConnection() {
 119+ $status = Status::newGood();
 120+ try {
 121+ $db = new DatabaseIbm_db2(
 122+ $this->getVar( 'wgDBserver' ),
 123+ $this->getVar( '_InstallUser' ),
 124+ $this->getVar( '_InstallPassword' ),
 125+ $this->getVar( 'wgDBname' ),
 126+ 0,
 127+ $this->getVar( 'wgDBmwschema' )
 128+ );
 129+ $status->value = $db;
 130+ } catch ( DBConnectionError $e ) {
 131+ $status->fatal( 'config-connection-error', $e->getMessage() );
 132+ }
 133+ return $status;
 134+ }
 135+
 136+ /**
 137+ * Create a DB2 database for MediaWiki
 138+ * @return Status
 139+ */
 140+ public function setupDatabase() {
 141+ $status = $this->getConnection();
 142+ if ( !$status->isOK() ) {
 143+ return $status;
 144+ }
 145+ $conn = $status->value;
 146+ $dbName = $this->getVar( 'wgDBname' );
 147+ if( !$conn->selectDB( $dbName ) ) {
 148+ $conn->query( "CREATE DATABASE "
 149+ . $conn->addIdentifierQuotes( $dbName )
 150+ . " AUTOMATIC STORAGE YES"
 151+ . " USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM"
 152+ . " PAGESIZE 32768", __METHOD__ );
 153+ $conn->selectDB( $dbName );
 154+ }
 155+ $this->setupSchemaVars();
 156+ return $status;
 157+ }
 158+
 159+ /**
 160+ * Create tables from scratch.
 161+ * First check if pagesize >= 32k.
 162+ *
 163+ * @return Status
 164+ */
 165+ public function createTables() {
 166+ $status = $this->getConnection();
 167+ if ( !$status->isOK() ) {
 168+ return $status;
 169+ }
 170+ $this->db->selectDB( $this->getVar( 'wgDBname' ) );
 171+
 172+ if( $this->db->tableExists( 'user' ) ) {
 173+ $status->warning( 'config-install-tables-exist' );
 174+ return $status;
 175+ }
 176+
 177+ /* Check for pagesize */
 178+ $status = $this->checkPageSize();
 179+ if ( !$status->isOK() ) {
 180+ return $status;
 181+ }
 182+
 183+ $this->db->setFlag( DBO_DDLMODE ); // For Oracle's handling of schema files
 184+ $this->db->begin( __METHOD__ );
 185+
 186+ $error = $this->db->sourceFile( $this->db->getSchema() );
 187+ if( $error !== true ) {
 188+ $this->db->reportQueryError( $error, 0, '', __METHOD__ );
 189+ $this->db->rollback( __METHOD__ );
 190+ $status->fatal( 'config-install-tables-failed', $error );
 191+ } else {
 192+ $this->db->commit( __METHOD__ );
 193+ }
 194+ // Resume normal operations
 195+ if( $status->isOk() ) {
 196+ $this->enableLB();
 197+ }
 198+ return $status;
 199+ }
 200+
 201+ /**
 202+ * Check if database has a tablspace with pagesize >= 32k.
 203+ *
 204+ * @return Status
 205+ */
 206+ public function checkPageSize() {
 207+ $status = $this->getConnection();
 208+ if ( !$status->isOK() ) {
 209+ return $status;
 210+ }
 211+ $this->db->selectDB( $this->getVar( 'wgDBname' ) );
 212+
 213+ try {
 214+ $result = $this->db->query( 'SELECT PAGESIZE FROM SYSCAT.TABLESPACES' );
 215+ if( $result == false ) {
 216+ $status->fatal( 'config-connection-error', '' );
 217+ }
 218+ else {
 219+ $nRows = $this->db->numRows( $result );
 220+ while ( $row = $row = $this->db->fetchRow( $result ) ) {
 221+ if( $row[0] >= 32768 ) {
 222+ return $status;
 223+ }
 224+ }
 225+ $status->fatal( 'config-ibm_db2-low-db-pagesize', '' );
 226+ }
 227+ } catch ( DBUnexpectedError $e ) {
 228+ $status->fatal( 'config-connection-error', $e->getMessage() );
 229+ }
 230+
 231+ return $status;
 232+ }
 233+
 234+ /**
 235+ * Generate the code to store the DB2-specific settings defined by the configuration form
 236+ * @return string
 237+ */
 238+ public function getLocalSettings() {
 239+ $schema = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBmwschema' ) );
 240+ $port = LocalSettingsGenerator::escapePhpString( $this->getVar( 'wgDBport' ) );
 241+ return
 242+"# IBM_DB2 specific settings
 243+\$wgDBmwschema = \"{$schema}\";
 244+\$wgDBport = \"{$port}\";";
 245+ }
 246+
 247+ public function __construct($parent) {
 248+ parent::__construct($parent);
 249+ }
 250+}
 251+?>
Index: trunk/phase3/includes/installer/Ibm_db2Updater.php
@@ -0,0 +1,70 @@
 2+<?php
 3+/**
 4+ * IBM_DB2-specific updater.
 5+ *
 6+ * @file
 7+ * @ingroup Deployment
 8+ */
 9+
 10+/**
 11+ * Class for handling updates to IBM_DB2 databases.
 12+ *
 13+ * @ingroup Deployment
 14+ * @since 1.17
 15+ */
 16+class Ibm_db2Updater extends DatabaseUpdater {
 17+
 18+ /**
 19+ * Get the changes in the DB2 database scheme since MediaWiki 1.14
 20+ * @return array
 21+ */
 22+ protected function getCoreUpdateList() {
 23+ return array(
 24+ // 1.14
 25+ array( 'addField', 'site_stats', 'ss_active_users', 'patch-ss_active_users.sql' ),
 26+ array( 'addField', 'ipblocks', 'ipb_allow_usertalk', 'patch-ipb_allow_usertalk.sql' ),
 27+
 28+ // 1.15
 29+ array( 'addTable', 'change_tag', 'patch-change_tag.sql' ),
 30+ array( 'addTable', 'tag_summary', 'patch-change_tag_summary.sql' ),
 31+ array( 'addTable', 'valid_tag', 'patch-change_valid_tag.sql' ),
 32+
 33+ // 1.16
 34+ array( 'addTable', 'user_properties', 'patch-user_properties.sql' ),
 35+ array( 'addTable', 'log_search', 'patch-log_search.sql' ),
 36+ array( 'addField', 'logging', 'log_user_text', 'patch-log_user_text.sql' ),
 37+ array( 'addTable', 'l10n_cache', 'patch-l10n_cache.sql' ),
 38+ array( 'addTable', 'external_user', 'patch-external_user.sql' ),
 39+ array( 'addIndex', 'log_search', 'ls_field_val', 'patch-log_search-rename-index.sql' ),
 40+ array( 'addIndex', 'change_tag', 'change_tag_rc_tag', 'patch-change_tag-indexes.sql' ),
 41+ array( 'addField', 'redirect', 'rd_interwiki', 'patch-rd_interwiki.sql' ),
 42+
 43+ // 1.17
 44+ array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
 45+ array( 'addField', 'updatelog', 'ul_value', 'patch-ul_value.sql' ),
 46+ array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api_and_wikiid.sql' ),
 47+ array( 'addField', 'categorylinks', 'cl_collation', 'patch-categorylinks-better-collation.sql' ),
 48+ array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
 49+ array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
 50+
 51+ // Tables
 52+ array( 'addTable', 'iwlinks', 'patch-iwlinks.sql' ),
 53+ array( 'addTable', 'msg_resource_links', 'patch-msg_resource_links.sql' ),
 54+ array( 'addTable', 'msg_resource', 'patch-msg_resource.sql' ),
 55+ array( 'addTable', 'module_deps', 'patch-module_deps.sql' ),
 56+
 57+ // Indexes
 58+ array( 'addIndex', 'msg_resource_links', 'uq61_msg_resource_links', 'patch-uq_61_msg_resource_links.sql' ),
 59+ array( 'addIndex', 'msg_resource', 'uq81_msg_resource', 'patch-uq_81_msg_resource.sql' ),
 60+ array( 'addIndex', 'module_deps', 'uq96_module_deps', 'patch-uq_96_module_deps.sql' ),
 61+
 62+ // Fields
 63+ array( 'addField', 'categorylinks', 'cl_sortkey_prefix', 'patch-cl_sortkey_prefix-field.sql' ),
 64+ array( 'addField', 'categorylinks', 'cl_collation', 'patch-cl_collation-field.sql' ),
 65+ array( 'addField', 'categorylinks', 'cl_type', 'patch-cl_type-field.sql' ),
 66+ array( 'addField', 'interwiki', 'iw_api', 'patch-iw_api-field.sql' ),
 67+ array( 'addField', 'interwiki', 'iw_wikiid', 'patch-iw_wikiid-field.sql' )
 68+ );
 69+ }
 70+}
 71+?>
Index: trunk/phase3/includes/AutoLoader.php
@@ -486,6 +486,8 @@
487487 'SqliteUpdater' => 'includes/installer/SqliteUpdater.php',
488488 'OracleInstaller' => 'includes/installer/OracleInstaller.php',
489489 'OracleUpdater' => 'includes/installer/OracleUpdater.php',
 490+ 'Ibm_db2Installer' => 'includes/installer/Ibm_db2Installer.php',
 491+ 'Ibm_db2Updater' => 'includes/installer/Ibm_db2Updater.php',
490492
491493 # includes/job
492494 'DoubleRedirectJob' => 'includes/job/DoubleRedirectJob.php',

Follow-up revisions

RevisionCommit summaryAuthorDate
r85893Fix typo in r85885.siebrand17:08, 12 April 2011
r85896Addressing comments by Krinkle on r85885. Removing commented-out code. Verifi...leonsp17:18, 12 April 2011
r86079Followup r85885: Better error message for an insufficient pagesize in a DB2 d...leonsp20:03, 14 April 2011
r86196Fix $row = $row = $.... and unused variable from r85885reedy11:22, 16 April 2011
r86325E_STRICT in DB2. Ping r85885.maxsem17:28, 18 April 2011
r106480Fixes to DB2 support:...leonsp21:17, 16 December 2011

Comments

#Comment by IAlex (talk | contribs)   16:47, 12 April 2011
  • Please set svn:eol-style property for the files you added
  • Don't put ?> at the end of PHP files
#Comment by Krinkle (talk | contribs)   16:53, 12 April 2011

Note: I have no experience with lbm_db2.

I've looked at the first half dozen diffs, here's some general notes:

--- includes/db/DatabaseIbm_db2.php
+++ includes/db/DatabaseIbm_db2.php

460 + //TODO: Remove commented-out debug code once done debugging
470 + //echo '<pre>ERROR</pre>';
471 + //echo '<pre>' . $sql . '</pre>';
472   $error = db2_stmt_errormsg();
473 + //echo '<pre>' . $error . '</pre>';

This needs to be removed


498 - $sql = <<< EOF
498 + /*$sql = <<< EOF
502 + $sql = "SELECT COUNT( * )

I guess the new value is better, but the old one doesn't have to stay in /* comments */, should be removed as well.


905: - //$this->installPrint( "Preparing the following SQL:" );
905 + $this->installPrint( "Preparing the following SQL:" ); 

The previous code on that line (which appears to be debug left by a previous developer) was uncommented. Should this be commented out again ?


There's probably a bit more of this. I haven't looked further.

#Comment by Leonsp (talk | contribs)   17:26, 12 April 2011

Thanks for taking a look.

  • Fixed svn:eol-style, ?> in r85890
  • Taken out commented-out code in r85896
  • Fixed some indentation I missed
  • Checked to make sure there's no more of the commented out code in the diffs
#Comment by MaxSem (talk | contribs)   17:19, 13 April 2011

The message "There must be a tablespace with at least 32k of pagesize" looks like it needs some tweaks.

#Comment by Leonsp (talk | contribs)   20:06, 14 April 2011

Updated the message in r86079 to:

  • "Your DB2 database has a default tablespace with insufficient pagesize. The pagesize has to be 32K or greater."

Status & tagging log