Class V10Statement

    • Constructor Detail

      • V10Statement

        public V10Statement​(FbWireDatabase database)
        Creates a new instance of V10Statement for the specified database.
        Parameters:
        database - FbWireDatabase implementation
    • Method Detail

      • doFreePacket

        protected void doFreePacket​(int option)
                             throws java.sql.SQLException,
                                    java.io.IOException
        Handles sending the free statement packet and associated state changes on this statement
        Parameters:
        option - free statement option
        Throws:
        java.sql.SQLException
        java.io.IOException
      • sendFree

        protected void sendFree​(int option)
                         throws java.io.IOException,
                                java.sql.SQLException
        Sends the free statement to the database
        Parameters:
        option - Free statement option
        Throws:
        java.io.IOException
        java.sql.SQLException
      • processFreeResponse

        protected void processFreeResponse​(Response response)
        Processes the response to the free statement.
        Parameters:
        response - Response object
      • prepare

        public void prepare​(java.lang.String statementText)
                     throws java.sql.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
        Parameters:
        statementText - Statement text
        Throws:
        java.sql.SQLException - If a database access error occurs, or this statement is currently executing a query.
      • sendPrepare

        protected void sendPrepare​(java.lang.String statementText)
                            throws java.sql.SQLException,
                                   java.io.IOException
        Sends the statement prepare to the connection.
        Parameters:
        statementText - Statement
        Throws:
        java.sql.SQLException
        java.io.IOException
      • processPrepareResponse

        protected void processPrepareResponse​(GenericResponse genericResponse)
                                       throws java.sql.SQLException
        Processes the prepare response from the server.
        Parameters:
        genericResponse - GenericResponse
        Throws:
        java.sql.SQLException
      • setCursorName

        public void setCursorName​(java.lang.String cursorName)
                           throws java.sql.SQLException
        Description copied from interface: FbStatement
        Sets the named cursor name for this statement.
        Specified by:
        setCursorName in interface FbStatement
        Parameters:
        cursorName - Name of the cursor
        Throws:
        java.sql.SQLException - If this statement is closed, TODO: Other reasons (eg cursor open)?
      • execute

        public void execute​(RowValue parameters)
                     throws java.sql.SQLException
        Description copied from interface: FbStatement
        Execute the statement.
        Specified by:
        execute in interface FbStatement
        Parameters:
        parameters - The list of parameter values to use for execution.
        Throws:
        java.sql.SQLException - When the number of type of parameters does not match the types returned by FbStatement.getParameterDescriptor(), a parameter value was not set, or when an error occurred executing this statement.
      • sendExecute

        protected void sendExecute​(int operation,
                                   RowValue parameters)
                            throws java.io.IOException,
                                   java.sql.SQLException
        Sends the execute (for op_execute or op_execute2) to the database.
        Parameters:
        operation - Operation (op_execute or op_execute2)
        parameters - Parameters
        Throws:
        java.io.IOException
        java.sql.SQLException
      • processExecuteSingletonResponse

        protected void processExecuteSingletonResponse​(SqlResponse sqlResponse)
                                                throws java.sql.SQLException,
                                                       java.io.IOException
        Process the execute response for statements with a singleton response (op_execute2; stored procedures).
        Parameters:
        sqlResponse - SQL response object
        Throws:
        java.sql.SQLException
        java.io.IOException
      • processExecuteResponse

        protected void processExecuteResponse​(GenericResponse genericResponse)
        Process the execute response.
        Parameters:
        genericResponse - Generic response object
      • fetchRows

        public void fetchRows​(int fetchSize)
                       throws java.sql.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.

        Specified by:
        fetchRows in interface FbStatement
        Parameters:
        fetchSize - Number of rows to fetch (must be greater than 0)
        Throws:
        java.sql.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.
      • processFetchResponse

        protected void processFetchResponse​(FetchDirection direction)
                                     throws java.io.IOException,
                                            java.sql.SQLException
        Process the fetch response by reading the returned rows and queuing them.
        Parameters:
        direction - fetch direction
        Throws:
        java.io.IOException
        java.sql.SQLException
      • sendFetch

        protected void sendFetch​(int fetchSize)
                          throws java.sql.SQLException,
                                 java.io.IOException
        Sends the fetch request to the database.
        Parameters:
        fetchSize - Number of rows to fetch.
        Throws:
        java.sql.SQLException
        java.io.IOException
      • readSqlData

        protected RowValue readSqlData()
                                throws java.sql.SQLException,
                                       java.io.IOException
        Reads a single row from the database.
        Returns:
        Row as a RowValue
        Throws:
        java.sql.SQLException
        java.io.IOException
      • readColumnData

        protected byte[] readColumnData​(XdrInputStream xdrIn,
                                        int len)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeSqlData

        protected void writeSqlData​(RowDescriptor rowDescriptor,
                                    RowValue fieldValues,
                                    boolean useActualLength)
                             throws java.io.IOException,
                                    java.sql.SQLException
        Write a set of SQL data from a RowValue.
        Parameters:
        rowDescriptor - The row descriptor
        fieldValues - The List containing the SQL data to be written
        useActualLength - Should actual field length be used (applies to CHAR)
        Throws:
        java.io.IOException - if an error occurs while writing to the underlying output stream
        java.sql.SQLException
      • writeColumnData

        protected void writeColumnData​(XdrOutputStream xdrOut,
                                       int len,
                                       byte[] buffer,
                                       FieldDescriptor fieldDescriptor)
                                throws java.io.IOException
        Throws:
        java.io.IOException
      • sendAllocate

        protected void sendAllocate()
                             throws java.sql.SQLException,
                                    java.io.IOException
        Sends the allocate request to the server.
        Throws:
        java.sql.SQLException
        java.io.IOException
      • processAllocateResponse

        protected void processAllocateResponse​(GenericResponse response)
                                        throws java.sql.SQLException
        Processes the allocate response from the server.
        Parameters:
        response - GenericResponse
        Throws:
        java.sql.SQLException
      • getDefaultSqlInfoSize

        public int getDefaultSqlInfoSize()
        Specified by:
        getDefaultSqlInfoSize in interface FbStatement
        Returns:
        The default size to use for the sql info buffer
      • getMaxSqlInfoSize

        public int getMaxSqlInfoSize()
        Specified by:
        getMaxSqlInfoSize in interface FbStatement
        Returns:
        The maximum size to use for the sql info buffer