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.AbstractClassMetaData
MetaData for the class of the object(package private) StringBuilder
for UPDATE statement(package private) boolean
Flag for initialisation state of the consumer.(package private) int
Current parameter index.(package private) List
<JavaTypeMapping> Mappings that require post-set processing.(package private) List
Numbers of all fields to be updated.private StatementMappingIndex
private StatementMappingIndex
(package private) StringBuilder
Where clause for the statement.private boolean
(package private) List
Numbers of all WHERE clause fields. -
Constructor Summary
ConstructorsConstructorDescriptionUpdateMappingConsumer
(org.datanucleus.metadata.AbstractClassMetaData cmd) Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
consumeMapping
(JavaTypeMapping m, org.datanucleus.metadata.AbstractMemberMetaData mmd) Consumes a mapping for a field.void
consumeMapping
(JavaTypeMapping m, MappingType mappingType) Consumes a mapping associated to surrogate / special columns.void
Consumer 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.void
preConsumeMapping
(int highest) This method is called before consuming the mappingsvoid
setWhereClauseConsumption
(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:MappingConsumer
This method is called before consuming the mappings- Specified by:
preConsumeMapping
in 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:
consumeMapping
in interfaceMappingConsumer
- Parameters:
m
- The mapping.mmd
- MetaData for the field
-
consumeMapping
Consumes a mapping associated to surrogate / special columns.- Specified by:
consumeMapping
in interfaceMappingConsumer
- Parameters:
m
- The mapping.mappingType
- the Mapping type
-
consumeUnmappedColumn
Consumer a column without mapping.- Specified by:
consumeUnmappedColumn
in 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
-