Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.wire.version11

# Class V11Statement

java.lang.Object
org.firebirdsql.gds.ng.AbstractFbStatement
org.firebirdsql.gds.ng.wire.AbstractFbWireStatement
org.firebirdsql.gds.ng.wire.version10.V10Statement
org.firebirdsql.gds.ng.wire.version11.V11Statement

All Implemented Interfaces:
  `AutoCloseable`, `FbStatement`, `ExceptionListenable`, `FbWireStatement`

Direct Known Subclasses:
  `V12Statement`

public class V11Statement extends V10Statement
`FbWireStatement` implementation for the version 11 wire protocol.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected AsyncFetchStatus`
  `asyncFetchStatus`

  ### Fields inherited from class org.firebirdsql.gds.ng.AbstractFbStatement

  `exceptionListenerDispatcher, statementListenerDispatcher`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `V11Statement(FbWireDatabase database)`
  Creates a new instance of V11Statement for the specified database.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `final void`
  `asyncFetchRows(int fetchSize)`
  Requests the server to perform an asynchronous fetch for `fetch size`.
  `protected boolean`
  `completeAsyncFetch()`
  Completes a pending async fetch.
  `void`
  `fetchRows(int fetchSize)`
  Requests this statement to fetch the next `fetchSize` rows.
  `protected void`
  `free(int option)`
  Frees the currently allocated statement.
  `void`
  `prepare(String statementText)`
  Prepare the statement text.
  `protected void`
  `reset(boolean resetAll)`
  Resets the statement for next execution.

  ### Methods inherited from class org.firebirdsql.gds.ng.wire.version10.V10Statement

  `doFreePacket, execute, getDefaultSqlInfoSize, getMaxSqlInfoSize, processAllocateResponse, processExecuteResponse, processExecuteSingletonResponse, processFetchResponse, processFetchResponse, processFreeResponse, processPrepareResponse, readColumnData, readSqlData, sendAllocate, sendExecute, sendFetch, sendFree, sendPrepare, setCursorNameImpl, writeColumnData, writeSqlData`

  ### Methods inherited from class org.firebirdsql.gds.ng.wire.AbstractFbWireStatement

  `calculateBlr, calculateBlr, close, emptyRowDescriptor, getBlrCalculator, getDatabase, getHandle, getInfo, getSqlInfo, getTransaction, getXdrIn, getXdrOut, handleInlineBlobResponse, isValidTransactionClass, setHandle, withLock, wrapDeferredResponse`

  ### Methods inherited from class org.firebirdsql.gds.ng.AbstractFbStatement

  `addExceptionListener, addStatementListener, addWeakStatementListener, checkFetchSize, checkPrepareAllowed, checkStatementHasOpenCursor, checkStatementValid, checkStatementValid, closeCursor, closeCursor, createExecutionPlanProcessor, createSqlCountProcessor, ensureClosedCursor, fetchScroll, fetchScrollImpl, forceState, getAllowedTimeout, getCursorInfo, getCursorInfo, getCursorInfoImpl, getCursorName, getExecutionPlan, getExplainedExecutionPlan, getParameterDescriptionInfoRequestItems, getParameterDescriptor, getRowDescriptor, getSqlCounts, getSqlInfo, getState, getStatementInfoRequestItems, getStatementWarningCallback, getTimeout, getTransactionListener, getType, hasFetched, hasFields, hasSingletonResult, isAfterLast, isBeforeFirst, isPrepareAllowed, parseStatementInfo, queueRowData, removeExceptionListener, removeStatementListener, reset, resetAll, setAfterLast, setBeforeFirst, setCursorName, setParameterDescriptor, setRowDescriptor, setTimeout, setTransaction, setType, signalAsyncFetchComplete, signalAsyncFetchStart, signalExecute, signalFetch, switchState, unprepare, validateParameters`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface org.firebirdsql.gds.ng.listeners.ExceptionListenable

  `addExceptionListener, removeExceptionListener`

  ### Methods inherited from interface org.firebirdsql.gds.ng.FbStatement

  `addStatementListener, addWeakStatementListener, batchCancel, batchExecute, clearCursorFlag, close, closeCursor, closeCursor, createBatchParameterBuffer, deferredBatchCreate, deferredBatchRelease, deferredBatchSend, emptyRowDescriptor, ensureClosedCursor, fetchScroll, getCursorInfo, getCursorInfo, getDatabase, getExecutionPlan, getExplainedExecutionPlan, getHandle, getParameterDescriptor, getRowDescriptor, getSqlCounts, getSqlInfo, getSqlInfo, getState, getTimeout, getTransaction, getType, hasFetched, isCursorFlagSet, removeStatementListener, setCursorFlag, setCursorName, setTimeout, setTransaction, supportBatchUpdates, supportsCursorInfo, supportsFetchScroll, unprepare, validateParameters, withLock`

- ## Field Details

  - ### asyncFetchStatus

    protected AsyncFetchStatus asyncFetchStatus

- ## Constructor Details

  - ### V11Statement

    public V11Statement(FbWireDatabase database)
    Creates a new instance of V11Statement for the specified database.
    Parameters:
      `database` - FbWireDatabase implementation

- ## Method Details

  - ### prepare

    public void prepare(String statementText) throws SQLException
    Description copied from interface: `FbStatement`
    Prepare the statement text.

    If this handle is in state `StatementState.NEW` then it will first allocate the statement.

    Specified by:
      `prepare` in interface `FbStatement`
    Overrides:
      `prepare` in class `V10Statement`
    Parameters:
      `statementText` - Statement text
    Throws:
      `SQLException` - If a database access error occurs, or this statement is currently executing a query.

  - ### fetchRows

    public void fetchRows(int fetchSize) throws SQLException
    Description copied from interface: `FbStatement`
    Requests this statement to fetch the next `fetchSize` rows.

    Fetched rows are not returned from this method, but sent to the registered `StatementListener` instances.

    If an asynchronous fetch is pending, that pending fetch should be completed instead of performing a new fetch.

    Specified by:
      `fetchRows` in interface `FbStatement`
    Overrides:
      `fetchRows` in class `V10Statement`
    Parameters:
      `fetchSize` - Number of rows to fetch (must be greater than `0`)
    Throws:
      `SQLException` - For database access errors, when called on a closed statement, when no cursor is open or when the fetch size is not greater than `0`
    See Also:
      - `FbStatement.asyncFetchRows(int)`

  - ### asyncFetchRows

    public final void asyncFetchRows(int fetchSize) throws SQLException
    Description copied from interface: `FbStatement`
    Requests the server to perform an asynchronous fetch for `fetch size`.

    Asynchronous fetching is an optional feature. If an implementation does not support asynchronous fetching, it should return immediately and do nothing. Although this interface provides a default implementation which does nothing, implementations should override it, to throw an exception when called on a closed statement.

    For implementations which do support async fetching, this call should not do anything if one of the following is true:

    - an asynchronous fetch is already pending
    - `fetchSize` is `1` or the statement has a cursor name set
    - the current statement has a scrollable cursor (flag `CURSOR_TYPE_SCROLLABLE` set)
    - the connection property `asyncFetch` is `false`

    An asynchronous fetch can be completed explicitly by calling `FbStatement.fetchRows(int)`, or implicitly by other network operations.

    Specified by:
      `asyncFetchRows` in interface `FbStatement`
    Overrides:
      `asyncFetchRows` in class `AbstractFbStatement`
    Parameters:
      `fetchSize` - number of rows to fetch (must be greater than `0`)
    Throws:
      `SQLException` - for database access errors, when called on a closed statement, when no cursor is open or when the fetch size is not greater than `0`
    See Also:
      - `FbStatement.fetchRows(int)`

  - ### completeAsyncFetch

    protected boolean completeAsyncFetch() throws SQLException
    Completes a pending async fetch.
    Returns:
      `true` if a pending async fetch was processed, `false` if there was no pending async fetch.
    Throws:
      `SQLException` - from unsuccessfully completed async fetch, or for errors try to complete deferred actions
    Since:
      6

  - ### free

    protected void free(int option) throws SQLException
    Description copied from class: `AbstractFbStatement`
    Frees the currently allocated statement. Either close the cursor with `ISCConstants.DSQL_close` or drop the statement handle using `ISCConstants.DSQL_drop`.
    Overrides:
      `free` in class `V10Statement`
    Parameters:
      `option` - Free option
    Throws:
      `SQLException`

  - ### reset

    protected void reset(boolean resetAll)
    Description copied from class: `AbstractFbStatement`
    Resets the statement for next execution. Implementation in derived class must lock on `FbStatement.withLock()` and call `super.reset(resetAll)`
    Overrides:
      `reset` in class `AbstractFbStatement`
    Parameters:
      `resetAll` - Also reset field and parameter info