Commit graph

94 commits

Author SHA1 Message Date
X!
8cc3688dfd Move FakeResultWrapper to Database.php, allowing more special pages and extensions than just Special:Allmessages to use a ResultWrapper-specific class (TablePager comes to mind) 2010-07-15 22:39:48 +00:00
Max Semenik
e3b1c14542 Fixed mysqlisms in Database.php comments, abstracted getSearchEngine() 2010-07-10 10:15:59 +00:00
Chad Horohoe
c7f9869cf8 Kill deprecated function. Marked as such for ~30k revs and no callers 2010-07-09 14:15:48 +00:00
Max Semenik
775adbf329 Got rid of remaining usages of immediateBegin()/immediateCommit(), marked these functions with wfDeprecated() 2010-07-05 19:47:46 +00:00
Alexandre Emsenhuber
a643b87295 Fixed some doxygen warnings 2010-07-04 14:41:26 +00:00
Max Semenik
75d41fe3b6 Refactored Database*::getLag(): moved the default implementation to MySQL, replaced it with a proper dummy, deleted stub implementations from other classes. This adds fake lag support to all databases. 2010-07-02 13:17:28 +00:00
Max Semenik
67ebe72ade * Replaced the mess of every database class implementing filedExists() is its own way with one simple function in base class. Verified to work on MySQL, Postgres and SQLite.
* Fixed fieldInfo() on Postgres not using tableName() and thus failing for table user, for example.
* Made fieldInfo() on MySQL return false instead of throwing a query error if table does not exist. This is consistent with other databases' behaviour.
2010-07-02 10:01:09 +00:00
Platonides
62a615c6c0 Actually check sourceFile for failure, showing the error message in the install.
See report on http://permalink.gmane.org/gmane.org.wikimedia.mediawiki/33902
Fixed several tag nesting problems from setup_database().
Make sourceFile() always use text errors in the installer. It can't handle 
exceptions properly (introduced in r36211). But they are appropiate for update.php
thus the ugly branches.
The installer now always handles sourceFile() errors.
2010-04-29 21:49:58 +00:00
Max Semenik
092b9d9f92 Marked Database::newFromParams() as deprecated, cleaned up a few mysqlisms in comments 2010-04-28 18:12:42 +00:00
Brion Vibber
8eac509ab5 * (bug 14473) Add iwlinks table to track inline interwiki link usage
Like langlinks, this stores the interwiki prefix (as iwl_prefix) and full page title (as iwl_title), attached to the page doing the liking (as iwl_from -> page_id).
Unlike langlinks, there can be multiple entries stored per interwiki prefix.

Updater to add the table confirmed on MySQL, untested on SQLite but should work.
Someone may still need to add and test a PostgreSQL updater.

Refactored makeWhereFrom2d() out of LinkBatch to Database so it could be re-used for the similar mapping for the interwiki links, which need a string prefix rather than an int namespace key.
Also cleaned it up internally to reuse existing code for building where clauses from arrays. (Tim & Domas -- if the previous more verbose code was there to reduce function call and array processing overhead on very large link lists, feel free to unroll it again if the difference is measurable. Just swap the var names around from the old LinkBatch code and escape the base key value if it's not an integer, it'll be functionally equivalent.)
2010-04-16 01:40:05 +00:00
Alexandre Emsenhuber
1e2840cd31 Fixed some errors while running patchSql.php:
* Notice: Undefined variable: name in includes/db/Database.php on lines 2209 and 2212
* Fatal error: Call to undefined method DatabaseMysql::fileSource() in maintenance/patchSql.php on line 48
2010-03-14 15:48:29 +00:00
Mark A. Hershberger
564dafbdcf whitespace. 2010-03-06 18:14:11 +00:00
Max Semenik
eff719b75d Fixed r61214: moved MySQL munging to SearchEngine, updated calls. Can we kill $doStrip now? 2010-01-22 20:36:26 +00:00
Platonides
33917224dc (bug 21870) Remove Google logo loaded from it servers (privacy concern).
The form is now left as googlesearch message. We should probably remove the duplication and load it with wfMsgWeirdKey.
2010-01-20 22:01:37 +00:00
Max Semenik
f6dee6c1e7 Factored MySQL-specific munging out of Language::stripForSearch() to DatabaseMysql. This will also allow other backends to provide seamlessly their own munging algorithms in the future. 2010-01-18 20:54:43 +00:00
Tim Starling
fd3794c5bc For r60757: implement Database::getType() explicitly in each subclass, to make Roan happy. 2010-01-08 00:31:24 +00:00
Tim Starling
071bbbe218 Add a Database::getType() function so that we can get rid of $wgDBtype in favour of OOP goodness. 2010-01-07 00:22:18 +00:00
Sam Reed
b6e0df246f Attempt at normalistion of comparison styles - empty string on left and right hand side normalised to it being on the rhs
Before this change, there were (? being regex 0 or 1)

"" ===? 1
'' ===? 24
"" !==? 8
'' !==? 32

== "" 14
== '' 344
!= "" 9
!== "" 4
!= '' 151
!== '' 85


Rhs was the much more common, and the preferred style by many developers.. (Was a similar discussion in #mediawiki recently.. After that lolbugreport i think)

Where there is a string (non empty) on the lhs, and variable/method call on the rhs still need normalising
2010-01-06 19:59:42 +00:00
Tim Starling
ddd5acf900 Don't count unions of bracketed selects as being write queries 2010-01-06 04:05:49 +00:00
Chad Horohoe
b19e37425a Update callers from immediateCommit() to commit(). The former's been deprecated a really long time...Tim did it 45243 revisions ago. 2009-12-14 23:05:35 +00:00
Chad Horohoe
a4e5e935b6 Mass convert NULL -> null. Left strings and comments alone, obviously. 2009-12-11 21:07:27 +00:00
Max Semenik
25009de080 Per CR for r58631, moved default duplicateTableStructure() implementation to DatabaseMysql, replacing it with 'not implemented' exception throw 2009-12-11 19:53:10 +00:00
Max Semenik
1e3b2b8d5d Abstracted some parts of database interaction for parser tests, needs verification on Postgres. SQLite still doesn't work, though fails much later 2009-11-06 10:17:44 +00:00
Max Semenik
ae57ab1eec (bug 20275) Fixed LIKE queries on SQLite backend
* All manually built LIKE queries in the core are replaced with a wrapper function Database::buildLike()
* This function automatically performs all escaping, so Database::escapeLike() is now almost never used
2009-10-21 19:53:03 +00:00
Max Semenik
7055d6416d (bug 20268) Fixed Database::estimateRowCount on SQLite backend. This involved moving the previous implementation to where it belongs - DatabaseMysql, and replacing it with slightly tweaked DB2 implementation. 2009-10-21 12:21:09 +00:00
Max Semenik
c668e71421 (bug 20256) Fixed SQL errors on Special:Recentchanges and Special:Recentchangeslinked on SQLite backend 2009-10-17 12:23:23 +00:00
Tim Starling
80be14530c Added $wgShowDBErrorBacktrace, to allow users to easily gather backtraces for database connection and query errors. We've had a few LocalisationCache bugs that required backtraces to track down. 2009-09-04 01:49:34 +00:00
Aryeh Gregor
72ae064ca7 Whitespace 2009-08-25 18:57:47 +00:00
Alexandre Emsenhuber
41a2f8676c * (bug 15475) DatabaseBase::setFlag(), DatabaseBase::clearFlag() and DatabaseBase::getFlag() now have documentation 2009-08-24 08:54:28 +00:00
Alex Z
374b9e4af1 Mostly revert r53358 and r53365 per comments on code review. Change message to just say "Database" and remove the getDBtypeForMsg function (since I can't think of any other use for it) 2009-08-22 20:17:28 +00:00
Brion Vibber
620d56fc95 fix up doc comment on Database::buildConcat() 2009-08-19 18:28:59 +00:00
Chad Horohoe
c8cfe97d4e Spacing and declare public. 2009-08-15 19:17:56 +00:00
Tim Starling
84b6a177f1 * Converted BagOStuff.php from the style of memcached-client.php to the standard MediaWiki style, including camel case, using protected visibility instead of initial underscore, abstract functions instead of stubs, stylize.php.
* In SqlBagOStuff, ignore errors due to a read-only database, per my comments on CR r42796. Same for LocalisationCache. 
* Merged SqlBagOStuff and MediaWikiBagOStuff, that proved to be an awkward and unnecessary generalisation. Use the standard quoting wrapper functions instead of $db->query(). 
* Implemented atomic incr() and decr() functions for SqlBagOStuff. 
* Made incr() and decr() generally work roughly the same as it does in memcached, respecting negative steps instead of ignoring such operations. This allows decr() to be implemented in terms of incr().
* Per bug 11533, in MessageCache.php, don't retry 20 times on a cache failure, that's really memcached-specific and won't be useful for other cache types. It's not really very useful for memcached either.
* Moved MySQL-specific implementations of wasDeadlock() and wasErrorReissuable() to DatabaseMysql.
* Briefly tested page views with $wgReadOnly=read_only=1, fixed an error from Article::viewUpdates(). A CentralAuth fix will be in a subsequent commit.
2009-08-15 03:45:19 +00:00
Tim Starling
154ac68167 In Database::getLag(): Add some more I/O thread states. 2009-08-12 03:47:52 +00:00
Chad Horohoe
1e87cd3a7f patchPath not patchPatch 2009-08-09 15:27:29 +00:00
Chad Horohoe
a82c01a4b2 * Use DB_ADMIN for fixSlaveDesync, rebuildtextindex, updateSearchIndex, patchSql
* Duplicate archive() as DatabaseBase::patchPath(), clean up patchSql to use this
2009-08-09 15:22:34 +00:00
Chad Horohoe
df296de32e * Move generic return true; various for lock functions to parent, no need to implement this everywhere
* Make LOW PRIORITY optional
* Use sourceFile instead of dbsource
2009-07-29 23:41:16 +00:00
Greg Sabino Mullane
e8da51a574 Add standardSelectDistinct() function to help fork queries based on whether the order by items must appear in the select distinct list. See bug 18078. 2009-07-20 02:20:15 +00:00
Alex Z
bc1b8182e9 Followup to r53358 - Tweak the function name to be a little clearer as to what it does
Also make it abstract in DatabaseBase so all subclasses have to implement some human readable name 
(also make getSoftwareLink abstract for the same reason) Every current Database class already implements both.
2009-07-16 16:49:09 +00:00
Alex Z
3742d1058d (bug 19590) Database error messages are no longer hardcoded to use "MySQL".
Added a new function DatabaseBase::getDBtype() to get the DB type for messages, updated all subclasses.
Message change needs propagating.
2009-07-16 15:18:57 +00:00
Chad Horohoe
9924b70059 (bug 19591) Move setBigSelects() to DatabaseMysql 2009-07-09 00:14:43 +00:00
Chad Horohoe
f50573c33d * Move lock()/unlock() to DatabaseMysql, declare abstract
* Introduce lockTables() and unlockTables(), define in DatabaseMysql
* (bug 19372) updateSearchIndex has MySQLisms.
2009-06-25 00:40:12 +00:00
Aryeh Gregor
9244ed0c57 Abstract more methods in DatabaseBase
Notably, this will switch conditional() in MySQL from using IF() to
using CASE, like all other DBMSes.  Documentation suggests this works
back to 4.0.  If it's a problem, it's a matter of a few lines to
override it in DatabaseMysql.php.

Also, some extra explanatory comments have been added to a number of
methods in DatabaseBase.
2009-06-16 21:00:38 +00:00
Aryeh Gregor
2b83b91906 Make some Database methods optional to override
Specifically freeResult(), selectDB(), close(), and ping(), as suggested
by Tim on code review for r51918.  Where these were overridden by stubs
in subclasses, I deleted the stubs.
2009-06-16 20:22:11 +00:00
Aryeh Gregor
31492fc3f1 Move some stuff from DatabaseBase to DatabaseMysql
I moved a number of methods and marked them abstract in DatabaseBase,
namely those that met the following criteria:

1) Used some mysql_* function, so would obviously fail on any other DB.
2) Were already implemented by all five non-MySQL subclasses.

It would be reasonable to revisit these and make the less essential ones
return a dummy value instead of being abstract.  And document them.  And
move more methods that are MySQL-specific.  But one thing at a time.

I also split the classes Database, DatabaseMysql, and MySQLMasterPos to
DatabaseMysql.php.

This should theoretically have no practical changes, but it's a bunch of
changed code, so it will possibly break something by accident.

Followup to r51795.
2009-06-15 18:39:41 +00:00
Alex Z
0df1c0bdbd fix typo in comment 2009-06-15 18:38:15 +00:00
Aryeh Gregor
2f42924f36 Use parentheses for bit* to be on the safe side
Follow-up to r51815.
2009-06-14 20:13:17 +00:00
Niklas Laxström
ea0f52679f Follow-up to r?????:
PHP Catchable fatal error:  Argument 1 passed to DBError::__construct() must be an instance of Database, instance of DatabaseMysql given, called in /var/www/w/includes/db/Database.php on line 2736 and defined in /var/www/w/includes/db/Database.php on line 2547
2009-06-13 08:57:33 +00:00
Jure Kajzer
c3fafd96f7 Added bitwise operations to DatabaseBase and overloaded in DatabaseOracle. 2009-06-13 06:31:38 +00:00
Chad Horohoe
adb5b636dd Expect DatabaseBase, not Database. 2009-06-12 21:54:29 +00:00