Sometimes, a column name alias is chosen that is a reserved word or is
otherwise invalid (such as an alias named "user" on postgres or mssql).
Let's unconditionally quote the alias so that no matter what the user
specifies, it will not cause the query to error out.
Bug: T118973
Change-Id: If3ea7324980355e78afcdb3bf2596d23bb96412d
* Add a note in Database.php that docs are in IDatabase.php,
maybe its just me, but I didn't realize that was where the docs
are (even though in retrospect that should have been obvious) and
wasted a lot of time because I didn't realize that.
* Change references to IDatabase::tableName() in doc to
DatabaseBase::tableName(), since tableName is not in the IDatabase
interface.
* Be explicit in docs for select() about which parts are safe for
user input. I think its important to be very explicit about this.
No code changes, just doc changes.
Change-Id: I3a66477afc6a5f54855062482ef04c2966e468f6
I searched for /\$(\S+) = (.+?\(.*?\);)\n.*?\$\1\[/, ignored
everything involving isset(), unset() or array assigments, then
skimmed through the remaining results and changed things where they
made sense. These changes were not automated, so please review them.
Change-Id: Ib37b4c66fc57648470f151ad412210b3629c2538
* Remove obsolete @protected tag from docstring
of DatabaseBase::indexName(), now really protected
* Make DatabaseSqlite::indexName() protected too
Change-Id: I90f894878379d0850dba61cd483af16864c209ea
Otherwise, transactions might be committed without cooperative
locks that were supposed to be present. This is similar to the
logic of not auto-reconnecting if a transaction was started to
avoid committing incomplete changes.
Change-Id: Ia7bc6b188bb5ee53a5bf7c5a30718bc7c4dd0ba9
This method is less manual and avoids the usual pitfalls of
not unlocking for a return statement or not flushing out any
prior transaction.
Change-Id: Ib1681244767de860105a68210e181e2f024ee525
This would previously make log noise when rollbackMasterChangesAndLog()
is triggered for explicit transactions.
Change-Id: Ia0009bcf575ef346d3bb7354ce3fb6fb477eb95f
The autocomplete search allows special pages to define the list of
subpages to be excepted. Use user names on the following special pages,
because these special pages can be called with a user name as subpage.
Special:Block
Special:Contributions
Special:DeletedContributions
Special:Emailuser
Special:Listfiles
Special:Unblock
Special:Userrights
This makes it easier to navigate to this special pages with a prefilled
user name field.
Hidden user names are always not shown, because the suggestion is cached
between priviliged user and non-priviliged user.
Change-Id: I7db575bf66caaa5136489ed99f1655673b55adaf
Before, it just used the immediate master entry, which could be another
slave. In that case, it may not even exists at all.
Bug: T119648
Change-Id: Iea970b81ad2c9855aafcccf0bb0662fc0b3a8d4d
If a callback set DBO_TRX, make sure it gets unset if that
is not what the DB was set to before the callbacks ran.
Change-Id: I79b649de02e821494d7f88e8979764ec8a9d0c43
This avoids "Got COMMIT while atomic sections X are still open"
if the this DB had active transactions when an error occurred.
Change-Id: I1e2eb3a3382537108ecb269c483d2e62a218b656
This generally only effects wikis with no slave DBs,
but also matters if the master has non-zero LB load.
If the master ends up being used for DB_SLAVE, care
should be shown for cache-aside writes
Interesting WAN cache events are now logged.
Change-Id: I2cd8e84138263c13ea23beb9ab3d7562340e1fd3
Also made getReadOnlyReason() protected as it has no outside
callers and is not part of IDatabase.
Change-Id: If6694a19df038af645a97f701397a536570d1b42
LBFactory inherits $wgReadOnly, the LBs inherit
any LBFactory read only mode, and Database objects
inherit any LB read-only mode.
Add some methods callers can use to check if
a DB/LB handle is read-only before trying writes.
Additionally:
* Fix 5ec1e47475 regression where readOnlyBySection
read-only mode would not affect wfReadOnly() but only
lagged-slave read-only mode for LBFactoryMulti.
* Catch errors when getLaggedSlaveMode() is called after
master connection and object is established.
* Make getLaggedSlaveMode() a no-op if there are no slaves.
* Make string/false logic for read-only consistent everywhere.
* Remove mLaggedSlaveMode "m" prefix.
Change-Id: Ice3224caae564aa5ffb41b424c23d1593229117a
Add a $join_conds parameter for Database::selectRowCount(), to allow the caller
to specify join conditions for the subquery that it generates.
Change-Id: I8c0a93713c121bc5b691ae65d6b6d8f8c08c9e4c
* This gets lag information that is useful when
the calling code is about to run queries that
will have their results cached.
* This is now used in place of trxTimestamp() for
WANObjectCache set() and getWithSetCallback().
* The WAN cache will use a low TTL if the lag is
too high to avoid caching stale data for weeks.
* Bumped MAX_COMMIT_DELAY as nothing enforces it.
Bug: T113204
Change-Id: I2a95b4088cff42d6e980351555f81a4b13519e24
* Simplify the debug log call and use queries group
* Remove $wgDebugDumpSqlLength, as profiler output
already has shortened query strings (one can use
profiling without DBO_DEBUG)
* Removed $wgDebugDBTransactions as BEGIN/COMMIT already show
* Removed PostgresTransactionState as it was only used for
$wgDebugDBTransactions handling
* This cuts down on lots of global variable usage
Change-Id: I185adb1694441d074dea965960429b4910727620
* Most callers gracefully check wfReadOnly(),
but fail in case they dont. This also catches
foreign DBs which might slip through the cracks.
* Also remove useless wfDebug() call around
mDoneWrites check as write queries show in
the logs anyway.
Change-Id: I560ebd19c4eb2b3a040d4331702346440617cfaa