|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.postgresql.core.v3.QueryExecutorImpl
public class QueryExecutorImpl
QueryExecutor implementation for the V3 protocol.
| Field Summary |
|---|
| Fields inherited from interface org.postgresql.core.QueryExecutor |
|---|
QUERY_BOTH_ROWS_AND_STATUS, QUERY_DESCRIBE_ONLY, QUERY_DISALLOW_BATCHING, QUERY_FORCE_DESCRIBE_PORTAL, QUERY_FORWARD_CURSOR, QUERY_NO_BINARY_TRANSFER, QUERY_NO_METADATA, QUERY_NO_RESULTS, QUERY_ONESHOT, QUERY_SUPPRESS_BEGIN |
| Constructor Summary | |
|---|---|
QueryExecutorImpl(org.postgresql.core.v3.ProtocolConnectionImpl protoConnection,
PGStream pgStream,
Properties info,
Logger logger)
|
|
| Method Summary | |
|---|---|
void |
cancelCopy(CopyOperationImpl op)
Finishes a copy operation and unlocks connection discarding any exchanged data. |
ParameterList |
createFastpathParameters(int count)
Create a new ParameterList implementation suitable for invoking a fastpath function via QueryExecutor.fastpathCall(int, org.postgresql.core.ParameterList, boolean). |
Query |
createParameterizedQuery(String sql)
Create a parameterized Query object suitable for execution by this QueryExecutor. |
Query |
createSimpleQuery(String sql)
Create an unparameterized Query object suitable for execution by this QueryExecutor. |
void |
doSubprotocolBegin()
|
long |
endCopy(CopyInImpl op)
Finishes writing to copy and unlocks connection |
void |
execute(Query[] queries,
ParameterList[] parameterLists,
BatchResultHandler batchHandler,
int maxRows,
int fetchSize,
int flags)
Execute several Query, passing results to a provided ResultHandler. |
void |
execute(Query query,
ParameterList parameters,
ResultHandler handler,
int maxRows,
int fetchSize,
int flags)
Execute a Query, passing results to a provided ResultHandler. |
byte[] |
fastpathCall(int fnid,
ParameterList parameters,
boolean suppressBegin)
Invoke a backend function via the fastpath interface. |
void |
fetch(ResultCursor cursor,
ResultHandler handler,
int fetchSize)
Fetch additional rows from a cursor. |
void |
flushCopy(CopyInImpl op)
|
void |
processNotifies()
Prior to attempting to retrieve notifications, we need to pull any recently received notifications off of the network buffers. |
protected void |
processResults(ResultHandler handler,
int flags)
|
CopyOperation |
startCopy(String sql,
boolean suppressBegin)
Sends given query to BE to start, initialize and lock connection for a CopyOperation. |
void |
writeToCopy(CopyInImpl op,
byte[] data,
int off,
int siz)
Sends data during a live COPY IN operation. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public QueryExecutorImpl(org.postgresql.core.v3.ProtocolConnectionImpl protoConnection,
PGStream pgStream,
Properties info,
Logger logger)
| Method Detail |
|---|
public Query createSimpleQuery(String sql)
QueryExecutorQuery.createParameterList() of the returned object will always return an empty
ParameterList.
createSimpleQuery in interface QueryExecutorsql - the SQL for the query to create
public Query createParameterizedQuery(String sql)
QueryExecutorQuery.createParameterList() of the returned object will create an appropriately-sized
ParameterList.
createParameterizedQuery in interface QueryExecutorsql - the SQL for the query to create, with '?' placeholders for parameters.
public void execute(Query query,
ParameterList parameters,
ResultHandler handler,
int maxRows,
int fetchSize,
int flags)
throws SQLException
QueryExecutor
execute in interface QueryExecutorquery - the query to execute; must be a query returned from calling
QueryExecutor.createSimpleQuery(String) or QueryExecutor.createParameterizedQuery(String) on this
QueryExecutor object.parameters - the parameters for the query. Must be non-null if the query
takes parameters. Must be a parameter object returned by
Query.createParameterList().handler - a ResultHandler responsible for handling results generated by this querymaxRows - the maximum number of rows to retrievefetchSize - if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve
before suspendingflags - a combination of QUERY_* flags indicating how to handle the query.
SQLException - if query execution fails
public void execute(Query[] queries,
ParameterList[] parameterLists,
BatchResultHandler batchHandler,
int maxRows,
int fetchSize,
int flags)
throws SQLException
QueryExecutor
execute in interface QueryExecutorqueries - the queries to execute; each must be a query returned from calling
QueryExecutor.createSimpleQuery(String) or QueryExecutor.createParameterizedQuery(String) on this
QueryExecutor object.parameterLists - the parameter lists for the queries. The parameter lists correspond 1:1
to the queries passed in the queries array. Each must be non-
null if the corresponding query takes parameters, and must be a parameter
object returned by Query.createParameterList() created by
the corresponding query.batchHandler - a ResultHandler responsible for handling results generated by this querymaxRows - the maximum number of rows to retrievefetchSize - if QUERY_FORWARD_CURSOR is set, the preferred number of rows to retrieve
before suspendingflags - a combination of QUERY_* flags indicating how to handle the query.
SQLException - if query execution fails
public byte[] fastpathCall(int fnid,
ParameterList parameters,
boolean suppressBegin)
throws SQLException
QueryExecutor
fastpathCall in interface QueryExecutorfnid - the OID of the backend function to invokeparameters - a ParameterList returned from QueryExecutor.createFastpathParameters(int) containing the
parameters to pass to the backend functionsuppressBegin - if begin should be suppressed
null if a void result
was returned
SQLException - if an error occurs while executing the fastpath call
public void doSubprotocolBegin()
throws SQLException
SQLExceptionpublic ParameterList createFastpathParameters(int count)
QueryExecutorQueryExecutor.fastpathCall(int, org.postgresql.core.ParameterList, boolean).
createFastpathParameters in interface QueryExecutorcount - the number of parameters the fastpath call will take
QueryExecutor.fastpathCall(int, org.postgresql.core.ParameterList, boolean).
public void processNotifies()
throws SQLException
QueryExecutor
processNotifies in interface QueryExecutorSQLException - if and error occurs while fetching notifications
public CopyOperation startCopy(String sql,
boolean suppressBegin)
throws SQLException
startCopy in interface QueryExecutorsql - COPY FROM STDIN / COPY TO STDOUT statementsuppressBegin - if begin should be suppressed
SQLException - on failure
public void cancelCopy(CopyOperationImpl op)
throws SQLException
op - the copy operation presumably currently holding lock on this connection
SQLException - on any additional failure
public long endCopy(CopyInImpl op)
throws SQLException
op - the copy operation presumably currently holding lock on this connection
SQLException - on failure
public void writeToCopy(CopyInImpl op,
byte[] data,
int off,
int siz)
throws SQLException
op - the CopyIn operation presumably currently holding lock on this connectiondata - bytes to sendoff - index of first byte to send (usually 0)siz - number of bytes to send (usually data.length)
SQLException - on failure
public void flushCopy(CopyInImpl op)
throws SQLException
SQLException
protected void processResults(ResultHandler handler,
int flags)
throws IOException
IOException
public void fetch(ResultCursor cursor,
ResultHandler handler,
int fetchSize)
throws SQLException
QueryExecutor
fetch in interface QueryExecutorcursor - the cursor to fetch fromhandler - the handler to feed results tofetchSize - the preferred number of rows to retrieve before suspending
SQLException - if query execution fails
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||