Package com.mysql.cj.xdevapi
Class ModifyStatementImpl
java.lang.Object
com.mysql.cj.xdevapi.PreparableStatement<RES_T>
com.mysql.cj.xdevapi.FilterableStatement<ModifyStatement,Result>
com.mysql.cj.xdevapi.ModifyStatementImpl
- All Implemented Interfaces:
ModifyStatement,Statement<ModifyStatement,Result>
public class ModifyStatementImpl extends FilterableStatement<ModifyStatement,Result> implements ModifyStatement
ModifyStatement implementation.-
Nested Class Summary
Nested classes/interfaces inherited from class com.mysql.cj.xdevapi.PreparableStatement
PreparableStatement.PreparableStatementFinalizer, PreparableStatement.PreparedStateNested classes/interfaces inherited from interface com.mysql.cj.xdevapi.Statement
Statement.LockContention -
Field Summary
Fields inherited from class com.mysql.cj.xdevapi.PreparableStatement
mysqlxSession, preparedState, preparedStatementId -
Method Summary
Modifier and Type Method Description ModifyStatementarrayAppend(java.lang.String docPath, java.lang.Object value)Append a value to the specified array.ModifyStatementarrayInsert(java.lang.String field, java.lang.Object value)Insert a value into the specified array.ModifyStatementchange(java.lang.String docPath, java.lang.Object value)Add an update to the statement setting the field, if it exists at the document path, to the given value.java.util.concurrent.CompletableFuture<Result>executeAsync()Execute the statement asynchronously.protected ResultexecutePreparedStatement()Executes a previously server-prepared statement.protected ResultexecuteStatement()Executes the statement directly (non-prepared).protected XMessagegetPrepareStatementXMessage()Returns theXMessageneeded to prepare this statement.ModifyStatementpatch(DbDoc document)Takes in a patch object and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function.ModifyStatementpatch(java.lang.String document)Takes in a document patch and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function.ModifyStatementset(java.lang.String docPath, java.lang.Object value)Add an update to the statement setting the field as the document path to the given value for all documents matching the search criteria.ModifyStatementunset(java.lang.String... fields)Nullify the given fields.ModifyStatementwhere(java.lang.String searchCondition)Deprecated.Deprecated in Connector/J 8.0.17.Methods inherited from class com.mysql.cj.xdevapi.FilterableStatement
bind, clearBindings, isRelational, limit, offset, orderBy, sortMethods inherited from class com.mysql.cj.xdevapi.PreparableStatement
deallocatePrepared, execute, getMessageBuilder, resetPrepareState, setReprepareState
-
Method Details
-
executeStatement
Description copied from class:PreparableStatementExecutes the statement directly (non-prepared). Implementation is dependent on the statement type.- Specified by:
executeStatementin classPreparableStatement<Result>- Returns:
- the object returned from the lower level statement execution
-
getPrepareStatementXMessage
Description copied from class:PreparableStatementReturns theXMessageneeded to prepare this statement. Implementation is dependent on the statement type.- Specified by:
getPrepareStatementXMessagein classPreparableStatement<Result>- Returns:
- the
XMessagethat prepares this statement
-
executePreparedStatement
Description copied from class:PreparableStatementExecutes a previously server-prepared statement. Implementation is dependent on the statement type.- Specified by:
executePreparedStatementin classPreparableStatement<Result>- Returns:
- the object returned from the lower level statement execution
-
executeAsync
Description copied from interface:StatementExecute the statement asynchronously.- Specified by:
executeAsyncin interfaceStatement<ModifyStatement,Result>- Returns:
CompletableFuturefor result
-
set
Description copied from interface:ModifyStatementAdd an update to the statement setting the field as the document path to the given value for all documents matching the search criteria.- Specified by:
setin interfaceModifyStatement- Parameters:
docPath- document path to the given valuevalue- value to set- Returns:
ModifyStatement
-
change
Description copied from interface:ModifyStatementAdd an update to the statement setting the field, if it exists at the document path, to the given value.- Specified by:
changein interfaceModifyStatement- Parameters:
docPath- document path to the given valuevalue- value to set- Returns:
ModifyStatement
-
unset
Description copied from interface:ModifyStatementNullify the given fields.- Specified by:
unsetin interfaceModifyStatement- Parameters:
fields- one or more field names- Returns:
ModifyStatement
-
patch
Description copied from interface:ModifyStatementTakes in a patch object and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function. Please note thatDbDocdoes not support expressions as a field values, please useModifyStatement.patch(String)method if you need such functionality.- Specified by:
patchin interfaceModifyStatement- Parameters:
document- patch object- Returns:
ModifyStatement
-
patch
Description copied from interface:ModifyStatementTakes in a document patch and applies it on all documents matching the modify() filter, using the JSON_MERGE_PATCH() function. A document patch is similar to a JSON object, with the key difference that document field values can be nested expressions in addition to literal values.
Example:
collection.modify("_id = :id")
.patch("{\"zip\": address.zip-300000, \"street\": CONCAT($.name, '''s street: ', $.address.street)}")
.bind("id", "2").execute();- Specified by:
patchin interfaceModifyStatement- Parameters:
document- patch object- Returns:
ModifyStatement
-
arrayInsert
Description copied from interface:ModifyStatementInsert a value into the specified array.- Specified by:
arrayInsertin interfaceModifyStatement- Parameters:
field- document path to the array fieldvalue- value to insert- Returns:
ModifyStatement
-
arrayAppend
Description copied from interface:ModifyStatementAppend a value to the specified array.- Specified by:
arrayAppendin interfaceModifyStatement- Parameters:
docPath- document path to the array fieldvalue- value to append- Returns:
ModifyStatement
-
where
Deprecated.Deprecated in Connector/J 8.0.17. Please use filter criteria in the operation starting method.Description copied from class:FilterableStatementAdd search condition to this statement.table.delete().where("age == 13").execute();- Overrides:
wherein classFilterableStatement<ModifyStatement,Result>- Parameters:
searchCondition- expression- Returns:
- this statement
-