Commit graph

7 commits

Author SHA1 Message Date
Reedy
c14dd609a7 tests: Move Wikimedia tests into Wikimedia\Tests
Change-Id: I9c64a631b0b4e8e4fef8a72ee0f749d35f918052
2024-02-17 02:09:08 +00:00
Daimona Eaytoy
48a1c0bb2f Autofix spacing around commas
This was done automatically using the
`Universal.WhiteSpace.CommaSpacing` sniff, which will be included in the
next release of the MW PHPCS config.

Some of these have been adjusted manually where the autofix broke
vertical alignment.

Change-Id: I54a4668d8a2759b9d7de47742c943a535a04e211
2023-10-25 01:08:44 +02:00
Amir Sarabadani
bd40cfa516 rdbms: Small clean ups to query builders
- Fix typo
 - Fix copy-paste issues in documentation
 - Pass around caller info in getQueryInfo() and queryInfo()
 - Make the Database methods internal
 - Perf improvement on InsertQueryBuilder::row()

Bug: T335377
Change-Id: Idec9e62a0c392c34c0f81cfe8f65b477db7bb98f
2023-09-11 19:09:24 +02:00
Tim Starling
95bd40b25c In query builders, use insertInto() and deleteFrom() instead of insert() and delete()
The design principle for SelectQueryBuilder was to make the chained
builder calls look as much like SQL as possible, so that developers
could leverage their knowledge of SQL to understand what the query
builder is doing.

That's why SelectQueryBuilder::select() takes a list of fields, and by
the same principle, it makes sense for UpdateQueryBuilder::update() to
take a table. However with "insert" and "delete", the SQL designers
chose to add prepositions "into" and "from", and I think it makes sense
to follow that here.

In terms of natural language, we update a table, but we don't delete a
table, or insert a table. We delete rows from a table, or insert rows
into a table. The table is not the object of the verb.

So, add insertInto() as an alias for insert(), and add deleteFrom() as
an alias for delete(). Use the new methods in MW core callers where
PHPStorm knows the type.

Change-Id: Idb327a54a57a0fb2288ea067472c1e9727016000
2023-09-08 10:16:08 +10:00
Amir Sarabadani
7cf42e26c9 rdbms: Add support for ALL_ROWS in two query builders
Delete and Update query builders set the ->where( Database::ALL_ROWS )
as [ Database::ALL_ROWS ] internally and this makes sure they are
basically treated as condition simply being Database::ALL_ROWS

Bug: T332329
Change-Id: I79c308a8951f99869ffa09bd47c8e9bdf23f312e
2023-07-05 17:11:39 +02:00
Umherirrender
54e399a83b rdbms: Remove return value from Delete/UpdateQueryBuilder::execute
Return values are deprecated since 1.33

Depends-On: Ib20fd5edd1e65d3a3abecbce9d132907fa0ac7c7
Change-Id: Ia354213328c4ed87ae6aab3ad382647697371c1e
2023-06-17 22:34:50 +02:00
Amir Sarabadani
1d803c3db5 rdbms: Introduce DeleteQueryBuilder
Similar to the rest of query builders

Bug: T335378
Change-Id: I61151bfa33798c0a28e94b27e88e7b00471d9131
2023-04-26 10:03:46 -04:00