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 Details

    • sql

      private String sql
    • valuesBraceOpenPosition

      private final int valuesBraceOpenPosition
    • valuesBraceClosePosition

      private final int valuesBraceClosePosition
    • batchSize

      private final int batchSize
    • blocks

      private BatchedQuery[] blocks
  • Constructor Details

    • BatchedQuery

      public BatchedQuery(NativeQuery query, TypeTransferModeRegistry transferModeRegistry, int valuesBraceOpenPosition, int valuesBraceClosePosition, boolean sanitiserDisabled)
    • BatchedQuery

      private BatchedQuery(BatchedQuery src, int batchSize)
  • Method Details

    • 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 interface Query
      Overrides:
      getBatchSize in class SimpleQuery
      Returns:
      number of times addBatch() has been called.
    • getNativeSql

      public String getNativeSql()
      Method to return the sql based on number of batches. Skipping the initial batch.
      Specified by:
      getNativeSql in interface Query
      Overrides:
      getNativeSql in class SimpleQuery
      Returns:
      SQL in native for database format
    • buildNativeSql

      private String buildNativeSql(ParameterList params)
    • toString

      public 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 interface Query
      Overrides:
      toString in class SimpleQuery
      Parameters:
      params - a ParameterList returned by this Query's Query.createParameterList() method, or null to leave the parameter placeholders unsubstituted.
      Returns:
      a human-readable representation of this query