Class QueryCursorImpl<T>

    • Constructor Detail

      • QueryCursorImpl

        public QueryCursorImpl​(Iterable<T> iterExec)
        Parameters:
        iterExec - Query executor.
      • QueryCursorImpl

        public QueryCursorImpl​(Iterable<T> iterExec,
                               GridQueryCancel cancel,
                               boolean isQry,
                               boolean lazy)
        Parameters:
        iterExec - Query executor.
        isQry - Result type flag - true for query, false for update operation.
    • Method Detail

      • iter

        protected Iterator<T> iter()
        Returns:
        An simple iterator.
      • getAll

        public List<T> getAll()
        Gets all query results and stores them in the collection. Use this method when you know in advance that query result is relatively small and will not cause memory utilization issues.

        Since all the results will be fetched, all the resources will be closed automatically after this call, e.g. there is no need to call QueryCursor.close() method in this case.

        Specified by:
        getAll in interface QueryCursor<T>
        Returns:
        List containing all query results.
      • close

        public void close()
        Closes all resources related to this cursor. If the query execution is in progress (which is possible in case of invoking from another thread), a cancel will be attempted. Sequential calls to this method have no effect.

        Note: don't forget to close query cursors. Not doing so may lead to various resource leaks.

        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface QueryCursor<T>
      • isQuery

        public boolean isQuery()
        Specified by:
        isQuery in interface QueryCursorEx<T>
        Returns:
        true if this cursor corresponds to a ResultSet as a result of query, false if query was modifying operation like INSERT, UPDATE, or DELETE.
      • fieldsMeta

        public void fieldsMeta​(List<GridQueryFieldMetadata> fieldsMeta)
        Parameters:
        fieldsMeta - SQL Fields query result metadata.
      • getFieldName

        public String getFieldName​(int idx)
        Gets field name.
        Specified by:
        getFieldName in interface FieldsQueryCursor<T>
        Parameters:
        idx - field index.
        Returns:
        Field name.
      • getColumnsCount

        public int getColumnsCount()
        Gets number of columns in a row.
        Specified by:
        getColumnsCount in interface FieldsQueryCursor<T>
        Returns:
        row size.
      • partitionResult

        public PartitionResult partitionResult()
        Returns:
        Partition result.
      • lazy

        protected boolean lazy()
        Returns:
        Lazy mode flag.
      • partitionResult

        public void partitionResult​(PartitionResult partRes)
        Parameters:
        partRes - New partition result.