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
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
- Place commas correct
- Moved comments
- Add space after if/foreach/catch
- Reformat some conditions
- Removed trailing spaces/tabs
Change-Id: I40ccda72c418c4a33fcd675773cb08d971510cdb
This reverts commit 5e1efc3144.
This sort of thing needs to be discussed. Please do not self-approve changes like this.
Change-Id: I9eb9ea315d90584b7fe95db43a6759884f9506b5
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
* 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
Added new functions to ensure certain groups of statements
are atomic without having to go through the trouble of
starting a new transaction if one has already been opened.
Change-Id: I5328fb337e5544bf28ea282860ef8f81e19ac43c
Fixed from several different directions:
* The error reporting was screwed up, so I wrapped the PDOException
in a DBUnexpectedError.
* Make $db->open() trigger a close/open sequence if called a second
time, like MySQL, instead of breaking mTrxLevel.
* Don't call $this->open() twice from the constructor, even if $user is
set.
The bug dates to r84485. The nasty hack allowing you to construct a
do-nothing database object with "new Database()" dates back to 2004 and
has probably outlived its usefulness -- noted this. It was formerly used
by LoadBalancer::reportConnectionError().
Bug: 49254
Change-Id: I571f9209bec8e8ed5058b6327e1738eb4315d5a0
Exception was thrown if $dbType=mysql, regardless of whether a driver
was available. Also, the installer support was broken if the mysql
driver was missing.
Change-Id: I29df3fc9b3bf5743c1365f757e0cf899d5b96ae9
Throws exception unconditionally, installer support is totally broken.
This reverts commit b2d64432ee.
Change-Id: I2edb78440806754c42d48c5da2ff74b4cb40fa2d
DatabaseBase::factory()'s parameter array now takes an optional
'driver' variable to allow specifying a specific driver for the
database class if we support more than one.
This is so we can gracefully support mysql/mysqli as the former is
deprecated, but the concept could be extended to other databases
as well.
Bug: 45288
Co-Author: Chad Horohoe <chadh@wikimedia.org>
Change-Id: I6733fe21c4aa7443e409c5dfa7c789552b2b62b7
* Using this makes it easy to forget to restore the old value, which then
complicates anything that inserts to the DB.
* Also removed mention of the flag from some places.
Change-Id: I838183222518e0d008dee47ec8df6b3f3dc578e9
* Make sure transactionWritingIn() gets called before the profileIn()
so the first write query shows up
Change-Id: Ife504651f6fe33f1360e817bcb05afc02f4075a5
Currently, either '*' is given as condition meaning "everything" or an array must
be passed since DatabaseBase::makeList() requires an array. Now the parameter is
consistent with one of other similar methods, since a string will be handled
correctly.
Bug: 50078
Change-Id: Id5a8220d21245669f1091a3b5ed1def65b22d375
* Previously, using a USE INDEX array with one table string resulted
in the FORCE INDEX statement not appearing in the SQL.
* Renamed two variables in tableNamesWithUseIndexOrJOIN().
Change-Id: Id084db7df3b07d125ea73faca7e4506a58be5f35