Commit graph

145 commits

Author SHA1 Message Date
Alexandre Emsenhuber
78a56a67ba Added missing GPLv2 headers in includes/db.
Change-Id: Ib8fe301c6db77603e411113cea5a39c25c664961
2012-04-26 10:47:10 +02:00
Max Semenik
a8f718267e Follow-up r112565: fix code duplication 2012-02-28 14:42:08 +00:00
Chad Horohoe
2177a4d8b4 (bug 34762) Calling close() on a DatabaseBase object now clears the connection. Based on patch by Christian.
By the way, the duplication here is stupid.
2012-02-28 02:18:18 +00:00
Alexandre Emsenhuber
d97561461c Pass __METHOD__ to DatabaseBase::begin(), DatabaseBase::commit() and DatabaseBase::rollback() 2012-02-25 13:23:43 +00:00
Sam Reed
76246b9bf5 More return documentation 2012-02-09 21:33:27 +00:00
Sam Reed
01698002f1 Strict Standards: Declaration of DatabaseOracle::sourceStream() should be compatible with that of DatabaseBase::sourceStream()
Followup r108768, and also use $inputCallback
2012-02-02 15:12:28 +00:00
Jure Kajzer
ec53acbede * removed manual cascading of recentchanges on page delete
* fixed purgeCache bug in updater
* TESTED install/update from 1.18/phpunit
2011-12-20 16:11:45 +00:00
Sam Reed
bf62deece8 Reverting r103706
Only seemingly supported by MySQL, and likely a seldom used function

Not worth trying to support it, as other non mysql db's would need workarounds, and that's just not happening
2011-12-02 00:29:46 +00:00
Sam Reed
653444790b * (bug 8859) Database::update should take array of tables too
Original patch by Andrew Dunbar

Also apply in DatabaseOracle and DB2 code as they override update
2011-11-19 20:17:29 +00:00
Sam Reed
9814e6b075 Add $fname to tableExists
Pass $fname/__METHOD__ in in upstream callers
2011-11-10 20:39:23 +00:00
Jure Kajzer
5933586266 some more oracle-phpunit-fu (should not affect non-oracle)
* CloneDatabase - already droping tables in internal function, removed duplicate action
* DatabaseOracle - stopped ignoring "temporary" parameter
* added two parameters to phpunit (use-normal-tables & reuse-db), default actions stay the same
* with reuse-db oracle phpunit test run on oracle down to 1m 20s ;)
2011-11-10 13:29:32 +00:00
Jure Kajzer
be3bbfc539 * Added getInfinity to DatabaseOracle
* Block - replaced 'infinity' strings with DB->getInfinity calls
* UploadStash - added sequence value generation for ID
2011-11-10 07:41:12 +00:00
Jure Kajzer
636f304d20 * phpunit fixes & optimizations for oracle backend 2011-11-09 15:50:24 +00:00
Chad Horohoe
70430650e9 Followup r96369: update child classes and a few callers 2011-09-06 20:51:10 +00:00
Jure Kajzer
8951968902 * resolved some issues with sequences and deleting of rows on referenced tables 2011-09-02 10:42:08 +00:00
Sam Reed
8c59bf69ee Fix fail double pasting from r95497 2011-08-25 17:48:55 +00:00
Sam Reed
4d21db9f0b Followup r95449, fix the code to do what it was actually intended to do 2011-08-25 17:47:33 +00:00
Sam Reed
87f03bf97e Allow update to be passed an empty array for the WHERE condition 2011-08-24 21:38:31 +00:00
Jure Kajzer
3ac0d87cfb * DatabaseOracle.php binds variables, so using $val = 'NULL' breaks certain maint. scripts 2011-07-08 12:28:59 +00:00
Tim Starling
0e73205470 General database-related code cleanup:
* Merged the 4 simulated implementations of Database*::replace(). I took diffs, they were nearly identical. I made one based on the IBM DB2 version, since it used insert() which looked like a nice touch.
* Provided the non-simulated implementation of Database*::replace() via a protected member function, and made DatabaseMysql::replace() and DatabaseSqlite::replace() into a wrapper for it. 
* Moved the MySQL-specific functionality from masterPosWait(), getSlavePos() and getMasterPos() from DatabaseBase to DatabaseMysql. 
* Renamed getStatus() to getMysqlStatus() and moved it to DatabaseMysql. Removed "unimplemented" errors from two other subclasses. Really there's no way another DBMS could or should implement this function. 
* Split the LoadMonitor class into a no-op class and a MySQL-specific class, to avoid fatal errors due to the getMysqlStatus() call if other DBMSs tried to use LoadBalancer with multiple servers. Of course there are lots of other reasons it won't work, I'm just fixing the architecture issue here.

And while I have a replicated test setup handy:
* On MySQL 4.1.9 and later, use SHOW SLAVE STATUS to get the lag instead of SHOW PROCESSLIST. This has the advantage of reading zero when there are no events for a while.
2011-06-23 03:14:11 +00:00
Tim Starling
5fcd668a02 Followup r90429:
* Reverted the public -> protected changes from r90429, except for doQuery() after a review of usage:
** resultObject() is used by lots of things in core and extensions. 
** makeSelectOptions() is used by SMW, and if that's going to be public, the other two probably should be too, for consistency. 
** doQuery() was used by several things, but mostly by mistake. It's been marked private since r21359 which is before almost all of them. I updated the callers to use query().

* Added "protected" to doQuery() declarations in other database classes.
2011-06-20 12:09:22 +00:00
Platonides
8093e9733c All the databases but MySQL were overriding DatabaseBase::deleteJoin() with the same code.
Move DatabaseBase::deleteJoin() to DatabaseMysql::deleteJoin() and the common code to DatabaseBase::deleteJoin()
Follow up r90356
2011-06-18 20:26:31 +00:00
Sam Reed
bdf84cb20e Swap else if for elseif
Trimming trailing whitespace also

Doing in 3 commits, so hopefully reviewable in CR...
2011-06-17 16:03:52 +00:00
Jure Kajzer
edd10806bc * merge r89759 from REL1_17 into trunk
* changed addQuotes expected result for addQuotes in DatabaseTest
2011-06-09 08:43:53 +00:00
Jure Kajzer
4922a1cbda * fixed table duplication for unit tests
* fixed sequence handling when using DB prefix
* deferring constraints on transaction, switching back to immediate on commit/rollback
* hardcoded NLS_NUMERIC_CHARACTERS as it breaks using floats in sql if connection is in a non-US-like NLS_LANG (all vars are bound as chars)
2011-06-07 05:09:32 +00:00
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