Commit graph

450 commits

Author SHA1 Message Date
jenkins-bot
1bf9ea5143 Merge "Made DB commit() method properly bail out if no trx is active" 2014-06-26 03:52:02 +00:00
jenkins-bot
5f5d4e1c06 Merge "Made DB rollback() method properly bail out if no trx is active" 2014-06-26 03:51:26 +00:00
Aaron Schulz
a1bc02ec8b Include trx state in query profiling (and DBPerformance log)
* Replaced use of spl hash with random transaction IDs.
  These can be correlated better and make the DBPerformance
  log easier to make sense of. They are also shorter.

Change-Id: I5f49c0d0c26e37807341bbc83b1b41b124164419
2014-06-25 14:13:25 -07:00
Aaron Schulz
3de2a4022e Made DB rollback() method properly bail out if no trx is active
Change-Id: I157b3c9e7a869866c08d127cb7f9277582e1bc9e
2014-06-25 10:17:21 -07:00
Aaron Schulz
1045fdf312 Made DB commit() method properly bail out if no trx is active
* Also flipped conditional to avoid being in the negative

Change-Id: I30bce9a015bea5909322bba93493500b5b418d18
2014-06-25 10:12:44 -07:00
Kevin Israel
f2f49c0f21 Remove use of strencode() in buildLike()
This may cause unnecessary backslashes (in the case of a literal
% or _) to end up in the query when the DBMS uses C-style string
escaping; however, the query should still work.

Change-Id: I82681f83dd45fcbecf4bfd672f550cd4dba30949
2014-06-10 15:51:33 -04:00
jenkins-bot
de1f04ace1 Merge "Cleaned up database reconnection logic" 2014-05-27 18:17:02 +00:00
jenkins-bot
638478158a Merge "Avoid fatals in begin/commit/rollback if close() was called" 2014-05-19 04:20:00 +00:00
Aaron Schulz
7868e80b77 Minor fix to DatabaseBase::close() logic
* Only set mOpened to false if closeConnection() was called (or mConn was unset)

bug: 65100
Change-Id: I1ba6b765cfc647a47f21048d993047c0fe0cfe19
2014-05-16 18:34:17 +00:00
Aaron Schulz
3f495e4519 Avoid fatals in begin/commit/rollback if close() was called
Change-Id: I3c555ece5c1e16c6ffcdbec6645d659531400a1b
2014-05-16 10:50:05 -07:00
Aaron Schulz
1cf1450330 Cleaned up database reconnection logic
* If callbacks are pending, just throw the normal query error
  exception for the failed query and clear the callbacks. This
  way an error is still reported, but the handle can be reused
  if desired, instead of being left broken. Also the reported
  error makes more sense.

bug: 65263
Change-Id: Icb2d372e65e6c62b5d5b90a442ea7b7a7f853adc
2014-05-13 14:34:23 -07:00
Siebrand Mazeland
5bc1cf4093 Remove underscore from classes WebInstaller_*
Part of program to remove underscores from class names. Checked core and
675 extensions for occurrences. All uses are in core in core are updated
in this patch. There are no uses in Gerrit extensions.

Change-Id: I6150c2d3f5a18496da5bcdcadc5d8982b70bec7a
2014-05-12 18:36:55 +02:00
Aaron Schulz
28bed62ae6 Made TransactionProfiler handle nested transactions to the same server/DB
Change-Id: Ie4dfd4af88a9da76c76b21053bbd125c6ad3b193
2014-05-01 19:38:39 +00:00
Aaron Schulz
ac8c53583c Avoid fatal error if doing a DB query after close()
Change-Id: I606a3ec5a45136abf396f86f5a65db209128d5c9
2014-04-30 17:04:06 -07:00
umherirrender
f5f1e38b9a Fixed some @params documentation (includes/[db|installer])
Swapped some "$var type" to "type $var" or added missing types
before the $var. Changed some other types to match the more common
spelling. Makes beginning of some text in captial.
Also added some missing @param.

Change-Id: I3595e9aac69ac42fbb74b0783fae0ad9bcc831aa
2014-04-19 13:55:27 +02:00
Sergio Santoro
8117ab63f4 Fixing bug #63738: Debug msg not showing correctly
Change-Id: I49d826f63810d99aefa5b842cd3d6b88989ef086
2014-04-12 15:12:38 +02:00
Brad Jorsch
dc7d342d93 Improve handling of uncommitted DB txns with "uncaught" exceptions
One of the causes (if not the cause) of bug 56269 is if something
manages to throw an exception that makes it to MediaWiki::run's
last-resort exception catcher while having an open database transaction:
the transaction never gets committed or rolled back, so it gets
implicitly rolled back and a warning is raised.

The API has the opposite problem in bug 63145: it catches the exception
but then does the normal DB shutdown which *commits* the transaction.
This is certainly the Wrong Thing to do.

Ideally, neither of these would ever happen because any code using
transactions would have its own try-catch that would catch any
exception, rollback the transaction, and then rethrow the exception. But
it happens anyway, so let's have both of these last-resort exception
handlers do the rollback, and also log the exception so the throwing
code has a better chance of being properly fixed.

Bug: 56269
Bug: 63145
Change-Id: I8f1da51187b281fe4afc0d5a0c49f5caf3612e92
2014-03-27 12:46:07 -04:00
jenkins-bot
d1f8fb08d4 Merge "Automatically add a new line at the end of wfLogDBError()" 2014-03-24 18:45:47 +00:00
Alexandre Emsenhuber
2ea04f3a3a Remove double wfDebug() call in Database.php
Fix for I12adfb4fcb (54664be).

Change-Id: I6acfd35aae18af9d6e5ae29e5554ca7d04342af5
2014-03-23 11:24:38 +01:00
Alexandre Emsenhuber
59c42b90d5 Automatically add a new line at the end of wfLogDBError()
I found two calls to wfLogDBError() that do not add a new line
at the end of the message. So instead of adding them to that
entries, I changed wfLogDBError() to automatically put it on
icoming messages; as for wfDebugLog().

Change-Id: Id014b5827a0aeef6873ebf08d78f0a3d7581d63b
2014-03-23 10:30:59 +01:00
Siebrand Mazeland
db7de5f4c1 Fix CodeSniffer and warnings in includes/db
Follow-up with a slightly wider scope to e611604d10.

Change-Id: I9bb5ef0ceef0cd7a9c044e675b953db6d3b35407
2014-03-12 18:29:16 +00:00
aude
e611604d10 Fix IGNORE option for sqlite update
this fixes the issue of the normalized sqlite
IGNORE option being discarded and ignored in
DatabaseBase::makeUpdateOptions.

Change-Id: I01579dee0f939a56c086d13683a60f4400014f62
2014-03-12 17:37:17 +01:00
Skizzerz
f7174057a4 Add preliminary MS SQL support
This likely has outstanding bugs but basic wiki operations work just fine in it.

Change-Id: I25df82065a307b9abc30c694f8c8afff0996d7c1
2014-02-15 10:40:19 -08:00
Siebrand Mazeland
f077c4b1d6 Update formatting
Change-Id: I18aff576262479c9bb1c56eb8e1d1aaae200e4b1
2014-02-06 09:27:05 +01:00
umherirrender
4c95d41c76 Standardize is_array check in Database::upsert
Change-Id: I81c7ff2cf6a1f5fe0a2a6cdad1dd26d746e17c10
2014-02-03 21:42:04 +01:00
Brad Jorsch
d5f52588a2 Move MySQL-specific fakeMaster/fakeSlave stuff to DatabaseMysqlBase
Probably the fakeMaster/fakeSlave stuff was originally intended to be
generic, but the existing code in Database.php is making some very
MySQL-specific assumptions. So let's evict it from Database.php (except
for the minimal support functions) and put it in DatabaseMysqlBase where
it makes more sense.

This also takes care of fixing the breakage described in I5d2a1696 by
reverting Id6268193 and the problematic bit of I364e192e (again).

Change-Id: I3dc6ca216bf2c2f07d3090e86f2539292e1fa86b
2014-01-13 15:00:27 -05:00
Siebrand Mazeland
da32eb2356 Correct return type doc for DatabaseBase::getLBInfo()
This confused PHPStorm's code analyser.

Change-Id: If99abfa6ca9e52a39b6d2621441686ab564781c7
2014-01-11 12:31:28 +01:00
jenkins-bot
4e7ab69708 Merge "Update formatting" 2014-01-10 12:09:48 +00:00
jenkins-bot
af7a22b771 Merge "Ensure variables in database classes are defined, used and correctly cased" 2014-01-10 11:57:32 +00:00
Siebrand Mazeland
c12aafdc92 Remove superfluous spaces and doc tweak
Change-Id: I3755b31a1fc9b9930fc41ef44242d0bd12dc26d8
2014-01-07 11:41:14 +01:00
Siebrand Mazeland
aa4d6e1f2e Update formatting
Change-Id: I27e43c19906edc732b4976b8426ed34bad63622b
2014-01-06 21:04:34 +00:00
Siebrand Mazeland
559cc681d3 Ensure variables in database classes are defined, used and correctly cased
Change-Id: I12065b2c2bae1c000edac3c92d1db0c03fc40f90
2014-01-06 18:46:48 +00:00
Siebrand Mazeland
e22a70a103 Update documentation for database related classes
Change-Id: I364e192e2624f89a91dcb19e371ce3412142a95f
2014-01-06 19:45:40 +01:00
umherirrender
8a2e1a4c88 Fix doc for Database::upsert
One @params too much

Change-Id: I8cea6228587574ff90060d46b4430b2348a68973
2014-01-03 21:35:21 +01:00
umherirrender
382651e2f1 Call Database::makeInsertOptions from Database::insertSelect
This allows other database types to modify the options.

Bug: 59233
Change-Id: I45a2c7944057f43453423c8edbe5d173b1fc067d
2014-01-03 18:57:22 +00:00
Kevin Israel
bc06a9b8b7 Abstract out mysql_field_type() call from DatabaseBase
DatabaseMysqlBase::fieldType() is used in the maintenance script
convertLinks.php for upgrading from MediaWiki 1.2 or earlier. This
script was failing when the mysqli extension was enabled.

Follows-up b1cc3511fd, b2d64432ee, and 00299ecb95.

Change-Id: I5d888f4dd344ecba15506023d35f6d2d6e24cfd8
2013-12-15 18:40:50 +00:00
Siebrand Mazeland
d1e42ff982 Update documentation for DatabaseBase::selectRow()
Change-Id: I3b2f1224b1dc41bbd96ef10dbb9a8744511186e3
2013-12-04 17:12:22 +01:00
umherirrender
5ca5672aac Fixed spacing
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs

Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
2013-12-01 20:58:51 +01:00
Aaron Schulz
e3e6008743 Truncate super long SQL in DB error log lines (useful for blobs)
Change-Id: Ibb9b9178de80e691406e5c1a7113f0511055d18d
2013-11-21 16:00:15 -08:00
Siebrand Mazeland
b547395796 Break long lines and formatting updates for includes/db/
Fix all line length related CodeSniffer warnings.

Change-Id: Id0fd8f4c7276185f51489659ee3cd06962fbc16d
2013-11-21 16:43:40 +00:00
Siebrand Mazeland
1e10dcd3aa Update formatting on database-related classes
Change-Id: I91f83e28ae25f80ba9e36c612f1ad050ffa1573c
2013-11-21 16:39:38 +00:00
Aaron Schulz
a97402559b Changed use of tag_summary to use change_tag with GROUP_CONCAT()
* Added buildGroupConcatField() method to the DB classes

bug: 53577
Change-Id: I976f297653880e66af429ba9b622a954fefcc512
2013-11-17 06:37:08 +00:00
MarkAHershberger
c24f8be729 Revert "Remove unsupported and mostly non-functional Mssql support"
This reverts commit 5e1efc3144.

This sort of thing needs to be discussed.  Please do not self-approve changes like this.

Change-Id: I9eb9ea315d90584b7fe95db43a6759884f9506b5
2013-11-16 02:06:01 +00:00
Chad Horohoe
5e1efc3144 Remove unsupported and mostly non-functional Mssql support
Change-Id: Id0a688865a5b7b6bb363f7b118fad4f455d2b3b6
2013-11-15 10:59:37 -08:00
jenkins-bot
baab646245 Merge "Cleanups to DB transaction handling" 2013-11-13 23:13:30 +00:00
Bartosz Dziewoński
fe4f65689d DatabaseBase: Fix version number in deprecation notice
Followup to I09418558.

Change-Id: Iebdaf5a6678c4c2611d91b5c2678e89d36bccb20
2013-11-11 22:18:04 +01:00
jenkins-bot
164f334e53 Merge "Cleaned up DatabaseBase constructor to use an array" 2013-11-07 19:36:22 +00:00
AlephNull
e9d53667f4 MySQL method to find out view + fix fatal in tests
We were missing a method to list out views defined in a database. This
patch adds in MysqlBase::isView() and MysqlBse::listViews().

Since listViews() cache its result in DatabaseBase::$allViews, we also
introduce a final DatabaseBase::clearViewsCache() to let us clear the
per process cache.

Finally, fixed fatal error when duplicating VIEWs in MySQL.

bug: 43571
Change-Id: I8650baa4b721fe69ea3e1d557dd76745c0c7754e
2013-11-07 09:43:59 +00:00
Aaron Schulz
58a0e0c06d Cleaned up DatabaseBase constructor to use an array
Change-Id: I094185585dc844ca4d2d8b629107b2ab8f9bef39
2013-11-06 12:17:15 -08:00
Aaron Schulz
54664be154 Cleanups to DB transaction handling
* Only do requeries after automatic reconnection if there is no trx open instead.
  of doing possible half-broken changes and not fully updating trx state variables
* Also made trxLevel() no longer take an argument.
* Avoid clearing trx fields in some redundant places to make the code simpler
  Only mTrxLevel needs to be well tracked in various places. For the other fields,
  code just checks mTrxLevel before using those fields.
  They do need to be cleared in begin() though.
* Moved endAtomic() up next to startAtomic().
* Improved mTrxLevel docs

Change-Id: I12adfb4fcb28a4832facd63baee2283ead500bd2
2013-11-06 11:29:35 -08:00