MySQL Shell API 9.0.1
Unified development interface for MySQL Products
|
Handler for record update operations on a Table. More...
Methods | |
TableUpdate | update () |
Initializes the update operation. More... | |
TableUpdate | set (str attribute, Value value) |
Adds an update operation. More... | |
TableUpdate | where (str expression) |
Sets the search condition to filter the records to be updated. More... | |
TableUpdate | order_by (list sortCriteria) |
Sets the order in which the records will be updated. More... | |
TableUpdate | limit (int numberOfRows) |
Sets the maximum number of rows to be updated by the operation. More... | |
TableUpdate | bind (str name, Value value) |
Binds a value to a specific placeholder used on this operation. More... | |
Result | execute () |
Executes the delete operation with all the configured options. More... | |
Handler for record update operations on a Table.
This object provides the necessary functions to allow updating records on a table.
This object should only be created by calling the update function on the table object on which the records will be updated.
TableUpdate update | ( | ) |
Initializes the update operation.
After this function invocation, the following function can be invoked:
TableUpdate set | ( | str | attribute, |
Value | value | ||
) |
Adds an update operation.
attribute | Identifies the column to be updated by this operation. |
value | Defines the value to be set on the indicated column. |
Adds an operation into the update handler to update a column value in the records that were included on the selection filter and limit.
Using Expressions As Values
If a mysqlx.expr(...) object is defined as a value, it will be evaluated in the server, the resulting value will be set at the indicated column.
The expression also can be used for Parameter Binding.
This function can be invoked multiple times after:
TableUpdate where | ( | str | expression | ) |
Sets the search condition to filter the records to be updated.
expression | A condition to filter the records to be updated. |
If used, only those rows satisfying the expression will be updated
The expression supports Parameter Binding.
This function can be invoked only once after:
TableUpdate order_by | ( | list | sortCriteria | ) |
Sets the order in which the records will be updated.
If used, the TableUpdate operation will update the records in the order established by the sort criteria.
Every defined sort criterion follows the format:
name [ ASC | DESC ]
ASC is used by default if the sort order is not specified.
This function can be invoked only once after:
TableUpdate limit | ( | int | numberOfRows | ) |
Sets the maximum number of rows to be updated by the operation.
numberOfRows | The maximum number of rows to be updated. |
If used, the operation will update only numberOfRows rows.
This function can be invoked only once after:
After this function invocation, the following functions can be invoked:
TableUpdate bind | ( | str | name, |
Value | value | ||
) |
Binds a value to a specific placeholder used on this operation.
name | The name of the placeholder to which the value will be bound. |
value | The value to be bound on the placeholder. |
Binds the given value to the placeholder with the specified name.
An error will be raised if the placeholder indicated by name does not exist.
This function must be called once for each used placeholder or an error will be raised when the execute method is called.
This function can be invoked multiple times right before calling execute().
After this function invocation, the following functions can be invoked:
Result execute | ( | ) |
Executes the delete operation with all the configured options.
This function can be invoked after any other function on this class except update().