Class JnaStatement

java.lang.Object
org.firebirdsql.gds.ng.AbstractFbStatement
org.firebirdsql.gds.ng.jna.JnaStatement
All Implemented Interfaces:
AutoCloseable, org.firebirdsql.gds.ng.FbStatement, org.firebirdsql.gds.ng.listeners.ExceptionListenable

public class JnaStatement extends org.firebirdsql.gds.ng.AbstractFbStatement
Implementation of FbStatement for native client access.
Since:
3.0
Author:
Mark Rotteveel
  • Field Summary

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

    exceptionListenerDispatcher, statementListenerDispatcher
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected XSQLDA
    allocateXSqlDa(org.firebirdsql.gds.ng.fields.RowDescriptor rowDescriptor)
    Creates an XSQLDA, populates type information and allocates memory for the sqldata fields.
    final org.firebirdsql.gds.ng.fields.RowDescriptor
     
    void
    execute(org.firebirdsql.gds.ng.fields.RowValue parameters)
     
    void
    fetchRows(int fetchSize)
    protected void
    free(int option)
     
     
    int
     
    int
     
    int
     
    byte[]
    getSqlInfo(byte[] requestItems, int bufferLength)
     
     
    protected boolean
    isValidTransactionClass(Class<? extends org.firebirdsql.gds.ng.FbTransaction> transactionClass)
     
    void
    prepare(String statementText)
     
    protected void
     
    protected void
    setParameterDescriptor(org.firebirdsql.gds.ng.fields.RowDescriptor parameterDescriptor)
     
    protected void
    setRowDescriptor(org.firebirdsql.gds.ng.fields.RowDescriptor fieldDescriptor)
     
    protected void
    setXSqlDaData(XSQLDA xSqlDa, org.firebirdsql.gds.ng.fields.RowDescriptor rowDescriptor, org.firebirdsql.gds.ng.fields.RowValue parameters)
    Populates an XSQLDA from the row descriptor and parameter values.
    protected org.firebirdsql.gds.ng.fields.RowValue
    toRowValue(org.firebirdsql.gds.ng.fields.RowDescriptor rowDescriptor, XSQLDA xSqlDa)
    Converts the data from an XSQLDA to a RowValue.
    final org.firebirdsql.gds.ng.LockCloseable
     

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

    addExceptionListener, addStatementListener, addWeakStatementListener, asyncFetchRows, checkFetchSize, checkPrepareAllowed, checkStatementHasOpenCursor, checkStatementValid, checkStatementValid, close, 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, reset, resetAll, setAfterLast, setBeforeFirst, setCursorName, 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.FbStatement

    batchCancel, batchExecute, clearCursorFlag, createBatchParameterBuffer, deferredBatchCreate, deferredBatchRelease, deferredBatchSend, isCursorFlagSet, setCursorFlag, supportBatchUpdates, supportsCursorInfo, supportsFetchScroll
  • Constructor Details

    • JnaStatement

      public JnaStatement(JnaDatabase database)
  • Method Details

    • withLock

      public final org.firebirdsql.gds.ng.LockCloseable withLock()
    • setParameterDescriptor

      protected void setParameterDescriptor(org.firebirdsql.gds.ng.fields.RowDescriptor parameterDescriptor)
      Overrides:
      setParameterDescriptor in class org.firebirdsql.gds.ng.AbstractFbStatement
    • setRowDescriptor

      protected void setRowDescriptor(org.firebirdsql.gds.ng.fields.RowDescriptor fieldDescriptor)
      Overrides:
      setRowDescriptor in class org.firebirdsql.gds.ng.AbstractFbStatement
    • free

      protected void free(int option) throws SQLException
      Specified by:
      free in class org.firebirdsql.gds.ng.AbstractFbStatement
      Throws:
      SQLException
    • isValidTransactionClass

      protected boolean isValidTransactionClass(Class<? extends org.firebirdsql.gds.ng.FbTransaction> transactionClass)
      Specified by:
      isValidTransactionClass in class org.firebirdsql.gds.ng.AbstractFbStatement
    • getDatabase

      public JnaDatabase getDatabase()
    • getHandle

      public int getHandle()
    • getTransaction

      public JnaTransaction getTransaction()
      Specified by:
      getTransaction in interface org.firebirdsql.gds.ng.FbStatement
      Overrides:
      getTransaction in class org.firebirdsql.gds.ng.AbstractFbStatement
    • prepare

      public void prepare(String statementText) throws SQLException
      Throws:
      SQLException
    • execute

      public void execute(org.firebirdsql.gds.ng.fields.RowValue parameters) throws SQLException
      Throws:
      SQLException
    • setXSqlDaData

      protected void setXSqlDaData(XSQLDA xSqlDa, org.firebirdsql.gds.ng.fields.RowDescriptor rowDescriptor, org.firebirdsql.gds.ng.fields.RowValue parameters)
      Populates an XSQLDA from the row descriptor and parameter values.
      Parameters:
      xSqlDa - XSQLDA
      rowDescriptor - Row descriptor
      parameters - Parameter values
    • allocateXSqlDa

      protected XSQLDA allocateXSqlDa(org.firebirdsql.gds.ng.fields.RowDescriptor rowDescriptor)
      Creates an XSQLDA, populates type information and allocates memory for the sqldata fields.
      Parameters:
      rowDescriptor - The row descriptor
      Returns:
      Allocated XSQLDA without data
    • toRowValue

      protected org.firebirdsql.gds.ng.fields.RowValue toRowValue(org.firebirdsql.gds.ng.fields.RowDescriptor rowDescriptor, XSQLDA xSqlDa)
      Converts the data from an XSQLDA to a RowValue.
      Parameters:
      rowDescriptor - Row descriptor
      xSqlDa - XSQLDA
      Returns:
      Row value
    • fetchRows

      public void fetchRows(int fetchSize) throws SQLException

      The JNA implementation ignores the specified fetchSize to prevent problems with - for example - positioned updates with named cursors. For the wire protocol that case is handled by the server ignoring the fetch size. Internally the native fetch will batch a number of records, but the number is outside our control.

      Throws:
      SQLException
    • getSqlInfo

      public byte[] getSqlInfo(byte[] requestItems, int bufferLength) throws SQLException
      Throws:
      SQLException
    • getDefaultSqlInfoSize

      public int getDefaultSqlInfoSize()
    • getMaxSqlInfoSize

      public int getMaxSqlInfoSize()
    • setCursorNameImpl

      protected void setCursorNameImpl(String cursorName) throws SQLException
      Specified by:
      setCursorNameImpl in class org.firebirdsql.gds.ng.AbstractFbStatement
      Throws:
      SQLException
    • emptyRowDescriptor

      public final org.firebirdsql.gds.ng.fields.RowDescriptor emptyRowDescriptor()