Top Description Methods
org.postgresql.core

public Interface Query

Known Direct Implementers
org.postgresql.core.v3.CompositeQuery, org.postgresql.core.v3.SimpleQuery
Imports
org.checkerframework.checker.nullness.qual.Nullable, java.util.Map

Abstraction of a generic Query, hiding the details of any protocol-version-specific data needed to execute the query efficiently.

Query objects should be explicitly closed when no longer needed; if resources are allocated on the server for this query, their cleanup is triggered by closing the Query.

Author
Oliver Jowett ([email protected])

Method Summary

Modifier and TypeMethod and Description
public void
close()

Close this query and free any server-side resources associated with it.

public ParameterList

Returns:

a suitable ParameterList instance for this query
createParameterList
()

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

public int

Returns:

number of times addBatch() has been called.
getBatchSize
()

Get the number of times this Query has been batched.

public String

Returns:

SQL in native for database format
getNativeSql
()

Returns SQL in native for database format.

public @Nullable Map<String, Integer>

Returns:

null if the query implementation does not support this method.
getResultSetColumnNameIndexMap
()

Get a map that a result set can use to find the index associated to a name.

public @Nullable SqlCommand

Returns:

returns properties of the query (sql keyword, and some other parsing info) or null if not applicable
getSqlCommand
()

Returns properties of the query (sql keyword, and some other parsing info).

public @Nullable Query[]

Returns:

an array of single-statement queries, or null if this object is already a single-statement query.
getSubqueries
()

Return a list of the Query objects that make up this query.

public boolean
public boolean
public String

Returns:

a human-readable representation of this query
toString
(@Nullable ParameterList
a ParameterList returned by this Query's createParameterList method, or null to leave the parameter placeholders unsubstituted.
parameters
)

Stringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.

Method Detail

closeback to summary
public void close()

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.

createParameterListback to summary
public ParameterList createParameterList()

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.

Returns:ParameterList

a suitable ParameterList instance for this query

getBatchSizeback to summary
public int getBatchSize()

Get the number of times this Query has been batched.

Returns:int

number of times addBatch() has been called.

getNativeSqlback to summary
public String getNativeSql()

Returns SQL in native for database format.

Returns:String

SQL in native for database format

getResultSetColumnNameIndexMapback to summary
public @Nullable Map<String, Integer> getResultSetColumnNameIndexMap()

Get a map that a result set can use to find the index associated to a name.

Returns:@Nullable Map<String, Integer>

null if the query implementation does not support this method.

getSqlCommandback to summary
public @Nullable SqlCommand getSqlCommand()

Returns properties of the query (sql keyword, and some other parsing info).

Returns:@Nullable SqlCommand

returns properties of the query (sql keyword, and some other parsing info) or null if not applicable

getSubqueriesback to summary
public @Nullable Query[] getSubqueries()

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).

Returns:@Nullable Query[]

an array of single-statement queries, or null if this object is already a single-statement query.

isEmptyback to summary
public boolean isEmpty()
isStatementDescribedback to summary
public boolean isStatementDescribed()
toStringback to summary
public String toString(@Nullable ParameterList parameters)

Stringize this query to a human-readable form, substituting particular parameter values for parameter placeholders.

Parameters
parameters:@Nullable ParameterList

a ParameterList returned by this Query's createParameterList method, or null to leave the parameter placeholders unsubstituted.

Returns:String

a human-readable representation of this query