Class AbstractWireOperations

    • Method Detail

      • getEncoding

        protected final Encoding getEncoding()
      • getXdrIn

        protected final XdrInputStream getXdrIn()
                                         throws java.sql.SQLException
        Gets the XdrInputStream.
        Returns:
        Instance of XdrInputStream
        Throws:
        java.sql.SQLException - If no connection is opened or when exceptions occur retrieving the InputStream
      • getXdrOut

        protected final XdrOutputStream getXdrOut()
                                           throws java.sql.SQLException
        Gets the XdrOutputStream.
        Returns:
        Instance of XdrOutputStream
        Throws:
        java.sql.SQLException - If no connection is opened or when exceptions occur retrieving the OutputStream
      • readStatusVector

        public final java.sql.SQLException readStatusVector()
                                                     throws java.sql.SQLException
        Description copied from interface: FbWireOperations
        Process the status vector and returns the associated SQLException instance.

        NOTE: This method returns the SQLException read from the status vector, and only throws SQLException when an error occurs processing the status vector.

        Specified by:
        readStatusVector in interface FbWireOperations
        Returns:
        SQLException from the status vector
        Throws:
        java.sql.SQLException - for errors reading or processing the status vector
      • readStatusVector

        protected final java.sql.SQLException readStatusVector​(XdrInputStream xdrIn)
                                                        throws java.sql.SQLException
        Process the status vector from xdrIn and returns the associated SQLException instance.
        Parameters:
        xdrIn - XDR input stream to read from
        Returns:
        SQLException from the status vector
        Throws:
        java.sql.SQLException - for errors reading or processing the status vector
        See Also:
        FbWireOperations.readStatusVector()
      • readResponse

        public final Response readResponse​(WarningMessageCallback warningCallback)
                                    throws java.sql.SQLException,
                                           java.io.IOException
        Description copied from interface: FbWireOperations
        Reads the response from the server.
        Specified by:
        readResponse in interface FbWireOperations
        Parameters:
        warningCallback - Callback object for warnings, null for default callback
        Returns:
        Response read.
        Throws:
        java.sql.SQLException - For errors returned from the server, or when attempting to read
        java.io.IOException - For errors reading the response from the connection.
      • readOperationResponse

        public final Response readOperationResponse​(int operationCode,
                                                    WarningMessageCallback warningCallback)
                                             throws java.sql.SQLException,
                                                    java.io.IOException
        Description copied from interface: FbWireOperations
        Reads the response from the server when the operation code has already been read.
        Specified by:
        readOperationResponse in interface FbWireOperations
        Parameters:
        operationCode - The operation code
        warningCallback - Callback object for warnings, null for default callback
        Returns:
        Response read.
        Throws:
        java.sql.SQLException - For errors returned from the server, or when attempting to read
        java.io.IOException - For errors reading the response from the connection.
        See Also:
        FbWireOperations.readResponse(WarningMessageCallback)
      • readNextOperation

        public final int readNextOperation()
                                    throws java.io.IOException
        Reads the next operation. Forwards call to WireConnection.readNextOperation().
        Returns:
        next operation
        Throws:
        java.io.IOException - For errors reading the operation from the connection
      • processOperation

        protected final Response processOperation​(int operation)
                                           throws java.sql.SQLException,
                                                  java.io.IOException
        Reads the response based on the specified operation.
        Parameters:
        operation - Database operation
        Returns:
        Response object for the operation
        Throws:
        java.sql.SQLException - For errors reading the response from the connection.
        java.io.IOException - For errors reading the response from the connection.
      • readBatchCompletionResponse

        protected BatchCompletionResponse readBatchCompletionResponse​(XdrInputStream xdrIn)
                                                               throws java.sql.SQLException,
                                                                      java.io.IOException
        Reads the batch completion response (op_batch_cs) without reading the operation code itself.
        Parameters:
        xdrIn - XDR input stream to read
        Returns:
        batch completion response
        Throws:
        java.sql.SQLException - for errors reading the response from the connection
        java.sql.SQLFeatureNotSupportedException - when the protocol version does not support this response
        java.io.IOException - for errors reading the response from the connection
        Since:
        5
      • processResponse

        public final void processResponse​(Response response)
                                   throws java.sql.SQLException
        Specified by:
        processResponse in interface FbWireOperations
        Parameters:
        response - Response to process
        Throws:
        java.sql.SQLException - For errors returned from the server.
      • readGenericResponse

        public final GenericResponse readGenericResponse​(WarningMessageCallback warningCallback)
                                                  throws java.sql.SQLException,
                                                         java.io.IOException
        Description copied from interface: FbWireOperations
        Convenience method to read a Response to a GenericResponse
        Specified by:
        readGenericResponse in interface FbWireOperations
        Parameters:
        warningCallback - Callback object for warnings, null for default callback
        Returns:
        GenericResponse
        Throws:
        java.sql.SQLException - For errors returned from the server, or when attempting to read.
        java.io.IOException - For errors reading the response from the connection.
      • readSqlResponse

        public final SqlResponse readSqlResponse​(WarningMessageCallback warningCallback)
                                          throws java.sql.SQLException,
                                                 java.io.IOException
        Description copied from interface: FbWireOperations
        Convenience method to read a Response to a SqlResponse
        Specified by:
        readSqlResponse in interface FbWireOperations
        Parameters:
        warningCallback - Callback object for warnings, null for default callback
        Returns:
        SqlResponse
        Throws:
        java.sql.SQLException - For errors returned from the server, or when attempting to read.
        java.io.IOException - For errors reading the response from the connection.
      • handleCryptKeyCallback

        public void handleCryptKeyCallback​(DbCryptCallback dbCryptCallback)
                                    throws java.io.IOException,
                                           java.sql.SQLException
        Description copied from interface: FbWireOperations
        Handles the database encryption key callback.
        Specified by:
        handleCryptKeyCallback in interface FbWireOperations
        Parameters:
        dbCryptCallback - Database encryption callback plugin
        Throws:
        java.io.IOException - For errors reading data from the socket
        java.sql.SQLException - For database errors
        java.sql.SQLFeatureNotSupportedException - If this protocol version does not support crypt key callbacks
      • consumePackets

        public final void consumePackets​(int numberOfResponses,
                                         WarningMessageCallback warningCallback)
        Description copied from interface: FbWireOperations
        Consumes packets notifying for warnings, but ignoring exceptions thrown from the packet.

        This method should only be used inside the implementation if either packets need to be ignored, or to ensure that there is no backlog of packets (eg when an exception occurs during processing of multiple package responses).

        Specified by:
        consumePackets in interface FbWireOperations
        Parameters:
        numberOfResponses - Number of responses to consume.
        warningCallback - Callback for warnings
      • writeDirect

        public final void writeDirect​(byte[] data)
                               throws java.io.IOException
        Description copied from interface: FbWireOperations
        Writes directly to the OutputStream of the underlying connection.

        Use of this method might lead to hard to find race conditions in the protocol. It is currently only used to allow FbDatabase.cancelOperation(int) to work.

        Specified by:
        writeDirect in interface FbWireOperations
        Parameters:
        data - Data to write
        Throws:
        java.io.IOException - If there is no socket, the socket is closed, or for errors writing to the socket.
        See Also:
        WireConnection.writeDirect(byte[])
      • setNetworkTimeout

        public void setNetworkTimeout​(int milliseconds)
                               throws java.sql.SQLException
        Description copied from interface: FbWireOperations
        Sets the network timeout for this attachment.
        Specified by:
        setNetworkTimeout in interface FbWireOperations
        Parameters:
        milliseconds - Timeout in milliseconds; 0 means no timeout. If the attachment doesn't support milliseconds, it should round up to the nearest second.
        Throws:
        java.sql.SQLException - If this attachment is closed, the value of milliseconds is smaller than 0, or if setting the timeout fails.
        java.sql.SQLFeatureNotSupportedException - If this attachment doesn't support changing the network timeout.
      • addServerKeys

        protected final void addServerKeys​(byte[] serverKeys)
                                    throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • clearServerKeys

        protected final void clearServerKeys()
      • getClientAuthBlock

        protected final ClientAuthBlock getClientAuthBlock()
      • getAttachProperties

        protected final IAttachProperties<?> getAttachProperties()
        Returns:
        Immutable attach properties
      • getConnection

        protected final WireConnection<?,​?> getConnection()
      • getDefaultWarningMessageCallback

        protected final WarningMessageCallback getDefaultWarningMessageCallback()