Page MenuHomePhabricator

Use expression builder instead of raw SQL in FlaggedRevs
Closed, ResolvedPublic

Description

Now that T210206: Deprecate raw SQL conditions for IDatabase methods (select, insert, etc.) is done, this extension should migrate away from building and passing around raw SQL to expression builders.

It improves readability and security of the code and is more aligned with industry practices easing onboarding.

For more information check T210206 and T350075.

Calls to Database::addQuotes(), ::buildLike(), ::makeList() indicate that raw SQL is being built and passed around.

Event Timeline

You can turn between to a combined condition of "and". That should be rather easy.

Do the two provide the same performance under MariaDB? BETWEEN is more specific and thus feels to be more performant, but I can also imagine that they translate to the exact same query plan.

Do the two provide the same performance under MariaDB? BETWEEN is more specific and thus feels to be more performant, but I can also imagine that they translate to the exact same query plan.

Based on a quick search it seems that they are identical to two queries with an AND.

MySQL and other RDBMSes translate them to the same exact syntax tree.

Change #1037458 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/FlaggedRevs@master] Use expression builder to build where conditions

https://gerrit.wikimedia.org/r/1037458

Change #1037458 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] Use expression builder to build where conditions

https://gerrit.wikimedia.org/r/1037458

Change #1055588 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/FlaggedRevs@master] Use expression builder to avoid IDatabase::makeList

https://gerrit.wikimedia.org/r/1055588

Change #1055588 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] Use expression builder to avoid IDatabase::makeList

https://gerrit.wikimedia.org/r/1055588

Change #1055612 had a related patch set uploaded (by Umherirrender; author: Umherirrender):

[mediawiki/extensions/FlaggedRevs@master] Use expression builder instead of raw sql

https://gerrit.wikimedia.org/r/1055612

Change #1055612 merged by jenkins-bot:

[mediawiki/extensions/FlaggedRevs@master] Use expression builder instead of raw sql

https://gerrit.wikimedia.org/r/1055612

Umherirrender claimed this task.