Package org.postgresql.core.v3
Class BatchedQuery
- java.lang.Object
-
- org.postgresql.core.v3.SimpleQuery
-
- org.postgresql.core.v3.BatchedQuery
-
- All Implemented Interfaces:
Query
public class BatchedQuery extends SimpleQuery
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
Fields Modifier and Type Field Description private int
batchSize
private BatchedQuery[]
blocks
private java.lang.String
sql
private int
valuesBraceClosePosition
private int
valuesBraceOpenPosition
-
Fields inherited from class org.postgresql.core.v3.SimpleQuery
NO_PARAMETERS
-
-
Constructor Summary
Constructors Modifier Constructor Description BatchedQuery(NativeQuery query, TypeTransferModeRegistry transferModeRegistry, int valuesBraceOpenPosition, int valuesBraceClosePosition, boolean sanitiserDisabled)
private
BatchedQuery(BatchedQuery src, int batchSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.String
buildNativeSql(ParameterList params)
BatchedQuery
deriveForMultiBatch(int valueBlock)
int
getBatchSize()
Get the number of times this Query has been batched.java.lang.String
getNativeSql()
Method to return the sql based on number of batches.java.lang.String
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 Detail
-
sql
private java.lang.String sql
-
valuesBraceOpenPosition
private final int valuesBraceOpenPosition
-
valuesBraceClosePosition
private final int valuesBraceClosePosition
-
batchSize
private final int batchSize
-
blocks
private BatchedQuery[] blocks
-
-
Constructor Detail
-
BatchedQuery
public BatchedQuery(NativeQuery query, TypeTransferModeRegistry transferModeRegistry, int valuesBraceOpenPosition, int valuesBraceClosePosition, boolean sanitiserDisabled)
-
BatchedQuery
private BatchedQuery(BatchedQuery src, int batchSize)
-
-
Method Detail
-
deriveForMultiBatch
public BatchedQuery deriveForMultiBatch(int valueBlock)
-
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
public java.lang.String 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
private java.lang.String buildNativeSql(ParameterList params)
-
toString
public java.lang.String toString(ParameterList params)
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
-
-