Class CompleteResult

  • All Implemented Interfaces:
    java.lang.AutoCloseable, java.sql.ResultSet, java.sql.Wrapper, Completion, ServerMessage
    Direct Known Subclasses:
    UpdatableResult

    public class CompleteResult
    extends Result
    Result-set that will retrieve all rows immediately before returning the result-set.
    • Field Detail

      • BEFORE_FIRST_POS

        protected static final int BEFORE_FIRST_POS
        before first row position = initial position
        See Also:
        Constant Field Values
      • bulkResult

        private boolean bulkResult
      • mightBeBulkResult

        private boolean mightBeBulkResult
    • Constructor Detail

      • CompleteResult

        public CompleteResult​(Statement stmt,
                              boolean binaryProtocol,
                              long maxRows,
                              ColumnDecoder[] metadataList,
                              Reader reader,
                              Context context,
                              int resultSetType,
                              boolean closeOnCompletion,
                              boolean traceEnable,
                              boolean mightBeBulkResult)
                       throws java.io.IOException,
                              java.sql.SQLException
        Constructor from exchanges
        Parameters:
        stmt - current statement
        binaryProtocol - does exchanges uses binary protocol
        maxRows - maximum number of rows
        metadataList - metadata
        reader - packet reader
        context - connection context
        resultSetType - result set type
        closeOnCompletion - close statement on completion
        traceEnable - network trace exchange possible
        mightBeBulkResult - might be a bulk unitary result
        Throws:
        java.io.IOException - if Socket error occurs
        java.sql.SQLException - for all other kind of errors
      • CompleteResult

        public CompleteResult​(ColumnDecoder[] metadataList,
                              byte[][] data,
                              Context context,
                              int resultSetType)
        Specific constructor for internal build result-set, empty resultset, or generated key result-set.
        Parameters:
        metadataList - metadata
        data - result-set data
        context - connection context
        resultSetType - result set type
    • Method Detail

      • setBulkResult

        public void setBulkResult()
        Description copied from class: Result
        Indicate that result is a bulk result
        Specified by:
        setBulkResult in class Result
      • createResultSet

        public static java.sql.ResultSet createResultSet​(java.lang.String columnName,
                                                         DataType columnType,
                                                         java.lang.String[][] data,
                                                         Context context,
                                                         int flags,
                                                         int resultSetType)
        Specific constructor for generating generated key result-set.
        Parameters:
        columnName - column key
        columnType - column key type
        data - values
        context - connection context
        flags - column flags
        resultSetType - result set type
        Returns:
        result-set
      • createResultSet

        public static java.sql.ResultSet createResultSet​(java.lang.String[] columnNames,
                                                         DataType[] columnTypes,
                                                         java.lang.String[][] data,
                                                         Context context,
                                                         int flags,
                                                         int resultSetType)
        Create a result set from given data. Useful for creating "fake" resultSets for DatabaseMetaData, (one example is MariaDbDatabaseMetaData.getTypeInfo())
        Parameters:
        columnNames - - string array of column names
        columnTypes - - column types
        data - - each element of this array represents a complete row in the ResultSet. Each value is given in its string representation, as in MariaDB text protocol, except boolean (BIT(1)) values that are represented as "1" or "0" strings
        context - connection context
        flags - column flags
        resultSetType - result set type
        Returns:
        resultset
      • newResultsetWithUseAliasAsName

        public CompleteResult newResultsetWithUseAliasAsName()
        Recreate Result-set with metadata using alias as name.
        Returns:
        Result-set with metadata using alias as name
      • next

        public boolean next()
                     throws java.sql.SQLException
        Description copied from class: Result
        Position resultset to next row
        Specified by:
        next in interface java.sql.ResultSet
        Specified by:
        next in class Result
        Returns:
        true if next row exists
        Throws:
        java.sql.SQLException - if any error occurs
      • streaming

        public boolean streaming()
        Description copied from class: Result
        Indicate of current result-set is a streaming result-set
        Specified by:
        streaming in class Result
        Returns:
        if streaming result-set
      • isBulkResult

        public boolean isBulkResult()
        Description copied from class: Result
        Indicate if result-set is a bulk unitary result
        Specified by:
        isBulkResult in class Result
        Returns:
        true if unitary result-set
      • fetchRemaining

        public void fetchRemaining()
        Description copied from class: Result
        Fetch remaining results.
        Specified by:
        fetchRemaining in class Result
      • closeFromStmtClose

        public void closeFromStmtClose​(ClosableLock lock)
        Description copied from class: Result
        Closing result-set due to closing statement that issue command.
        Overrides:
        closeFromStmtClose in class Result
        Parameters:
        lock - thread locker object
      • isAfterLast

        public boolean isAfterLast()
                            throws java.sql.SQLException
        Specified by:
        isAfterLast in interface java.sql.ResultSet
        Specified by:
        isAfterLast in class Result
        Throws:
        java.sql.SQLException
      • isFirst

        public boolean isFirst()
                        throws java.sql.SQLException
        Specified by:
        isFirst in interface java.sql.ResultSet
        Specified by:
        isFirst in class Result
        Throws:
        java.sql.SQLException
      • isLast

        public boolean isLast()
                       throws java.sql.SQLException
        Specified by:
        isLast in interface java.sql.ResultSet
        Specified by:
        isLast in class Result
        Throws:
        java.sql.SQLException
      • beforeFirst

        public void beforeFirst()
                         throws java.sql.SQLException
        Specified by:
        beforeFirst in interface java.sql.ResultSet
        Specified by:
        beforeFirst in class Result
        Throws:
        java.sql.SQLException
      • afterLast

        public void afterLast()
                       throws java.sql.SQLException
        Specified by:
        afterLast in interface java.sql.ResultSet
        Specified by:
        afterLast in class Result
        Throws:
        java.sql.SQLException
      • first

        public boolean first()
                      throws java.sql.SQLException
        Specified by:
        first in interface java.sql.ResultSet
        Specified by:
        first in class Result
        Throws:
        java.sql.SQLException
      • last

        public boolean last()
                     throws java.sql.SQLException
        Specified by:
        last in interface java.sql.ResultSet
        Specified by:
        last in class Result
        Throws:
        java.sql.SQLException
      • getRow

        public int getRow()
                   throws java.sql.SQLException
        Specified by:
        getRow in interface java.sql.ResultSet
        Specified by:
        getRow in class Result
        Throws:
        java.sql.SQLException
      • absolute

        public boolean absolute​(int idx)
                         throws java.sql.SQLException
        Specified by:
        absolute in interface java.sql.ResultSet
        Specified by:
        absolute in class Result
        Throws:
        java.sql.SQLException
      • relative

        public boolean relative​(int rows)
                         throws java.sql.SQLException
        Specified by:
        relative in interface java.sql.ResultSet
        Specified by:
        relative in class Result
        Throws:
        java.sql.SQLException
      • previous

        public boolean previous()
                         throws java.sql.SQLException
        Specified by:
        previous in interface java.sql.ResultSet
        Specified by:
        previous in class Result
        Throws:
        java.sql.SQLException
      • getFetchSize

        public int getFetchSize()
                         throws java.sql.SQLException
        Specified by:
        getFetchSize in interface java.sql.ResultSet
        Overrides:
        getFetchSize in class Result
        Throws:
        java.sql.SQLException
      • setFetchSize

        public void setFetchSize​(int rows)
                          throws java.sql.SQLException
        Specified by:
        setFetchSize in interface java.sql.ResultSet
        Overrides:
        setFetchSize in class Result
        Throws:
        java.sql.SQLException