|Open||None||T299691 Break down monster class: Database|
|Resolved||Ladsgroup||T307616 Move SQL building code from Database class to SQLPlatform|
|Duplicate||None||T310141 Some SemanticMediaWiki queries fail due to duplicated table prefix|
- Mentioned In
- T297633: <Tech Initiative> Improving Databases in MediaWiki
T190396: Consider splitting the IDatabase interface
T299691: Break down monster class: Database
T310214: Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'enwikinews.`categorylinks`' doesn't exist
- Mentioned Here
- T310214: Wikimedia\Rdbms\DBQueryError: Error 1146: Table 'enwikinews.`categorylinks`' doesn't exist
@Ladsgroup Per T310214, we could probably do with a test that ensures the double escaping issue doesn't happen again. If we already have a case of e.g. select( [ 'x' => tableName('x') ], .. ), then maybe the issue is expanding it to include coverage to sqlite/mysql/postgres for the jobs that enable those, either with sql text based assertions or perhaps a simple end-to-end test that selects something simple from a table.
Now there is no large chunk of code left in Database class that could be moved to SQLPlatform.
It is much cleaner and the complexity score of the class has fallen to ~600 out of ~1000 and it's no longer the most complex class of MediaWiki. We deprecated and removed six Database::do* methods.
Of course way more work could to be done. There is a long-tail of small clean ups. Improving mocking in tests (now that we can rely on the mocked addQuotes(), lots of tests use new SQLPlatformTestHelper( new AddQuoterMock() ); for platform) and small code pieces could be refactored to move to platform but that can happen in its own time.
As far as I'm concerned, this is done. 🎉