Commit graph

112 commits

Author SHA1 Message Date
Sam Reed
9ea1f1d388 Kill some crappy "failFunction" stuff, marked as old in r14625 2010-08-18 13:38:42 +00:00
Max Semenik
ad688fc6fd DatabaseSqlite::sourceStream(): convert CHAR types, allow more spaces 2010-08-12 16:28:11 +00:00
Alexandre Emsenhuber
c13687bdb6 Standardisation of file headers 2010-08-01 21:13:44 +00:00
Max Semenik
44247c19c6 Fixed exceptions on attempts to serialize DatabaseSqlite. Encountered today by Nike, earlier seen during unit tests. Not implementing __wakeup() because restoring a connection along with its full state would just cause obscure bugs. If null mConn will cause problems (unlikely, because most instances of db object serialization are accidental and the connection is not supposed to be used after deserialization), we'll tweak specific classes that store database objects. 2010-07-29 18:17:11 +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
Max Semenik
077c4c93c4 Follow-up to r68604: recognise ATTACH DATABASE as a read-only statement 2010-06-27 12:35:25 +00:00
Max Semenik
18fb675995 Support for $wgSharedDB in SQlite 2010-06-26 12:10:47 +00:00
Max Semenik
ab4cad44d5 Converting MySQL's ENUM to SQLite BLOB doesn't make sense, changed it to TEXT. Also fixed a bug in conversion regex 2010-06-23 18:59:46 +00:00
Mark A. Hershberger
65bcb9f329 * Create new DatabaseSqlite::checkForEnabledSearch() and use it from SearchSqlite::fulltextSearchSupported() instead of querying the updatelog table. This was the only use of updatelog under the non-maint code.
* Add the searchindex table to the list of tables to preserve for testing.
* Adapt SearchEngineTest to work with Sqlite.
* Add fulltext setup for SQLite to the new installer code.
* TODO: SqliteInstaller::setupSearchIndex() should not be using addHtml()
2010-06-16 18:26:47 +00:00
Niklas Laxström
ce774f7622 Added newline 2010-06-11 12:51:23 +00:00
Chad Horohoe
44229b50e6 Fixed a bunch of silly instances of [^!=]==\s*(true|false) 2010-06-09 11:44:05 +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
5426f6e6a7 Also rewrite ALTER TABLE, handle int(...) properly 2010-02-21 09:40:27 +00:00
Max Semenik
83323b3e13 DatabaseSqlite:
* Tweaks and fixes to DDL conversion from MySQL. Now everything in tables.sql converts cleanly to SQLite's native type hints.
* Handle error in duplicateTableStructure().
2010-02-20 20:00:28 +00:00
Max Semenik
2207d96cab DatabaseSqlite: avoid fatals with non-zero $failFunction 2010-02-03 19:55:56 +00:00
Max Semenik
6c7bb57316 Special delivery for Nikerabbit: ability to connect to a SQLite db file directly, no foreplay with global settings needed. 2010-01-22 21:30:23 +00:00
Max Semenik
b82e6766e5 rv bit accidentally committed in r61180 2010-01-18 17:54:37 +00:00
Max Semenik
f3998d502e Ran stylize.php on DatabaseSqlite 2010-01-17 20:47:23 +00:00
Max Semenik
f6cb1b0442 Workaround for SQLite's inability to perform multi-row replacements 2010-01-10 17:27:46 +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
Niklas Laxström
aca2d0faef Add comment about unused parameters to constructor too + coding style 2010-01-06 22:19:48 +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
a9927b34c5 Fixed duplicateTableStructure() for SQLite, it previously didn't copy row properties such as autoincrement. Resolves bug 20549 - parser tests now work with SQLite. 2009-12-06 11:09:39 +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
d54f6c2039 implicitOrderby() seems to be true for SQLite, removing the override 2009-11-05 18:41:45 +00:00
Max Semenik
798cfc5ade Merge SQLite search from branches/sqlite/ to trunk 2009-10-29 16:19:35 +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
c90bf711ad (bug 20911) Installer failed to create a SQLite database, regression from r55669. 2009-10-20 20:23:14 +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
Alexandre Emsenhuber
05ddb69109 whitespaces tweaks 2009-09-15 21:05:30 +00:00
Chad Horohoe
4cdc449d90 (bug 20260) SQLite: don't always autocreate DB and its directory. If the file isn't readable at execution time, we now throw an exception 2009-08-29 12:35:40 +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
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
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
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
Aryeh Gregor
798de37085 Use parentheses for reliability
Follow-up to r53196.
2009-07-14 00:55:17 +00:00
Bryan Tong Minh
7109c4c4ef (bug 19571) Override buildConcat for SQLite. 2009-07-13 21:56:24 +00:00
Aryeh Gregor
db8cbcd108 Remove redundant no-op implementations
Followup to r52951.
2009-07-09 01:04:10 +00:00
Alexandre Emsenhuber
7eefbf8daa same as r52457 but for SQLite 2009-06-26 15:38:43 +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
d20794df5c Make Database into abstract class DatabaseBase
All other databases were changed to extend DatabaseBase instead of
Database.  Database was kept as an alias for DatabaseMysql for
compatibility.  Existing explicit references to Database that I could
find were changed to DatabaseMysql for the sake of clarity.

Should cause no functional changes.
2009-06-12 17:59:04 +00:00
Tim Starling
cb3bbe1809 Implemented save/restore logic for sql_big_selects, per CR comments on r50168. 2009-05-27 06:10:48 +00:00
Chad Horohoe
2664b438f1 Remove some unused $wgOut's. 2009-04-07 15:56:26 +00:00
Roan Kattouw
a7c7a3fd33 Revert r45821, r45830, r45831 and r45835 all in order to revert r45819, per discussions on CR. Will redo part of r45819 momentarily. 2009-01-19 13:56:08 +00:00
Roan Kattouw
21ead1462a Fix up r45819 per CR comments: removing calls to removed function Database::indexName() 2009-01-17 09:56:38 +00:00
Roan Kattouw
312316088e Attempt at cleaning up r45764, r45769 (renamed indices for SQLite compat):
* removing the indexName() hack and with it the /*i*/ stuff from tables.sql
* undoing renames of formerly implicitly named indices
* three indices have to be called different in SQLite because of naming conflicts, adding a patch to updaters.inc that does that
2009-01-16 23:02:44 +00:00
Tim Starling
f058162bc5 * Preserve usertext_timestamp index name for MySQL, prefix it for SQLite. Issues remain on the experimental non-installable DBMSes.
* Clean up some E_STRICT issues
2009-01-15 14:20:28 +00:00
Tim Starling
4124558d7b For backport to 1.14.
* Made the upgrader work with SQLite
* Implemented missing schema info functionality in DatabaseSqlite
* Merged the SQLite and MySQL schemas into the one file with the help of some replaceVars() hacks.
* Moved all primary key definitions to the field definition, moved all indexes to CREATE INDEX statements, for best SQLite compatibility.
* Made all autoincrement fields primary keys, as required by SQLite.
* Removed meaningless buzzword from the category table comment
* tables.sql: s/'0'/0/
* In SQLite the index names have DB scope. Renamed archive.usertext_timestamp, user_newtalk.user_id, user_newtalk.user_ip
* SQLite does not support UPDATE with LIMIT by default. Removed all instances I could find.
* Made query errors work in the installer.
* Fixed DatabaseSqlite::lastErrno(), made SQLITE_SCHEMA errors automatically reissue the query as suggested on sqlite-users. Otherwise upgrade breaks.
* Removed miscellaneous status information from getServerVersion(), that's not the place to put it
2009-01-15 06:56:58 +00:00
Tim Starling
db22292391 * In selectField(), use reset($row) instead of $row[0] for compatibility with SQLite
* Non-broken (no-op) implementation of DatabaseSqlite::deadlockLoop(). Fixes bug 16123: total breakage of Special:Import on SQLite.
2009-01-09 03:53:28 +00:00
Tim Starling
0d322a394e * Allow $wgDiff3=false
* Don't call quickUserCan('edit') unless section edit is enabled
* In DatabasePostgres and DatabaseSqlite: throw an exception on connection error
* In DatabasePostgres: don't send an invalid connection string whenever one of the fields is empty. Use quoting.
* In Database: make the captured PHP error prettier
* Display a descriptive error message when the user navigates to index.php with PHP 4, not a parse error. Check to see if the *.php5 extension works, using file_get_contents().
* The default port number for PostgreSQL is 5432, not blank.
* Better default for $wgDBname
2008-10-06 00:45:18 +00:00
Tim Starling
f5c8dd2474 Implemented blob support for SQLite. Allows null characters to be inserted into the database. Avoids total breakage of the objectcache table. For trunk and 1.13. 2008-09-06 13:56:59 +00:00
Chad Horohoe
656e01a0af No-ops for getSearchEngine(). 2008-08-18 15:36:53 +00:00
Chad Horohoe
b7fd7de5ba Use wfMkdirParents() because it's cooler (and mkdir() would've failed on parent directory creation without the 'recursive' flag). Also removed an icky hardcoded directory mode. Sadly, this does not fix bug 15108 :p 2008-08-10 16:19:09 +00:00
Brion Vibber
7b78f7b7aa Revert r36755 for the moment; various things use 'new Database'
or Database::newFromParams() explicitly at the moment. While that's already bad (breaking PG support etc), I'd rather see those get fixed before we go introducing differences between Database and DatabaseMySql.
2008-07-02 18:22:38 +00:00
Chad Horohoe
de58074c74 Refactoring (un)lock. All the subclasses are currently returning true, except for mySQL. Makes more sense to put the no-op in the parent class then just subclass it as needed. Other things could maybe do this too. 2008-06-27 17:06:34 +00:00
Chad Horohoe
5bfb68f4e4 Add no-ops for the (un)lock functions. 2008-06-27 15:06:22 +00:00
Tim Starling
c6b902f180 * Reorganised the includes directory, creating subdirectories db, parser and specials
* Wrote a tool to check the integrity of the autoloader class list, fixed some issues that came up.
* Start the autoloader before LocalSettings.php, so that when an extension writer thinks an inefficient one-file special page extension is the way to go, they don't have to use explicit includes to make the class inheritance work. Should continue to work with $IP set in LocalSettings.php as long as $IP is set before extensions are included.
2008-06-16 20:21:26 +00:00
Renamed from includes/DatabaseSqlite.php (Browse further)