Class UpdateRequest.UpdateMappingConsumer
java.lang.Object
org.datanucleus.store.rdbms.request.UpdateRequest.UpdateMappingConsumer
- All Implemented Interfaces:
MappingConsumer
- Enclosing class:
UpdateRequest
Mapping Consumer used for generating the UPDATE statement for an object in a table.
This statement will be of the form
UPDATE table-name SET param1=?,param2=? WHERE id1=? AND id2=?or (when also performing version checks)
UPDATE table-name SET param1=?,param2=?,version={newvers} WHERE id1=? AND id2=? AND version={oldvers}
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) Map(package private) List<MappingCallbacks> Mappings that require callbacks calling.private final org.datanucleus.metadata.AbstractClassMetaDataMetaData for the class of the object(package private) StringBuilderfor UPDATE statement(package private) booleanFlag for initialisation state of the consumer.(package private) intCurrent parameter index.(package private) List<JavaTypeMapping> Mappings that require post-set processing.(package private) ListNumbers of all fields to be updated.private StatementMappingIndexprivate StatementMappingIndex(package private) StringBuilderWhere clause for the statement.private boolean(package private) ListNumbers of all WHERE clause fields. -
Constructor Summary
ConstructorsConstructorDescriptionUpdateMappingConsumer(org.datanucleus.metadata.AbstractClassMetaData cmd) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidconsumeMapping(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd) Consumes a mapping for a field.voidconsumeMapping(JavaTypeMapping m, MappingType mappingType) Consumes a mapping associated to surrogate / special columns.voidConsumer a column without mapping.Accessor for the basic update SQL statement.int[]Accessor for the numbers of fields to be updated (excluding PK fields).int[]Accessor for the numbers of fields in the WHERE clause.voidpreConsumeMapping(int highest) This method is called before consuming the mappingsvoidsetWhereClauseConsumption(boolean whereClause)
-
Field Details
-
initialized
boolean initializedFlag for initialisation state of the consumer. -
paramIndex
int paramIndexCurrent parameter index. -
updateFields
List updateFieldsNumbers of all fields to be updated. -
whereFields
List whereFieldsNumbers of all WHERE clause fields. -
postSetMappings
List<JavaTypeMapping> postSetMappingsMappings that require post-set processing. -
callbackMappings
List<MappingCallbacks> callbackMappingsMappings that require callbacks calling. -
columnAssignments
StringBuilder columnAssignmentsfor UPDATE statement -
assignedColumns
Map assignedColumns -
where
StringBuilder whereWhere clause for the statement. Built during the consumption process. -
cmd
private final org.datanucleus.metadata.AbstractClassMetaData cmdMetaData for the class of the object -
whereClauseConsumption
private boolean whereClauseConsumption -
updateUserStatementMapping
-
updateTimestampStatementMapping
-
-
Constructor Details
-
UpdateMappingConsumer
public UpdateMappingConsumer(org.datanucleus.metadata.AbstractClassMetaData cmd) Constructor- Parameters:
cmd- metadata for the class
-
-
Method Details
-
setWhereClauseConsumption
public void setWhereClauseConsumption(boolean whereClause) -
preConsumeMapping
public void preConsumeMapping(int highest) Description copied from interface:MappingConsumerThis method is called before consuming the mappings- Specified by:
preConsumeMappingin interfaceMappingConsumer- Parameters:
highest- the highest number for the fields that are going to be provided in the consumer
-
consumeMapping
Consumes a mapping for a field.- Specified by:
consumeMappingin interfaceMappingConsumer- Parameters:
m- The mapping.mmd- MetaData for the field
-
consumeMapping
Consumes a mapping associated to surrogate / special columns.- Specified by:
consumeMappingin interfaceMappingConsumer- Parameters:
m- The mapping.mappingType- the Mapping type
-
consumeUnmappedColumn
Consumer a column without mapping.- Specified by:
consumeUnmappedColumnin interfaceMappingConsumer- Parameters:
col- Column
-
getUpdateUserStatementMapping
-
getUpdateTimestampStatementMapping
-
getPostSetMappings
-
getMappingCallbacks
-
getUpdateFieldNumbers
public int[] getUpdateFieldNumbers()Accessor for the numbers of fields to be updated (excluding PK fields).- Returns:
- array of absolute field numbers
-
getWhereFieldNumbers
public int[] getWhereFieldNumbers()Accessor for the numbers of fields in the WHERE clause.- Returns:
- array of absolute WHERE clause field numbers
-
getStatement
Accessor for the basic update SQL statement.UPDATE TABLE SET COL1 = ?, COL2 = ? WHERE COL3 = ? AND COL4 = ?
- Returns:
- The update SQL statement
-