Also make the temp table tracking catch plain "DROP TABLE"
in addition to the stricter "DROP TEMPORARY TABLE" clause.
Bug: T146300
Change-Id: Ia8306ec25e63adcdcf0dcc8f6a700dd01afdc948
Pretty much everything seems to assume that PHP booleans should be
converted to 0/1: MySQL does this implicitly thanks to the lack of
strict mode by default, while PostgreSQL and Sqlite (and Mssql) do it
explicitly.
The addition of MySQL strict mode for unit tests in Ib2873913 exposed
the assumption in the case of MySQL by making some extension unit tests
fail. So let's make casting bool to int the default behavior of
Database::addQuotes().
This also cleans up the phpdoc for Database::addQuotes() to properly
reflect all the supported types that can be passed to it.
Change-Id: I13d0e402fa676bc27c345e8ac12f363ebc627f6a
* Close dangling connections in LoadBalancer/Database destructors.
* When DBs are cloned, create new connection resources for the clone
so the two do Database objects don't clobber each other.
Change-Id: I3adb57cbb1fdc2a17e6d95389d0562ef22701576
* This are already (or now) managed by Database::factory().
* Also remove unused "foreign" parameter.
Change-Id: I9161b9f158b656fd10b1506ecb82bf42ab94ea43
This avoids errors when LoadBalancer calls getWikiId() in
reallyOpenConnection() after a failed connection.
Change-Id: Idc3d93ae39be09f2da277df57cdc5a564cb3408d
* Document various parameter arrays.
* Fix $user = false loophole in Database::__construct().
* Set the Postgres port *before* calling super, as it is
needed by open().
* Remove 'chronProt' parameter as it is lazy-loaded.
Change-Id: Icc1037efa1eee7ae6fdd2919f60001e6e29ae55c
* Make Database detect and track temporary tables for the session.
Creating, dropping, and updating them do not count as "write" queries.
Even a read-only mysql slave can have these operations performed on it
and it can be useful for complex read queries that need temporary results.
* Rename handleTransactionLoss() to handleSessionLoss() and cover named locks too.
Bug: T145947
Change-Id: I826439e9e9f550f32a9c46b3dd60e8e8015aa274
This class is in /libs and cannot depend on all of MediaWiki.
Replace the call with a simple debug() call instead.
Also, make the legacy logger route/format errors from the two
new DB log types (DBConnection, DBQuery) to the old wfLogDBError
locations, including MWDebug::debugMsg().
Change-Id: I64895d3f5b9a000d8186ab6a6ffb4b76a7e9ff40
* This removes the Profiler::instance() dependency from
a class in /libs.
* Also removed unused setTransactionProfiler() method
Change-Id: Iec735a130914090dc51aed30a283565a66aabee6
* Add DatabaseDomain class to handle passing domains around.
It also can be cast to and from strings, which are of the same
format as wfWikiId() except with hyphens escaped.
* Make IDatabase::getDomainID() use these IDs so they can be
passed into LoadBalancer::getConnection() and friends without
breaking on sites with a hyphen in the DB name.
* Add more LBFactory unit tests for domains.
Bug: T145840
Change-Id: Icfed62b251af8cef706a899197c3ccdb730ef4d1
The Database class was previously just a short-hand for "Database::",
and such calls should still work. The class now resides in /libs/rdbms.
The subclasses now extend DatabaseBase to avoid breaking type hints
that use that (hints use either IDatabase or DatabaseBase).
Also, use CASCADE with DROP TABLE for MySQL as with other DBs.
Keep SQLite excempt due to lack of support.
Added getDomainID() methods to avoid mentioning the word "wiki".
Change-Id: Ibd05d786cb26c21dcc9cb9601f6b2b52056af9ae