Update
class Update extends Update (View source)
PostgreSQL implementation of \Drupal\Core\Database\Query\Update.
Traits
Provides an implementation of ConditionInterface.
Properties
| protected Connection | $connection | The connection object on which to run this query. |
from Query |
| protected string | $connectionTarget | The target of the connection object. |
from Query |
| protected string | $connectionKey | The key of the connection object. |
from Query |
| protected array | $queryOptions | The query options to pass on to the connection object. |
from Query |
| protected string | $uniqueIdentifier | A unique identifier for this query object. |
from Query |
| protected int | $nextPlaceholder | The placeholder counter. |
from Query |
| protected array | $comments | An array of comments that can be prepended to a query. |
from Query |
| protected Condition | $condition | The condition object for this query. |
from QueryConditionTrait |
| protected string | $table | The table to update. |
from Update |
| protected array | $fields | An array of fields that will be updated. |
from Update |
| protected array | $arguments | An array of values to update to. |
from Update |
| protected array | $expressionFields | Array of fields to update to an expression in case of a duplicate record. |
from Update |
Methods
Constructs an Update query object.
Executes the UPDATE query.
Implements PHP magic __toString method to convert the query to a string.
Specifies fields to be updated as an expression.
Details
in
Update at line 63
__construct(Connection $connection, string $table, array $options = [])
Constructs an Update query object.
in
Query at line 86
__sleep()
Implements the magic __sleep function to disconnect from the database.
in
Query at line 95
__wakeup()
Implements the magic __wakeup function to reconnect to the database.
in
Query at line 102
__clone()
Implements the magic __clone function.
StatementInterface|null
execute()
Executes the UPDATE query.
string
__toString()
Implements PHP magic __toString method to convert the query to a string.
in
Query at line 128
uniqueIdentifier()
Returns a unique identifier for this object.
in
Query at line 138
The
nextPlaceholder()
Gets the next placeholder value for this query object.
in
Query at line 158
$this
comment($comment)
Adds a comment to the query.
By adding a comment to a query, you can more easily find it in your query log or the list of active queries on an SQL server. This allows for easier debugging and allows you to more easily find where a query with a performance problem is being generated.
The comment string will be sanitized to remove * / and other characters that may terminate the string early so as to avoid SQL injection attacks.
in
Query at line 178
array
getComments()
Returns a reference to the comments array for the query.
Because this method returns by reference, alter hooks may edit the comments array directly to make their changes. If just adding comments, however, the use of comment() is preferred.
Note that this method must be called by reference as well:
in
Query at line 188
Connection
getConnection()
Gets the database connection to be used for the query.
condition($field, $value = NULL, $operator = '=')
{@inheritdoc}
isNull($field)
{@inheritdoc}
isNotNull($field)
{@inheritdoc}
exists(SelectInterface $select)
{@inheritdoc}
notExists(SelectInterface $select)
{@inheritdoc}
alwaysFalse()
{@inheritdoc}
conditions()
{@inheritdoc}
arguments()
{@inheritdoc}
where($snippet, $args = [])
{@inheritdoc}
compile(Connection $connection, PlaceholderInterface $queryPlaceholder)
{@inheritdoc}
compiled()
{@inheritdoc}
conditionGroupFactory($conjunction = 'AND')
{@inheritdoc}
andConditionGroup()
{@inheritdoc}
orConditionGroup()
{@inheritdoc}
in
Update at line 81
$this
fields(array $fields)
Adds a set of field->value pairs to be updated.
$this
expression($field, $expression, array $arguments = NULL)
Specifies fields to be updated as an expression.
Expression fields are cases such as counter=counter+1. This method takes precedence over fields().