MediaWiki master
|
A query builder for DELETE queries with a fluent interface. More...
Public Member Functions | |
__construct (IDatabase $db) | |
Only for use in subclasses and Database::newDeleteQueryBuilder. | |
andWhere ( $conds) | |
Add conditions to the query. | |
caller (string $fname) | |
Set the method name to be included in an SQL comment. | |
conds ( $conds) | |
Add conditions to the query. | |
connection (IDatabase $db) | |
Change the IDatabase object the query builder is bound to. | |
delete (string $table) | |
Set table for the query. | |
deleteFrom (string $table) | |
Set table for the query. | |
execute () | |
Run the constructed DELETE query. | |
getQueryInfo () | |
Get an associative array describing the query in terms of its raw parameters to IDatabase::delete(). | |
queryInfo (array $info) | |
Set the query parameters to the given values, appending to the values which were already set. | |
table (string $table) | |
Manually set the table name to be passed to IDatabase::delete() | |
where ( $conds) | |
Add conditions to the query. | |
Protected Attributes | |
IDatabase | $db |
A query builder for DELETE queries with a fluent interface.
Any particular query builder object should only be used for a single database query, and not be reused afterwards. However, to run multiple similar queries, you can create a “template” query builder to set up most of the query, and then clone the object (and potentially modify the clone) for each individual query.
Definition at line 20 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::__construct | ( | IDatabase | $db | ) |
Only for use in subclasses and Database::newDeleteQueryBuilder.
To create a DeleteQueryBuilder instance, use $db->newDeleteQueryBuilder()
instead.
Definition at line 42 of file DeleteQueryBuilder.php.
References Wikimedia\Rdbms\DeleteQueryBuilder\$db.
Wikimedia\Rdbms\DeleteQueryBuilder::andWhere | ( | $conds | ) |
Add conditions to the query.
Alias for where().
@phpcs:ignore Generic.Files.LineLength
string|IExpression|array<string,?scalar|non-empty-array<int,?scalar>|RawSQLValue>|array<int,string|IExpression> | $conds |
Definition at line 190 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::caller | ( | string | $fname | ) |
Set the method name to be included in an SQL comment.
string | $fname |
Definition at line 213 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::conds | ( | $conds | ) |
Add conditions to the query.
Alias for where().
@phpcs:ignore Generic.Files.LineLength
string|IExpression|array<string,?scalar|non-empty-array<int,?scalar>|RawSQLValue>|array<int,string|IExpression> | $conds |
Definition at line 202 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::connection | ( | IDatabase | $db | ) |
Change the IDatabase object the query builder is bound to.
The specified IDatabase will subsequently be used to execute the query.
IDatabase | $db |
Definition at line 53 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::delete | ( | string | $table | ) |
Set table for the query.
Alias for table().
string | $table | The unqualified name of a table |
Definition at line 120 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::deleteFrom | ( | string | $table | ) |
Set table for the query.
Alias for table().
string | $table | The unqualified name of a table |
Definition at line 109 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::execute | ( | ) |
Run the constructed DELETE query.
Definition at line 221 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::getQueryInfo | ( | ) |
Get an associative array describing the query in terms of its raw parameters to IDatabase::delete().
This can be used to interface with legacy code.
Definition at line 242 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::queryInfo | ( | array | $info | ) |
Set the query parameters to the given values, appending to the values which were already set.
This can be used to interface with legacy code. If a key is omitted, the previous value will be retained.
The parameters must be formatted as required by Database::delete.
array | $info | Associative array of query info, with keys:
|
Definition at line 77 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::table | ( | string | $table | ) |
Manually set the table name to be passed to IDatabase::delete()
string | $table | The unqualified name of a table |
Definition at line 97 of file DeleteQueryBuilder.php.
Wikimedia\Rdbms\DeleteQueryBuilder::where | ( | $conds | ) |
Add conditions to the query.
The supplied conditions will be appended to the existing conditions, separated by AND.
@phpcs:ignore Generic.Files.LineLength
string|IExpression|array<string,?scalar|non-empty-array<int,?scalar>|RawSQLValue>|array<int,string|IExpression> | $conds |
May be either a string containing a single condition, or an array of conditions. If an array is given, the conditions constructed from each element are combined with AND.
Array elements may take one of two forms:
Note that expressions are often DBMS-dependent in their syntax. DBMS-independent wrappers are provided for constructing several types of expression commonly used in condition queries. See:
Untrusted user input is safe in the values of string keys, however untrusted input must not be used in the array key names or in the values of numeric keys. Escaping of untrusted input used in values of numeric keys should be done via IDatabase::addQuotes()
Definition at line 162 of file DeleteQueryBuilder.php.
|
protected |
Definition at line 36 of file DeleteQueryBuilder.php.
Referenced by Wikimedia\Rdbms\DeleteQueryBuilder\__construct().