RowQuery
Class.
A query for rows of a table, started with LogEntry::query() and returning row objects; it writes its SQL itself.
A query never changes: every method returns a changed copy, so a query can be passed on and varied safely. Keep
the result – $query->limit(3); alone does nothing, and PHP warns about it (#[\NoDiscard]).
Defaults: all rows, in the order of the primary key. Columns are compared as stored: strings without regard to case (the collation of WordPress), NULL like PHP compares null – notEquals() and notIn() of a nullable column also match rows without value. NULL sorts first in ascending order (MariaDB).
Methods
count()
The number of all matching rows; limit() and offset() do not count.
Returns int
delete()
Deletes the matching rows (with limit(), the first ones in the order) and returns how many. Row objects loaded before keep their primary key.
Returns int
first()
The first matching row, null without one.
Returns T|null
get()
The matching rows.
Returns list<T>
limit()
At most this many rows.
Returns RowQuery
offset()
Skips this many rows (with limit()).
Returns RowQuery
orderBy()
Sorts by a column; further calls sort rows that are equal so far. Without orderBy(), rows come in the order of their primary key.
Returns RowQuery
where()
Rows that meet all conditions (columns, Any, All); adds to the conditions of earlier calls.
Returns RowQuery