class SimpleQuery extends java.lang.Object implements Query
Modifier and Type | Field and Description |
---|---|
private java.lang.Integer |
cachedMaxResultRowSize |
private java.lang.ref.PhantomReference<?> |
cleanupRef |
private short |
deallocateEpoch |
private byte[] |
encodedStatementName |
private Field[] |
fields
The stored fields from previous execution or describe of a prepared statement.
|
private boolean |
hasBinaryFields |
private static java.util.logging.Logger |
LOGGER |
private NativeQuery |
nativeQuery |
private boolean |
needUpdateFieldFormats |
(package private) static SimpleParameterList |
NO_PARAMETERS |
private boolean |
portalDescribed |
private int[] |
preparedTypes |
private java.util.Map<java.lang.String,java.lang.Integer> |
resultSetColumnNameIndexMap |
private boolean |
sanitiserDisabled |
private boolean |
statementDescribed |
private java.lang.String |
statementName |
private TypeTransferModeRegistry |
transferModeRegistry |
private java.util.BitSet |
unspecifiedParams |
Constructor and Description |
---|
SimpleQuery(NativeQuery query,
TypeTransferModeRegistry transferModeRegistry,
boolean sanitiserDisabled) |
SimpleQuery(SimpleQuery src) |
Modifier and Type | Method and 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.
|
int |
getBindCount() |
(package private) byte[] |
getEncodedStatementName() |
(package private) Field[] |
getFields()
Returns the fields that this query will return.
|
int |
getMaxResultRowSize()
Return maximum size in bytes that each result row from this query may return.
|
(package private) NativeQuery |
getNativeQuery() |
java.lang.String |
getNativeSql()
Returns SQL in native for database format.
|
(package private) int[] |
getPrepareTypes() |
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).
|
(package private) java.lang.String |
getStatementName() |
SimpleQuery[] |
getSubqueries()
Return a list of the Query objects that make up this query.
|
boolean |
hasBinaryFields() |
(package private) boolean |
hasUnresolvedTypes() |
boolean |
isEmpty() |
(package private) boolean |
isPortalDescribed() |
(package private) boolean |
isPreparedFor(int[] paramTypes,
short deallocateEpoch) |
boolean |
isStatementDescribed() |
(package private) boolean |
needUpdateFieldFormats()
Returns true if current query needs field formats be adjusted as per connection configuration.
|
void |
resetNeedUpdateFieldFormats() |
(package private) void |
setCleanupRef(java.lang.ref.PhantomReference<?> cleanupRef) |
(package private) void |
setFields(Field[] fields)
Sets the fields that this query will return.
|
void |
setHasBinaryFields(boolean hasBinaryFields) |
(package private) void |
setPortalDescribed(boolean portalDescribed) |
(package private) void |
setPrepareTypes(int[] paramTypes) |
(package private) void |
setStatementDescribed(boolean statementDescribed) |
(package private) void |
setStatementName(java.lang.String statementName,
short deallocateEpoch) |
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.
|
(package private) void |
unprepare() |
private static final java.util.logging.Logger LOGGER
private java.util.Map<java.lang.String,java.lang.Integer> resultSetColumnNameIndexMap
private final NativeQuery nativeQuery
private final TypeTransferModeRegistry transferModeRegistry
private java.lang.String statementName
private byte[] encodedStatementName
private Field[] fields
private boolean needUpdateFieldFormats
private boolean hasBinaryFields
private boolean portalDescribed
private boolean statementDescribed
private final boolean sanitiserDisabled
private java.lang.ref.PhantomReference<?> cleanupRef
private int[] preparedTypes
private java.util.BitSet unspecifiedParams
private short deallocateEpoch
private java.lang.Integer cachedMaxResultRowSize
static final SimpleParameterList NO_PARAMETERS
SimpleQuery(SimpleQuery src)
SimpleQuery(NativeQuery query, TypeTransferModeRegistry transferModeRegistry, boolean sanitiserDisabled)
public ParameterList createParameterList()
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.
createParameterList
in interface Query
public java.lang.String toString(ParameterList parameters)
Query
toString
in interface Query
parameters
- a ParameterList returned by this Query's Query.createParameterList()
method,
or null
to leave the parameter placeholders unsubstituted.public java.lang.String toString()
toString
in class java.lang.Object
public void close()
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.
public SimpleQuery[] getSubqueries()
Query
getSubqueries
in interface Query
null
if this object is already a
single-statement query.public int getMaxResultRowSize()
Return maximum size in bytes that each result row from this query may return. Mainly used for batches that return results.
Results are cached until/unless the query is re-described.
java.lang.IllegalStateException
- if the query is not describedpublic java.lang.String getNativeSql()
Query
getNativeSql
in interface Query
void setStatementName(java.lang.String statementName, short deallocateEpoch)
void setPrepareTypes(int[] paramTypes)
int[] getPrepareTypes()
java.lang.String getStatementName()
boolean isPreparedFor(int[] paramTypes, short deallocateEpoch)
boolean hasUnresolvedTypes()
byte[] getEncodedStatementName()
void setFields(Field[] fields)
fields
- The fields that this query will return.Field[] getFields()
boolean needUpdateFieldFormats()
false
. The idea is to perform adjustments only
once, not for each
QueryExecutorImpl.sendBind(SimpleQuery, SimpleParameterList, Portal, boolean)
.public void resetNeedUpdateFieldFormats()
public boolean hasBinaryFields()
public void setHasBinaryFields(boolean hasBinaryFields)
boolean isPortalDescribed()
void setPortalDescribed(boolean portalDescribed)
public boolean isStatementDescribed()
isStatementDescribed
in interface Query
void setStatementDescribed(boolean statementDescribed)
void setCleanupRef(java.lang.ref.PhantomReference<?> cleanupRef)
void unprepare()
public int getBatchSize()
Query
getBatchSize
in interface Query
addBatch()
has been called.NativeQuery getNativeQuery()
public final int getBindCount()
public java.util.Map<java.lang.String,java.lang.Integer> getResultSetColumnNameIndexMap()
Query
getResultSetColumnNameIndexMap
in interface Query
public SqlCommand getSqlCommand()
Query
getSqlCommand
in interface Query