Package org.postgresql.core.v3
Class CompositeQuery
java.lang.Object
org.postgresql.core.v3.CompositeQuery
- All Implemented Interfaces:
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close this query and free any server-side resources associated with it.Create a ParameterList suitable for storing parameters associated with this Query.int
Get the number of times this Query has been batched.Returns SQL in native for database format.Get a map that a result set can use to find the index associated to a name.Returns properties of the query (sql keyword, and some other parsing info).Query[]
Return a list of the Query objects that make up this query.boolean
isEmpty()
boolean
toString()
toString
(ParameterList parameters) Returns string representation of the query, substituting particular parameter values for parameter placeholders.toString
(ParameterList parameters, SqlSerializationContext context) Returns string representation of the query, substituting particular parameter values for parameter placeholders.
-
Field Details
-
subqueries
-
offsets
private final int[] offsets
-
-
Constructor Details
-
CompositeQuery
CompositeQuery(SimpleQuery[] subqueries, int[] offsets)
-
-
Method Details
-
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 interfaceQuery
- Returns:
- a suitable ParameterList instance for this query
-
toString
Description copied from interface:Query
Returns string representation of the query, substituting particular parameter values for parameter placeholders.Note: the method replaces the values on a best-effort basis as it might omit the replacements for parameters that can't be processed several times. For instance,
InputStream
can be processed only once.- Specified by:
toString
in interfaceQuery
- Parameters:
parameters
- a ParameterList returned by this Query'sQuery.createParameterList()
method, ornull
to leave the parameter placeholders unsubstituted.- Returns:
- string representation of this query
-
toString
Description copied from interface:Query
Returns string representation of the query, substituting particular parameter values for parameter placeholders.- Specified by:
toString
in interfaceQuery
- Parameters:
parameters
- a ParameterList returned by this Query'sQuery.createParameterList()
method, ornull
to leave the parameter placeholders unsubstituted.context
- specifies configuration for converting the parameters to string- Returns:
- string representation of this query
-
getNativeSql
Description copied from interface:Query
Returns SQL in native for database format.- Specified by:
getNativeSql
in interfaceQuery
- Returns:
- SQL in native for database format
-
getSqlCommand
Description copied from interface:Query
Returns properties of the query (sql keyword, and some other parsing info).- Specified by:
getSqlCommand
in interfaceQuery
- Returns:
- returns properties of the query (sql keyword, and some other parsing info) or null if not applicable
-
toString
-
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.
-
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 interfaceQuery
- Returns:
- an array of single-statement queries, or
null
if this object is already a single-statement query.
-
isStatementDescribed
public boolean isStatementDescribed()- Specified by:
isStatementDescribed
in interfaceQuery
-
isEmpty
public boolean isEmpty() -
getBatchSize
public int getBatchSize()Description copied from interface:Query
Get the number of times this Query has been batched.- Specified by:
getBatchSize
in interfaceQuery
- Returns:
- number of times
addBatch()
has been called.
-
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 interfaceQuery
- Returns:
- null if the query implementation does not support this method.
-