Update
extends Statement
in package
Uses
Join, Set, Where, OrderBy
Class Update.
Tags
Table of Contents
- OPT_IGNORE = 'IGNORE'
- Convert errors to warnings, which will not stop inserts of additional rows.
- OPT_LOW_PRIORITY = 'LOW_PRIORITY'
- $database : Database
- $sql : array<string|int, mixed>
- SQL clauses and parts.
- __construct() : mixed
- Statement constructor.
- __toString() : string
- crossJoin() : static
- Adds a JOIN clause with "CROSS JOIN $table".
- crossJoinOn() : static
- Adds a JOIN clause with "CROSS JOIN $table ON $conditional".
- crossJoinUsing() : static
- Adds a JOIN clause with "CROSS JOIN $table USING ...$columns".
- from() : static
- Sets the FROM clause.
- innerJoinOn() : static
- Adds a JOIN clause with "INNER JOIN $table ON $conditional".
- innerJoinUsing() : static
- Adds a JOIN clause with "INNER JOIN $table USING ...$columns".
- join() : static
- Adds a JOIN clause with "$type JOIN $table $clause $conditional".
- joinOn() : static
- Adds a JOIN clause with "JOIN $table ON $conditional".
- joinUsing() : static
- Adds a JOIN clause with "JOIN $table USING ...$columns".
- leftJoinOn() : static
- Adds a JOIN clause with "LEFT JOIN $table ON $conditional".
- leftJoinUsing() : static
- Adds a JOIN clause with "LEFT JOIN $table USING ...$columns".
- leftOuterJoinOn() : static
- Adds a JOIN clause with "LEFT OUTER JOIN $table ON $conditional".
- leftOuterJoinUsing() : static
- Adds a JOIN clause with "LEFT OUTER JOIN $table USING ...$columns".
- limit() : static
- Sets the LIMIT clause.
- naturalJoin() : static
- Adds a JOIN clause with "NATURAL JOIN $table".
- naturalLeftJoin() : static
- Adds a JOIN clause with "NATURAL LEFT JOIN $table".
- naturalLeftOuterJoin() : static
- Adds a JOIN clause with "NATURAL LEFT OUTER JOIN $table".
- naturalRightJoin() : static
- Adds a JOIN clause with "NATURAL RIGHT JOIN $table".
- naturalRightOuterJoin() : static
- Adds a JOIN clause with "NATURAL RIGHT OUTER JOIN $table".
- options() : static
- Sets the statement options.
- orderBy() : static
- Appends columns to the ORDER BY clause.
- orderByAsc() : static
- Appends columns with the ASC direction to the ORDER BY clause.
- orderByDesc() : static
- Appends columns with the DESC direction to the ORDER BY clause.
- orWhere() : static
- Appends a "OR $column $operator ...$values" condition in the WHERE clause.
- orWhereBetween() : static
- Appends a "OR $column BETWEEN $min AND $max" condition in the WHERE clause.
- orWhereEqual() : static
- Appends a "OR $column = $value" condition in the WHERE clause.
- orWhereGreaterThan() : static
- Appends a "OR $column > $value" condition in the WHERE clause.
- orWhereGreaterThanOrEqual() : static
- Appends a "OR $column >= $value" condition in the WHERE clause.
- orWhereIn() : static
- Appends a "OR $column IN (...$values)" condition in the WHERE clause.
- orWhereIsNotNull() : static
- Appends a "OR $column IS NOT NULL" condition in the WHERE clause.
- orWhereIsNull() : static
- Appends a "OR $column IS NULL" condition in the WHERE clause.
- orWhereLessThan() : static
- Appends a "OR $column < $value" condition in the WHERE clause.
- orWhereLessThanOrEqual() : static
- Appends a "OR $column <= $value" condition in the WHERE clause.
- orWhereLike() : static
- Appends a "OR $column LIKE $value" condition in the WHERE clause.
- orWhereMatch() : static
- Appends a "OR MATCH (...$columns) AGAINST ($against IN NATURAL LANGUAGE MODE)" fulltext searching in the WHERE clause.
- orWhereMatchInBooleanMode() : static
- Appends a "OR MATCH (...$columns) AGAINST ($against IN BOOLEAN MODE)" fulltext searching in the WHERE clause.
- orWhereMatchWithQueryExpansion() : static
- Appends a "OR MATCH (...$columns) AGAINST ($against WITH QUERY EXPANSION)" fulltext searching in the WHERE clause.
- orWhereNotBetween() : static
- Appends a "OR $column NOT BETWEEN $min AND $max" condition in the WHERE clause.
- orWhereNotEqual() : static
- Appends a "OR $column != $value" condition in the WHERE clause.
- orWhereNotIn() : static
- Appends a "OR $column NOT IN (...$values)" condition in the WHERE clause.
- orWhereNotLike() : static
- Appends a "OR $column NOT LIKE $value" condition in the WHERE clause.
- orWhereNullSafeEqual() : static
- Appends a "OR $column <=> $value" condition in the WHERE clause.
- reset() : static
- Resets SQL clauses and parts.
- rightJoinOn() : static
- Adds a JOIN clause with "RIGHT JOIN $table ON $conditional".
- rightJoinUsing() : static
- Adds a JOIN clause with "RIGHT JOIN $table USING ...$columns".
- rightOuterJoinOn() : static
- Adds a JOIN clause with "RIGHT OUTER JOIN $table ON $conditional".
- rightOuterJoinUsing() : static
- Adds a JOIN clause with "RIGHT OUTER JOIN $table USING ...$columns".
- run() : int|string
- Runs the UPDATE statement.
- set() : static
- Sets the SET clause.
- sql() : string
- Renders the UPDATE statement.
- table() : static
- Sets the table references.
- where() : static
- Appends an "AND $column $operator ...$values" condition in the WHERE clause.
- whereBetween() : static
- Appends an "AND $column BETWEEN $min AND $max" condition in the WHERE clause.
- whereEqual() : static
- Appends an "AND $column = $value" condition in the WHERE clause.
- whereGreaterThan() : static
- Appends an "AND $column > $value" condition in the WHERE clause.
- whereGreaterThanOrEqual() : static
- Appends an "AND $column >= $value" condition in the WHERE clause.
- whereIn() : static
- Appends an "AND $column IN (...$values)" condition in the WHERE clause.
- whereIsNotNull() : static
- Appends an "AND $column IS NOT NULL" condition in the WHERE clause.
- whereIsNull() : static
- Appends an "AND $column IS NULL" condition in the WHERE clause.
- whereLessThan() : static
- Appends an "AND $column < $value" condition in the WHERE clause.
- whereLessThanOrEqual() : static
- Appends an "AND $column <= $value" condition in the WHERE clause.
- whereLike() : static
- Appends an "AND $column LIKE $value" condition in the WHERE clause.
- whereMatch() : static
- Appends an "AND MATCH (...$columns) AGAINST ($against IN NATURAL LANGUAGE MODE)" fulltext searching in the WHERE clause.
- whereMatchInBooleanMode() : static
- Appends an "AND MATCH (...$columns) AGAINST ($against IN BOOLEAN MODE)" fulltext searching in the WHERE clause.
- whereMatchWithQueryExpansion() : static
- Appends an "AND MATCH (...$columns) AGAINST ($against WITH QUERY EXPANSION)" fulltext searching in the WHERE clause.
- whereNotBetween() : static
- Appends an "AND $column NOT BETWEEN $min AND $max" condition in the WHERE clause.
- whereNotEqual() : static
- Appends an "AND $column != $value" condition in the WHERE clause.
- whereNotIn() : static
- Appends an "AND $column NOT IN (...$values)" condition in the WHERE clause.
- whereNotLike() : static
- Appends an "AND $column NOT LIKE $value" condition.
- whereNullSafeEqual() : static
- Appends an "AND $column <=> $value" condition in the WHERE clause.
- hasFrom() : bool
- Tells if the FROM clause was set.
- hasOptions() : bool
- Tells if the statement has options set.
- hasSet() : bool
- Tells if the SET clause was set.
- renderAliasedIdentifier() : string
- Renders a column part with an optional alias name, AS clause.
- renderAssignment() : string
- Renders an assignment part.
- renderFrom() : string|null
- Renders the FROM clause.
- renderIdentifier() : string
- Renders a column part.
- renderJoin() : string|null
- Renders the JOIN clause.
- renderLimit() : string|null
- Renders the LIMIT clause.
- renderOptions() : string|null
- renderOrderBy() : string|null
- Renders the ORDER BY clause.
- renderSet() : string|null
- Renders the SET clause.
- renderSetCheckingConflicts() : string|null
- Renders the SET clause checking conflicts.
- renderSetPart() : string
- renderTable() : string
- renderValue() : float|int|string
- Renders a subquery or quote a value.
- renderWhere() : string|null
- Renders the full WHERE (or HAVING) clause.
- setLimit() : static
- Sets the LIMIT clause.
- subquery() : string
- Returns an SQL part between parentheses.
Constants
OPT_IGNORE
Convert errors to warnings, which will not stop inserts of additional rows.
public
string
OPT_IGNORE
= 'IGNORE'
Tags
OPT_LOW_PRIORITY
public
string
OPT_LOW_PRIORITY
= 'LOW_PRIORITY'
Tags
Properties
$database
protected
Database
$database
$sql
SQL clauses and parts.
protected
array<string|int, mixed>
$sql
= []
Methods
__construct()
Statement constructor.
public
__construct(Database $database) : mixed
Parameters
- $database : Database
Return values
mixed —__toString()
public
__toString() : string
Return values
string —crossJoin()
Adds a JOIN clause with "CROSS JOIN $table".
public
crossJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
Return values
static —crossJoinOn()
Adds a JOIN clause with "CROSS JOIN $table ON $conditional".
public
crossJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —crossJoinUsing()
Adds a JOIN clause with "CROSS JOIN $table USING ...$columns".
public
crossJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —from()
Sets the FROM clause.
public
from(array<string, \Closure|string>|Closure|string $reference, array<string, \Closure|string>|Closure|string ...$references) : static
Parameters
- $reference : array<string, \Closure|string>|Closure|string
-
Table reference
- $references : array<string, \Closure|string>|Closure|string
-
Table references
Tags
Return values
static —innerJoinOn()
Adds a JOIN clause with "INNER JOIN $table ON $conditional".
public
innerJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —innerJoinUsing()
Adds a JOIN clause with "INNER JOIN $table USING ...$columns".
public
innerJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —join()
Adds a JOIN clause with "$type JOIN $table $clause $conditional".
public
join(array<string, \Closure|string>|Closure|string $table[, string $type = '' ][, string|null $clause = null ][, array<int, \Closure|string>|Closure|null $conditional = null ]) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $type : string = ''
-
JOIN type. One of:
CROSS
,INNER
,LEFT
,LEFT OUTER
,RIGHT
,RIGHT OUTER
,NATURAL
,NATURAL LEFT
,NATURAL LEFT OUTER
,NATURAL RIGHT
,NATURAL RIGHT OUTER
or empty (same asINNER
) - $clause : string|null = null
-
Condition clause. Null if it has a NATURAL type, otherwise
ON
orUSING
- $conditional : array<int, \Closure|string>|Closure|null = null
-
A conditional expression as Closure or the columns list as array
Return values
static —joinOn()
Adds a JOIN clause with "JOIN $table ON $conditional".
public
joinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —joinUsing()
Adds a JOIN clause with "JOIN $table USING ...$columns".
public
joinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —leftJoinOn()
Adds a JOIN clause with "LEFT JOIN $table ON $conditional".
public
leftJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —leftJoinUsing()
Adds a JOIN clause with "LEFT JOIN $table USING ...$columns".
public
leftJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —leftOuterJoinOn()
Adds a JOIN clause with "LEFT OUTER JOIN $table ON $conditional".
public
leftOuterJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —leftOuterJoinUsing()
Adds a JOIN clause with "LEFT OUTER JOIN $table USING ...$columns".
public
leftOuterJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —limit()
Sets the LIMIT clause.
public
limit(int $limit) : static
Parameters
- $limit : int
Tags
Return values
static —naturalJoin()
Adds a JOIN clause with "NATURAL JOIN $table".
public
naturalJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
Return values
static —naturalLeftJoin()
Adds a JOIN clause with "NATURAL LEFT JOIN $table".
public
naturalLeftJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
Return values
static —naturalLeftOuterJoin()
Adds a JOIN clause with "NATURAL LEFT OUTER JOIN $table".
public
naturalLeftOuterJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
Return values
static —naturalRightJoin()
Adds a JOIN clause with "NATURAL RIGHT JOIN $table".
public
naturalRightJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
Return values
static —naturalRightOuterJoin()
Adds a JOIN clause with "NATURAL RIGHT OUTER JOIN $table".
public
naturalRightOuterJoin(array<string, \Closure|string>|Closure|string $table) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
Return values
static —options()
Sets the statement options.
public
options(string $option, string ...$options) : static
Parameters
- $option : string
-
One of the OPT_* constants
- $options : string
-
Each option value must be one of the OPT_* constants
Return values
static —orderBy()
Appends columns to the ORDER BY clause.
public
orderBy(Closure|string $column, Closure|string ...$columns) : static
Parameters
- $column : Closure|string
-
The column name or a subquery
- $columns : Closure|string
-
Extra column names and/or subqueries
Return values
static —orderByAsc()
Appends columns with the ASC direction to the ORDER BY clause.
public
orderByAsc(Closure|string $column, Closure|string ...$columns) : static
Parameters
- $column : Closure|string
-
The column name or a subquery
- $columns : Closure|string
-
Extra column names and/or subqueries
Return values
static —orderByDesc()
Appends columns with the DESC direction to the ORDER BY clause.
public
orderByDesc(Closure|string $column, Closure|string ...$columns) : static
Parameters
- $column : Closure|string
-
The column name or a subquery
- $columns : Closure|string
-
Extra column names and/or subqueries
Return values
static —orWhere()
Appends a "OR $column $operator ...$values" condition in the WHERE clause.
public
orWhere(array<string|int, array|\Closure|string>|Closure|string $column, string $operator, array<string|int, array|\Closure|float|int|string|null>|Closure|float|int|string|null ...$values) : static
Parameters
- $column : array<string|int, array|\Closure|string>|Closure|string
-
Closure for a subquery, a string with the column name or an array with column names on WHERE MATCH clause
- $operator : string
- $values : array<string|int, array|\Closure|float|int|string|null>|Closure|float|int|string|null
Return values
static —orWhereBetween()
Appends a "OR $column BETWEEN $min AND $max" condition in the WHERE clause.
public
orWhereBetween(Closure|string $column, Closure|float|int|string|null $min, Closure|float|int|string|null $max) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $min : Closure|float|int|string|null
- $max : Closure|float|int|string|null
Tags
Return values
static —orWhereEqual()
Appends a "OR $column = $value" condition in the WHERE clause.
public
orWhereEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereGreaterThan()
Appends a "OR $column > $value" condition in the WHERE clause.
public
orWhereGreaterThan(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereGreaterThanOrEqual()
Appends a "OR $column >= $value" condition in the WHERE clause.
public
orWhereGreaterThanOrEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereIn()
Appends a "OR $column IN (...$values)" condition in the WHERE clause.
public
orWhereIn(Closure|string $column, Closure|float|int|string|null $value, Closure|float|int|string|null ...$values) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
- $values : Closure|float|int|string|null
Tags
Return values
static —orWhereIsNotNull()
Appends a "OR $column IS NOT NULL" condition in the WHERE clause.
public
orWhereIsNotNull(Closure|string $column) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
Tags
Return values
static —orWhereIsNull()
Appends a "OR $column IS NULL" condition in the WHERE clause.
public
orWhereIsNull(Closure|string $column) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
Tags
Return values
static —orWhereLessThan()
Appends a "OR $column < $value" condition in the WHERE clause.
public
orWhereLessThan(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereLessThanOrEqual()
Appends a "OR $column <= $value" condition in the WHERE clause.
public
orWhereLessThanOrEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereLike()
Appends a "OR $column LIKE $value" condition in the WHERE clause.
public
orWhereLike(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereMatch()
Appends a "OR MATCH (...$columns) AGAINST ($against IN NATURAL LANGUAGE MODE)" fulltext searching in the WHERE clause.
public
orWhereMatch(array<string|int, array|\Closure|string>|Closure|string $columns, array<string|int, array|\Closure|string>|Closure|string $against) : static
Parameters
- $columns : array<string|int, array|\Closure|string>|Closure|string
-
Columns to MATCH
- $against : array<string|int, array|\Closure|string>|Closure|string
-
AGAINST expression
Tags
Return values
static —orWhereMatchInBooleanMode()
Appends a "OR MATCH (...$columns) AGAINST ($against IN BOOLEAN MODE)" fulltext searching in the WHERE clause.
public
orWhereMatchInBooleanMode(array<string|int, array|\Closure|string>|Closure|string $columns, array<string|int, array|\Closure|string>|Closure|string $against) : static
Parameters
- $columns : array<string|int, array|\Closure|string>|Closure|string
-
Columns to MATCH
- $against : array<string|int, array|\Closure|string>|Closure|string
-
AGAINST expression
Tags
Return values
static —orWhereMatchWithQueryExpansion()
Appends a "OR MATCH (...$columns) AGAINST ($against WITH QUERY EXPANSION)" fulltext searching in the WHERE clause.
public
orWhereMatchWithQueryExpansion(array<string|int, array|\Closure|string>|Closure|string $columns, array<string|int, array|\Closure|string>|Closure|string $against) : static
Parameters
- $columns : array<string|int, array|\Closure|string>|Closure|string
-
Columns to MATCH
- $against : array<string|int, array|\Closure|string>|Closure|string
-
AGAINST expression
Tags
Return values
static —orWhereNotBetween()
Appends a "OR $column NOT BETWEEN $min AND $max" condition in the WHERE clause.
public
orWhereNotBetween(Closure|string $column, Closure|float|int|string|null $min, Closure|float|int|string|null $max) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $min : Closure|float|int|string|null
- $max : Closure|float|int|string|null
Tags
Return values
static —orWhereNotEqual()
Appends a "OR $column != $value" condition in the WHERE clause.
public
orWhereNotEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereNotIn()
Appends a "OR $column NOT IN (...$values)" condition in the WHERE clause.
public
orWhereNotIn(Closure|string $column, Closure|float|int|string|null $value, Closure|float|int|string|null ...$values) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
- $values : Closure|float|int|string|null
Tags
Return values
static —orWhereNotLike()
Appends a "OR $column NOT LIKE $value" condition in the WHERE clause.
public
orWhereNotLike(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —orWhereNullSafeEqual()
Appends a "OR $column <=> $value" condition in the WHERE clause.
public
orWhereNullSafeEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —reset()
Resets SQL clauses and parts.
public
reset([string|null $sql = null ]) : static
Parameters
- $sql : string|null = null
-
A part name or null to reset all
Tags
Return values
static —rightJoinOn()
Adds a JOIN clause with "RIGHT JOIN $table ON $conditional".
public
rightJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —rightJoinUsing()
Adds a JOIN clause with "RIGHT JOIN $table USING ...$columns".
public
rightJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —rightOuterJoinOn()
Adds a JOIN clause with "RIGHT OUTER JOIN $table ON $conditional".
public
rightOuterJoinOn(array<string, \Closure|string>|Closure|string $table, Closure $conditional) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $conditional : Closure
-
Conditional expression
Return values
static —rightOuterJoinUsing()
Adds a JOIN clause with "RIGHT OUTER JOIN $table USING ...$columns".
public
rightOuterJoinUsing(array<string, \Closure|string>|Closure|string $table, Closure|string ...$columns) : static
Parameters
- $table : array<string, \Closure|string>|Closure|string
-
Table factor
- $columns : Closure|string
-
Columns list
Return values
static —run()
Runs the UPDATE statement.
public
run() : int|string
Return values
int|string —The number of affected rows
set()
Sets the SET clause.
public
set(array<string, \Closure|float|int|string|null>|object $columns) : static
Parameters
- $columns : array<string, \Closure|float|int|string|null>|object
-
Array of columns => values or an object to be cast to array
Return values
static —sql()
Renders the UPDATE statement.
public
sql() : string
Return values
string —table()
Sets the table references.
public
table(array<string, \Closure|string>|Closure|string $reference, array<string, \Closure|string>|Closure|string ...$references) : static
Parameters
- $reference : array<string, \Closure|string>|Closure|string
- $references : array<string, \Closure|string>|Closure|string
Return values
static —where()
Appends an "AND $column $operator ...$values" condition in the WHERE clause.
public
where(array<string|int, array|\Closure|string>|Closure|string $column, string $operator, array<string|int, array|\Closure|float|int|string|null>|Closure|float|int|string|null ...$values) : static
Parameters
- $column : array<string|int, array|\Closure|string>|Closure|string
-
Closure for a subquery, a string with the column name or an array with column names on WHERE MATCH clause
- $operator : string
- $values : array<string|int, array|\Closure|float|int|string|null>|Closure|float|int|string|null
Return values
static —whereBetween()
Appends an "AND $column BETWEEN $min AND $max" condition in the WHERE clause.
public
whereBetween(Closure|string $column, Closure|float|int|string|null $min, Closure|float|int|string|null $max) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $min : Closure|float|int|string|null
- $max : Closure|float|int|string|null
Tags
Return values
static —whereEqual()
Appends an "AND $column = $value" condition in the WHERE clause.
public
whereEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereGreaterThan()
Appends an "AND $column > $value" condition in the WHERE clause.
public
whereGreaterThan(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereGreaterThanOrEqual()
Appends an "AND $column >= $value" condition in the WHERE clause.
public
whereGreaterThanOrEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereIn()
Appends an "AND $column IN (...$values)" condition in the WHERE clause.
public
whereIn(Closure|string $column, Closure|float|int|string|null $value, Closure|float|int|string|null ...$values) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
- $values : Closure|float|int|string|null
Tags
Return values
static —whereIsNotNull()
Appends an "AND $column IS NOT NULL" condition in the WHERE clause.
public
whereIsNotNull(Closure|string $column) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
Tags
Return values
static —whereIsNull()
Appends an "AND $column IS NULL" condition in the WHERE clause.
public
whereIsNull(Closure|string $column) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
Tags
Return values
static —whereLessThan()
Appends an "AND $column < $value" condition in the WHERE clause.
public
whereLessThan(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereLessThanOrEqual()
Appends an "AND $column <= $value" condition in the WHERE clause.
public
whereLessThanOrEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereLike()
Appends an "AND $column LIKE $value" condition in the WHERE clause.
public
whereLike(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereMatch()
Appends an "AND MATCH (...$columns) AGAINST ($against IN NATURAL LANGUAGE MODE)" fulltext searching in the WHERE clause.
public
whereMatch(array<string|int, array|\Closure|string>|Closure|string $columns, array<string|int, array|\Closure|string>|Closure|string $against) : static
Parameters
- $columns : array<string|int, array|\Closure|string>|Closure|string
-
Columns to MATCH
- $against : array<string|int, array|\Closure|string>|Closure|string
-
AGAINST expression
Tags
Return values
static —whereMatchInBooleanMode()
Appends an "AND MATCH (...$columns) AGAINST ($against IN BOOLEAN MODE)" fulltext searching in the WHERE clause.
public
whereMatchInBooleanMode(array<string|int, array|\Closure|string>|Closure|string $columns, array<string|int, array|\Closure|string>|Closure|string $against) : static
Parameters
- $columns : array<string|int, array|\Closure|string>|Closure|string
-
Columns to MATCH
- $against : array<string|int, array|\Closure|string>|Closure|string
-
AGAINST expression
Tags
Return values
static —whereMatchWithQueryExpansion()
Appends an "AND MATCH (...$columns) AGAINST ($against WITH QUERY EXPANSION)" fulltext searching in the WHERE clause.
public
whereMatchWithQueryExpansion(array<string|int, array|\Closure|string>|Closure|string $columns, array<string|int, array|\Closure|string>|Closure|string $against) : static
Parameters
- $columns : array<string|int, array|\Closure|string>|Closure|string
-
Columns to MATCH
- $against : array<string|int, array|\Closure|string>|Closure|string
-
AGAINST expression
Tags
Return values
static —whereNotBetween()
Appends an "AND $column NOT BETWEEN $min AND $max" condition in the WHERE clause.
public
whereNotBetween(Closure|string $column, Closure|float|int|string|null $min, Closure|float|int|string|null $max) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $min : Closure|float|int|string|null
- $max : Closure|float|int|string|null
Tags
Return values
static —whereNotEqual()
Appends an "AND $column != $value" condition in the WHERE clause.
public
whereNotEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereNotIn()
Appends an "AND $column NOT IN (...$values)" condition in the WHERE clause.
public
whereNotIn(Closure|string $column, Closure|float|int|string|null $value, Closure|float|int|string|null ...$values) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
- $values : Closure|float|int|string|null
Tags
Return values
static —whereNotLike()
Appends an "AND $column NOT LIKE $value" condition.
public
whereNotLike(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —whereNullSafeEqual()
Appends an "AND $column <=> $value" condition in the WHERE clause.
public
whereNullSafeEqual(Closure|string $column, Closure|float|int|string|null $value) : static
Parameters
- $column : Closure|string
-
Closure for a subquery or a string with the column name
- $value : Closure|float|int|string|null
Tags
Return values
static —hasFrom()
Tells if the FROM clause was set.
protected
hasFrom([string|null $clause = null ]) : bool
Parameters
- $clause : string|null = null
-
A clause where FROM is required
Tags
Return values
bool —True if it has FROM, otherwise false
hasOptions()
Tells if the statement has options set.
protected
hasOptions() : bool
Return values
bool —hasSet()
Tells if the SET clause was set.
protected
hasSet() : bool
Return values
bool —True if was set, otherwise false
renderAliasedIdentifier()
Renders a column part with an optional alias name, AS clause.
protected
renderAliasedIdentifier(array<string, \Closure|string>|Closure|string $column) : string
Parameters
- $column : array<string, \Closure|string>|Closure|string
-
The column name, a subquery or an array where the index is the alias and the value is the column/subquery
Return values
string —renderAssignment()
Renders an assignment part.
protected
renderAssignment(string $identifier, Closure|float|int|string|null $expression) : string
Parameters
- $identifier : string
-
Identifier/column name
- $expression : Closure|float|int|string|null
-
Expression/value
Tags
Return values
string —renderFrom()
Renders the FROM clause.
protected
renderFrom() : string|null
Return values
string|null —The FROM clause or null if it was not set
renderIdentifier()
Renders a column part.
protected
renderIdentifier(Closure|string $column) : string
Parameters
- $column : Closure|string
-
The column name or a subquery
Return values
string —renderJoin()
Renders the JOIN clause.
protected
renderJoin() : string|null
Return values
string|null —The JOIN clause or null if it was not set
renderLimit()
Renders the LIMIT clause.
protected
renderLimit() : string|null
Return values
string|null —renderOptions()
protected
renderOptions() : string|null
Return values
string|null —renderOrderBy()
Renders the ORDER BY clause.
protected
renderOrderBy() : string|null
Return values
string|null —The ORDER BY clause or null if it was not set
renderSet()
Renders the SET clause.
protected
renderSet() : string|null
Return values
string|null —The SET clause null if it was not set
renderSetCheckingConflicts()
Renders the SET clause checking conflicts.
protected
renderSetCheckingConflicts() : string|null
Tags
Return values
string|null —The SET part or null if it was not set
renderSetPart()
protected
renderSetPart() : string
Return values
string —renderTable()
protected
renderTable() : string
Return values
string —renderValue()
Renders a subquery or quote a value.
protected
renderValue(Closure|float|int|string|null $value) : float|int|string
Parameters
- $value : Closure|float|int|string|null
-
A Closure for subquery, other types to quote
Return values
float|int|string —renderWhere()
Renders the full WHERE (or HAVING) clause.
protected
renderWhere([string $clause = 'where' ]) : string|null
Parameters
- $clause : string = 'where'
-
where
orhaving
Return values
string|null —The full clause or null if has not a clause
setLimit()
Sets the LIMIT clause.
protected
setLimit(int $limit[, int|null $offset = null ]) : static
Parameters
- $limit : int
- $offset : int|null = null
Tags
Return values
static —subquery()
Returns an SQL part between parentheses.
protected
subquery(Closure $subquery) : string
Parameters
- $subquery : Closure
-
A Closure having the current Manipulation instance as first argument. The returned value must be scalar