Commit graph

120 commits

Author SHA1 Message Date
Jure Kajzer
2967a44864 * fixed table duplication for phpunit testing 2011-06-02 22:23:05 +00:00
Jure Kajzer
cdd4176e8d * unified where clause parameter wrapping for delete, update and selectRow
* fixed replace where clause handling
2011-06-01 11:38:25 +00:00
Jure Kajzer
97fe1bc9aa * updated listTables function to also take in account possible user-dbname difference
* using different database will still probabbly break phpunit tests, but it's a step
2011-06-01 08:41:44 +00:00
Jure Kajzer
6047e22b5e * upgrade patches for oracle 1.17->1.19
* fixed tableExists to handle possible username-dbname difference
* added indexExists for updater
* fixed a bug in DatabaseUpdater
* tried not to produce bugs (may have failed)
2011-06-01 08:27:51 +00:00
Sam Reed
527e85fa9f More documentation in various files 2011-05-29 14:01:47 +00:00
Sam Reed
c73746981c Param documentation updates/added 2011-05-26 19:21:50 +00:00
Jure Kajzer
b6418393ac * fixed tableName handling for internal purposes (bug if using sharedDB as i need raw table name) 2011-05-04 10:43:34 +00:00
Jure Kajzer
955385cee7 * close connection in class destructor (unlike MySql, Oracle does not commit on close) 2011-04-28 12:44:19 +00:00
Sam Reed
8e80b8c3c1 Tidy up some unused variables and such 2011-04-23 21:40:52 +00:00
Jure Kajzer
398a7891f8 * begin, commit, rollback functions updated
* using ->execFlags instead of hardcoded OCI_DEFAULT
* added dummy page (id=0) to satisfy FK checks
2011-04-22 11:31:18 +00:00
Sam Reed
a6f56411a2 Remove some unused variables/globals
Fix another unreachable statement
2011-04-16 11:28:35 +00:00
Jure Kajzer
3b916c3763 * updated tableName function changed addIdentifierQuotes, added isQuotedIdentifier and removeIdentifierQuotes
* quoting objects in Oracle is poorly supported prior to 10g (it still has bugs in 10g) so i wish to avoid it for as long as possible
* i've added /*Q*/ marker to avoid double-prefixing of table names
* tableName quoted parameter is usable only in cases where you call it directly in functions where it might occur that tableName can get called twice it is unusable as the tableName gets prefixed twice


Oracle documentation is generally crappy. They claim a lot of things but some of those claims depend on a gazillion of factors and in case of one of this factors being a bit off have no general solution. Object name quoting is one of such things and is general practice amongst oracle DBAs that if you write the code directly you can use them but if you write abstracted or embedded code it's best to stay away if you can.
2011-04-15 10:48:02 +00:00
Platonides
d210706028 $wgDBprefix shall be converted to uppercase per r85786 2011-04-12 20:56:35 +00:00
Platonides
bdbe39d28c Follow up r85888: Add the parameter to DatabasePostgres.php and DatabaseOracle.php
Follow up r85884: The parent tableName() should work now for DatabaseMssql.php
2011-04-12 18:59:19 +00:00
Platonides
f524482f2d Change the duplicateTableStructure() to use the original names.
It is now duplicateTableStructure() duty to addIdentifierQuotes() them.
Fixed bug for mysql < 4.1 where the new name would be quoted twice.

Always quote identifier in Oracle, doing otherwise seems a bug (can someone confirm?)
2011-04-12 18:54:51 +00:00
Platonides
a91d6f4cac Abstract tableName() by adding new function isQuotedIdentifier() to databases.
This fixes bug in DatabaseOracle.php tableName() on line 671 and allows it to call 
the parent implementation instead of copying it with different quotes.
Adapt Mssql addIdentifierQuotes(). Replace its addIdentifierQuotes calls with addQuotes
as it's what it really is. The serialize() is probably unneeded, since I don't think it will
ever be called with objects but I kept it anyway.
2011-04-12 16:34:12 +00:00
Chad Horohoe
2adce95338 rm unused member var 2011-03-03 15:34:12 +00:00
Jure Kajzer
7ba01e2038 * forgot about those ... 2011-03-01 13:58:50 +00:00
Jure Kajzer
3002621fb7 * OracleInstaller now also supports installation with (requested by Tim):
** preexisting account 
** privileged account into a restricted account
* DatabaseOracle fixed a fixme (made by Reedy)
2011-03-01 13:50:52 +00:00
Sam Reed
d2e409eed1 Mark a fixme comment in Oracle DB file for undefined variable
Add documentation
2011-02-18 22:58:02 +00:00
Tim Starling
e1c8e80297 * Fixed Oracle new installer support, broken by r80957. This is a minimal patch and doesn't address the architectural issues.
** Moved the responsibility for calling setupSchemaVars() on install to the DatabaseInstaller subclass. This allows it to be called after setupDatabase() has completed, as required by Oracle and PostgreSQL.
** Fixed OracleInstaller::getConnection() so that it respects $this->useSysDBA correctly.
** In OracleInstaller, added some more variables to the list of schema vars, which are needed by user.sql and tables.sql
** In SearchOracle, specify the database name when calling ctx_ddl.sync_index(). This fixes a fatal error in the createMainpage step, caused by the schema name not being equal to the current user. 

* In oracle/tables.sql, fixed a couple of indexes with missing table prefixes.
* Improved debugging output in DatabaseInstaller::getConnection() and Installer::createMainpage().
* In DatabaseBase::selectDB(), set $this->mDBname correctly, as in DatabaseMysql.
2011-01-27 08:25:48 +00:00
Tim Starling
0c86b1611a * Fixed a bug causing the installer to ignore the "engine" and "charset" settings when installing a MySQL database.
* Fixed a bug causing the engine and charset settings to not be properly preserved when adding new tables on upgrade.
* Fixed total breakage of SQLite upgrade, by reusing the administrative connection to the SQLite database instead of creating a new one when wfGetDB() is called. Added LBFactory_Single to support this. 
* Introduced a "schema variable" concept to DatabaseBase to avoid the use of globals for communication between the installer and the Database. Removed a lot of old global variable names from Database::replaceVars(), most were only added on a whim and were never used.
* Introduced DatabaseInstaller::getSchemaVars(), to allow schema variables to be supplied by the DatabaseInstaller child classes.
* Removed messages config-mysql-egine-mismatch [sic] and config-mysql-charset-mismatch. In the old installer it was possible for users to request a certain character set for an upgrade, but in the new installer the question is never asked. So these warnings were shown whenever a non-default character set or engine was used in the old database.
* In MysqlInstaller::preUpgrade(), fixed the incorrect strings used to identify the MySQL character sets: mysql5 instead of utf8 and mysql5-binary instead of binary.
* On install, initialise the site_stats table, using code copied from the old installer. Unlike the old installer, use SiteStats to increment the user count when the initial user is added.
* Fixed several instances of inappropriate call-by-reference. 
* Replaced call_user_func_array() with call_user_func() where possible, it is shorter and simpler.	
* Moved the caching boilerplate for DatabaseInstaller::getConnection() to the base class, and have the derived classes override an uncached function openConnection() instead. Updates r80892.
* In MysqlInstaller::getLocalSettings(), escape PHP strings correctly with LocalSettingsGenerator::escapePhpString(). 
* Reduce timeout for checks in dirIsExecutable() to 3 seconds, so that it doesn't take 30s to run when apache is in single-threaded mode for debugging.
* MySQL and SQLite have been tested and they appear to work. PostgreSQL upgrade is totally broken, apparently it was like that before I started. The Oracle code is untested.
2011-01-25 07:37:48 +00:00
Chad Horohoe
a5053d4c5a * Cleanup massive duplication across Database constructors. Default implementation fairly sane. Now they all share the same if( $server ) logic to allow constructing the class without forcing open a connection (MySQL has done this since at least r15094)
* Get rid of intermediate installTables() callback
* Actually cache the result of DbInstaller::getConnection() like the documentation says
2011-01-24 18:36:09 +00:00
Jure Kajzer
ba8019afff * fixed oracle code for updater (corrected not null BLOB field adding)
* added required DB vars in WebInstaller_ExistingWiki 
* oracle upgrades normally 1.16=>1.17
2011-01-10 20:11:43 +00:00
Jure Kajzer
f853d711ac * fixed Oracle code for installer and phpunit tests
* removed ORABlob class
2011-01-10 19:22:27 +00:00
Chad Horohoe
4ece90ed4b Remove ancient and deprecated newFromParams() constructor wrappers from various DatabaseBase implementations. Only callers are AskSql and WikiTrust. Both are calling the (very old) Database class anyway, so are obviously expecting a MySQL connection and can use the fallback (which yells wfDeprecated) in DatabaseBase 2011-01-07 20:25:52 +00:00
Chad Horohoe
60e537e774 Fixes for r75545: don't use MEDIAWIKI_INSTALL in the updaters classes, it's not what it's for. Add new DBO_DDLMODE flag which does the same thing (and moved it up to DatabaseUpdater, in case any other children need it) 2011-01-06 19:25:47 +00:00
Roan Kattouw
475c331f60 Remove now-unused SQL timestamp conversion functions added in r77231. They were made obsolete by the querypage-work2 branch merge in r78786 2010-12-31 16:29:44 +00:00
Sam Reed
48ebf5bbb5 Fix private class member variable access
Some method documentation
2010-12-30 17:41:19 +00:00
Chad Horohoe
358539bc1d More old installer cruft 2010-12-17 15:49:51 +00:00
Daniel Friesen
aae05c49f8 MySQL is the only database which quotes identifiers primarily using backticks. Move the backtick based addIdentifierQuotes implementation from the generic into DatabaseMysql and take the duplicated implementation used by oracle, sqlite, ibm_db2, postgresql, and mssql and remove it from all of them migrating it to the generic Database class as the default. 2010-12-04 15:35:36 +00:00
Daniel Friesen
692ad26f68 Followup to r77713, rename quote_ident to addIdentifierQuotes to follow naming conventions better. While I'm at it adding a missing addIdentifierQuotes implementation for Ibm_db2. 2010-12-04 15:14:08 +00:00
Daniel Friesen
da469e3abe Fix a bug in the installer caused by r77487 creating installer sql statements like "GRANT ALL PRIVILEGES ON 'dbname'.* TO ''tablename''@'%" while improving the database independence of replaceVars.
* Drop unused and likely broken /*$var*/` -> `$var syntax
* Replace {$var} with '{$var}' and `{$var}` handling that uses relevant database independent quoting ({$var} without surrouding quotes are never used)
* Give the generic/mysql class a proper quote_ident implementation
* Fix the unused Oracle and Sqlite quote_ident implementations which are potential sql injections if used
* Split common variable replacemnt code off to a replaceGlobalVars and make the generic and oracle code use it instead of duplicating the same code as each other
2010-12-04 09:27:02 +00:00
Platonides
bd6b4d7af8 Replace addslashes with Database::addQuotes() 2010-11-30 18:21:55 +00:00
Alexandre Emsenhuber
6cb276056b Moved switches in Special:Unusedimages and Special:Ancientpages to extract a unix timestamp from a fielf to DatabaseBase and related classes to avoid code duplication 2010-11-24 15:40:25 +00:00
Max Semenik
c278bc2e09 Fixed $fname in some places 2010-11-23 11:21:00 +00:00
Max Semenik
4345c2c20e Refactoring of *Field classes:
* Made them all implement one common interface (might add more functions to it later)
* Moved MySQLField to DatabaseMysql.php
* Renamed nullable() to isNullable()
* Removed maxLength() from:
** SQLiteField: makes no sense
** MySQLField: doesn't do what people may think, useless for this class' purpose of assisting querying the DB schema
2010-11-21 19:56:51 +00:00
Jure Kajzer
43e9d51b0e * Oracle: prefetching column names in ORAResult so i can release statement after constructor.
This fixes too many open cursors issue, importing of large sets now works.
2010-11-18 13:17:16 +00:00
Jure Kajzer
7c0db2ba75 * BLOB temporary handling
* en/decodeBlob
2010-11-09 08:56:15 +00:00
Chad Horohoe
6150c3d8fb Oracle maintainer should enable E_STRICT ;-) 2010-10-30 17:20:41 +00:00
Chad Horohoe
8f0a7ccc00 E_STRICT: Function signature should match parent. This newFromParams stuff should be going away soon anyway 2010-10-30 17:17:26 +00:00
Jure Kajzer
e99125adf1 * installers skips recreation of existing user
* updater for 16->17 schema changes 
* i dedicate this revision to my greatest supporter ... Reedy :)
2010-10-27 14:52:18 +00:00
Jure Kajzer
1eede8e88b * DatabaseOracle - throw connection exception instead of debug+false
* DatabaseOracle - fixed $wgContLang local usage in update
* Installer - added Main Page insertion as a new installation step (fixes bug 22308)
2010-10-25 16:49:59 +00:00
Jure Kajzer
8e777b538a * fixed accidental revert of r75343 2010-10-25 12:06:37 +00:00
Jure Kajzer
ef484d5fe7 * null value => default value handling
* duplicateTable call fix
* some internal calls to query replaced with doQuery 
* added update method overload
2010-10-25 10:56:07 +00:00
Sam Reed
d189aaee05 (bug 24853) Kill failFunction - Fixed! :D 2010-10-24 21:27:33 +00:00
Jure Kajzer
49c9990074 * fixed r74949 remarks
* modified version lookup, added 9iR1 as minimum version for installation.
2010-10-19 06:25:12 +00:00
Jure Kajzer
6d11fb986f * Installer: works (beta). More testing tomorow.
* Updater: todo. For now it skips.
2010-10-18 16:09:18 +00:00
Sam Reed
6b3b915353 Big attack on unused variables... 2010-10-14 20:53:04 +00:00
Alexandre Emsenhuber
3c386b90cb __FUNCTION__ -> __METHOD__ 2010-10-02 08:04:58 +00:00