Package org.postgresql.core.v3
Class BatchedQuery
java.lang.Object
org.postgresql.core.v3.SimpleQuery
org.postgresql.core.v3.BatchedQuery
- All Implemented Interfaces:
Query
Purpose of this object is to support batched query re write behaviour. Responsibility for
tracking the batch size and implement the clean up of the query fragments after the batch execute
is complete. Intended to be used to wrap a Query that is present in the batchStatements
collection.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private BatchedQuery[]
private String
private final int
private final int
Fields inherited from class org.postgresql.core.v3.SimpleQuery
NO_PARAMETERS
-
Constructor Summary
ConstructorsModifierConstructorDescriptionBatchedQuery
(NativeQuery query, TypeTransferModeRegistry transferModeRegistry, int valuesBraceOpenPosition, int valuesBraceClosePosition, boolean sanitiserDisabled) private
BatchedQuery
(BatchedQuery src, int batchSize) -
Method Summary
Modifier and TypeMethodDescriptionprivate String
buildNativeSql
(ParameterList params) deriveForMultiBatch
(int valueBlock) int
Get the number of times this Query has been batched.Method to return the sql based on number of batches.toString
(ParameterList params) Stringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.Methods inherited from class org.postgresql.core.v3.SimpleQuery
close, createParameterList, getBindCount, getEncodedStatementName, getFields, getMaxResultRowSize, getNativeQuery, getPrepareTypes, getResultSetColumnNameIndexMap, getSqlCommand, getStatementName, getSubqueries, hasBinaryFields, hasUnresolvedTypes, isEmpty, isPortalDescribed, isPreparedFor, isStatementDescribed, needUpdateFieldFormats, resetNeedUpdateFieldFormats, setCleanupRef, setFields, setHasBinaryFields, setPortalDescribed, setPrepareTypes, setStatementDescribed, setStatementName, toString, unprepare
-
Field Details
-
sql
-
valuesBraceOpenPosition
private final int valuesBraceOpenPosition -
valuesBraceClosePosition
private final int valuesBraceClosePosition -
batchSize
private final int batchSize -
blocks
-
-
Constructor Details
-
BatchedQuery
public BatchedQuery(NativeQuery query, TypeTransferModeRegistry transferModeRegistry, int valuesBraceOpenPosition, int valuesBraceClosePosition, boolean sanitiserDisabled) -
BatchedQuery
-
-
Method Details
-
deriveForMultiBatch
-
getBatchSize
public int getBatchSize()Description copied from interface:Query
Get the number of times this Query has been batched.- Specified by:
getBatchSize
in interfaceQuery
- Overrides:
getBatchSize
in classSimpleQuery
- Returns:
- number of times
addBatch()
has been called.
-
getNativeSql
Method to return the sql based on number of batches. Skipping the initial batch.- Specified by:
getNativeSql
in interfaceQuery
- Overrides:
getNativeSql
in classSimpleQuery
- Returns:
- SQL in native for database format
-
buildNativeSql
-
toString
Description copied from interface:Query
Stringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.- Specified by:
toString
in interfaceQuery
- Overrides:
toString
in classSimpleQuery
- Parameters:
params
- a ParameterList returned by this Query'sQuery.createParameterList()
method, ornull
to leave the parameter placeholders unsubstituted.- Returns:
- a human-readable representation of this query
-