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 intbatchSizeprivate BatchedQuery[]blocksprivate java.lang.Stringsqlprivate intvaluesBraceClosePositionprivate intvaluesBraceOpenPosition-
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)privateBatchedQuery(BatchedQuery src, int batchSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.lang.StringbuildNativeSql(ParameterList params)BatchedQueryderiveForMultiBatch(int valueBlock)intgetBatchSize()Get the number of times this Query has been batched.java.lang.StringgetNativeSql()Method to return the sql based on number of batches.java.lang.StringtoString(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:QueryGet the number of times this Query has been batched.- Specified by:
getBatchSizein interfaceQuery- Overrides:
getBatchSizein 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:
getNativeSqlin interfaceQuery- Overrides:
getNativeSqlin 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:QueryStringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.- Specified by:
toStringin interfaceQuery- Overrides:
toStringin classSimpleQuery- Parameters:
params- a ParameterList returned by this Query'sQuery.createParameterList()method, ornullto leave the parameter placeholders unsubstituted.- Returns:
- a human-readable representation of this query
-
-