Class CompositeQuery

  • All Implemented Interfaces:
    Query

    class CompositeQuery
    extends java.lang.Object
    implements Query
    V3 Query implementation for queries that involve multiple statements. We split it up into one SimpleQuery per statement, and wrap the corresponding per-statement SimpleParameterList objects in a CompositeParameterList.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void close()
      Close this query and free any server-side resources associated with it.
      ParameterList createParameterList()
      Create a ParameterList suitable for storing parameters associated with this Query.
      int getBatchSize()
      Get the number of times this Query has been batched.
      java.lang.String getNativeSql()
      Returns SQL in native for database format.
      java.util.Map<java.lang.String,​java.lang.Integer> getResultSetColumnNameIndexMap()
      Get a map that a result set can use to find the index associated to a name.
      SqlCommand getSqlCommand()
      Returns properties of the query (sql keyword, and some other parsing info).
      Query[] getSubqueries()
      Return a list of the Query objects that make up this query.
      boolean isEmpty()  
      boolean isStatementDescribed()  
      java.lang.String toString()  
      java.lang.String toString​(ParameterList parameters)
      Stringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Field Detail

      • offsets

        private final int[] offsets
    • Constructor Detail

      • CompositeQuery

        CompositeQuery​(SimpleQuery[] subqueries,
                       int[] offsets)
    • Method Detail

      • createParameterList

        public ParameterList createParameterList()
        Description copied from interface: Query

        Create a ParameterList suitable for storing parameters associated with this Query.

        If this query has no parameters, a ParameterList will be returned, but it may be a shared immutable object. If this query does have parameters, the returned ParameterList is a new list, unshared by other callers.

        Specified by:
        createParameterList in interface Query
        Returns:
        a suitable ParameterList instance for this query
      • toString

        public java.lang.String toString​(ParameterList parameters)
        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
        Parameters:
        parameters - 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
      • getNativeSql

        public java.lang.String getNativeSql()
        Description copied from interface: Query
        Returns SQL in native for database format.
        Specified by:
        getNativeSql in interface Query
        Returns:
        SQL in native for database format
      • getSqlCommand

        public SqlCommand getSqlCommand()
        Description copied from interface: Query
        Returns properties of the query (sql keyword, and some other parsing info).
        Specified by:
        getSqlCommand in interface Query
        Returns:
        returns properties of the query (sql keyword, and some other parsing info) or null if not applicable
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • close

        public void close()
        Description copied from interface: Query

        Close this query and free any server-side resources associated with it. The resources may not be immediately deallocated, but closing a Query may make the deallocation more prompt.

        A closed Query should not be executed.

        Specified by:
        close in interface Query
      • getSubqueries

        public Query[] getSubqueries()
        Description copied from interface: Query
        Return a list of the Query objects that make up this query. If this object is already a SimpleQuery, returns null (avoids an extra array construction in the common case).
        Specified by:
        getSubqueries in interface Query
        Returns:
        an array of single-statement queries, or null if this object is already a single-statement query.
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface Query
      • 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
        Returns:
        number of times addBatch() has been called.
      • getResultSetColumnNameIndexMap

        public java.util.Map<java.lang.String,​java.lang.Integer> getResultSetColumnNameIndexMap()
        Description copied from interface: Query
        Get a map that a result set can use to find the index associated to a name.
        Specified by:
        getResultSetColumnNameIndexMap in interface Query
        Returns:
        null if the query implementation does not support this method.