Drupal 8  8.0.2
Update Class Reference
Inheritance diagram for Update:

Public Member Functions

 __construct (Connection $connection, $table, array $options=array())
 
 fields (array $fields)
 
 expression ($field, $expression, array $arguments=NULL)
 
 execute ()
 
 __toString ()
 
- Public Member Functions inherited from Query
 __construct (Connection $connection, $options)
 
 __sleep ()
 
 __wakeup ()
 
 __clone ()
 
 __toString ()
 
 uniqueIdentifier ()
 
 nextPlaceholder ()
 
 comment ($comment)
 
getComments ()
 
- Public Member Functions inherited from ConditionInterface
 condition ($field, $value=NULL, $operator= '=')
 
 where ($snippet, $args=array())
 
 isNull ($field)
 
 isNotNull ($field)
 
 exists (SelectInterface $select)
 
 notExists (SelectInterface $select)
 
conditions ()
 
 arguments ()
 
 compile (Connection $connection, PlaceholderInterface $queryPlaceholder)
 
 compiled ()
 
 conditionGroupFactory ($conjunction= 'AND')
 
 andConditionGroup ()
 
 orConditionGroup ()
 

Protected Attributes

 $table
 
 $fields = array()
 
 $arguments = array()
 
 $expressionFields = array()
 
- Protected Attributes inherited from Query
 $connection
 
 $connectionTarget
 
 $connectionKey
 
 $queryOptions
 
 $uniqueIdentifier
 
 $nextPlaceholder = 0
 
 $comments = array()
 

Additional Inherited Members

- Protected Member Functions inherited from Query
 execute ()
 

Detailed Description

General class for an abstracted UPDATE operation.

Constructor & Destructor Documentation

__construct ( Connection  $connection,
  $table,
array  $options = array() 
)

Constructs an Update query object.

Parameters
\Drupal\Core\Database\Connection$connectionA Connection object.
string$tableName of the table to associate with this query.
array$optionsArray of database options.

References ConditionInterface\condition(), and Database\RETURN_AFFECTED.

Here is the call graph for this function:

Member Function Documentation

__toString ( )

Implements PHP magic __toString method to convert the query to a string.

Returns
string The prepared statement.

References ConditionInterface\condition().

Here is the call graph for this function:

execute ( )

Executes the UPDATE query.

Returns
The number of rows matched by the update query. This includes rows that actually didn't have to be updated because the values didn't change.

References ConditionInterface\condition().

Here is the call graph for this function:

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().

Parameters
$fieldThe field to set.
$expressionThe field will be set to the value of this expression. This parameter may include named placeholders.
$argumentsIf specified, this is an array of key/value pairs for named placeholders corresponding to the expression.
Returns
The called object.
fields ( array  $fields)

Adds a set of field->value pairs to be updated.

Parameters
$fieldsAn associative array of fields to write into the database. The array keys are the field names and the values are the values to which to set them.
Returns
The called object.

The documentation for this class was generated from the following file: