Package org.h2.table

Class QueryExpressionTable

    • Method Detail

      • createQueryColumnTemplateList

        public static java.util.List<Column> createQueryColumnTemplateList​(java.lang.String[] cols,
                                                                           Query theQuery,
                                                                           boolean cte)
        Creates a list of column templates from a query (usually from WITH query, but could be any query)
        Parameters:
        cols - - an optional list of column names (can be specified by WITH clause overriding usual select names)
        theQuery - - the query object we want the column list for
        cte - true for CTE
        Returns:
        a list of column object returned by withQuery
      • getQuery

        public final Query getQuery()
      • getTopQuery

        public abstract Query getTopQuery()
      • close

        public final void close​(SessionLocal session)
        Description copied from class: Table
        Close the table object and flush changes.
        Specified by:
        close in class Table
        Parameters:
        session - the session
      • addIndex

        public final Index addIndex​(SessionLocal session,
                                    java.lang.String indexName,
                                    int indexId,
                                    IndexColumn[] cols,
                                    int uniqueColumnCount,
                                    IndexType indexType,
                                    boolean create,
                                    java.lang.String indexComment)
        Description copied from class: Table
        Create an index for this table
        Specified by:
        addIndex in class Table
        Parameters:
        session - the session
        indexName - the name of the index
        indexId - the id
        cols - the index columns
        uniqueColumnCount - the count of unique columns
        indexType - the index type
        create - whether this is a new index
        indexComment - the comment
        Returns:
        the index
      • isView

        public final boolean isView()
        Overrides:
        isView in class Table
      • getBestPlanItem

        public final PlanItem getBestPlanItem​(SessionLocal session,
                                              int[] masks,
                                              TableFilter[] filters,
                                              int filter,
                                              SortOrder sortOrder,
                                              AllColumnsForPlan allColumnsSet,
                                              boolean isSelectCommand)
        Description copied from class: Table
        Get the best plan for the given search mask.
        Overrides:
        getBestPlanItem in class Table
        Parameters:
        session - the session
        masks - per-column comparison bit masks, null means 'always false', see constants in IndexCondition
        filters - all joined table filters
        filter - the current table filter index
        sortOrder - the sort order
        allColumnsSet - the set of all columns
        Returns:
        the plan item
      • isQueryComparable

        public boolean isQueryComparable()
        Description copied from class: Table
        Check whether the table (or view) contains no columns that prevent index conditions to be used. For example, a view that contains the ROWNUM() pseudo-column prevents this.
        Overrides:
        isQueryComparable in class Table
        Returns:
        true if the table contains no query-comparable column
      • isInsertable

        public final boolean isInsertable()
        Description copied from class: Table
        Returns whether this table is insertable.
        Overrides:
        isInsertable in class Table
        Returns:
        whether this table is insertable
      • removeRow

        public final void removeRow​(SessionLocal session,
                                    Row row)
        Description copied from class: Table
        Remove a row from the table and all indexes.
        Specified by:
        removeRow in class Table
        Parameters:
        session - the session
        row - the row
      • addRow

        public final void addRow​(SessionLocal session,
                                 Row row)
        Description copied from class: Table
        Add a row to the table and all indexes.
        Specified by:
        addRow in class Table
        Parameters:
        session - the session
        row - the row
      • checkSupportAlter

        public final void checkSupportAlter()
        Description copied from class: Table
        Check if this table supports ALTER TABLE.
        Specified by:
        checkSupportAlter in class Table
      • truncate

        public final long truncate​(SessionLocal session)
        Description copied from class: Table
        Remove all rows from the table and indexes.
        Specified by:
        truncate in class Table
        Parameters:
        session - the session
        Returns:
        number of removed rows, possibly including uncommitted rows
      • getRowCount

        public final long getRowCount​(SessionLocal session)
        Description copied from class: Table
        Get the row count for this table.
        Specified by:
        getRowCount in class Table
        Parameters:
        session - the session
        Returns:
        the row count
      • canGetRowCount

        public final boolean canGetRowCount​(SessionLocal session)
        Description copied from class: Table
        Check if the row count can be retrieved quickly.
        Specified by:
        canGetRowCount in class Table
        Parameters:
        session - the session
        Returns:
        true if it can
      • getRowCountApproximation

        public final long getRowCountApproximation​(SessionLocal session)
        Description copied from class: Table
        Get the approximated row count for this table.
        Specified by:
        getRowCountApproximation in class Table
        Parameters:
        session - the session
        Returns:
        the approximated row count
      • getParameterOffset

        public final int getParameterOffset​(java.util.ArrayList<Parameter> additionalParameters)
        Get the index of the first parameter.
        Parameters:
        additionalParameters - additional parameters
        Returns:
        the index of the first parameter
      • canReference

        public final boolean canReference()
        Description copied from class: Table
        Check if this table can be referenced.
        Overrides:
        canReference in class Table
        Returns:
        true if it can
      • getIndexes

        public final java.util.List<Index> getIndexes()
        Description copied from class: Table
        Get all indexes for this table.
        Specified by:
        getIndexes in class Table
        Returns:
        the list of indexes
      • getMaxDataModificationId

        public long getMaxDataModificationId()
        Description copied from class: Table
        Get the last data modification id.
        Specified by:
        getMaxDataModificationId in class Table
        Returns:
        the modification id
      • getScanIndex

        public final Index getScanIndex​(SessionLocal session)
        Description copied from class: Table
        Get the scan index to iterate through all rows.
        Specified by:
        getScanIndex in class Table
        Parameters:
        session - the session
        Returns:
        the index
      • getScanIndex

        public Index getScanIndex​(SessionLocal session,
                                  int[] masks,
                                  TableFilter[] filters,
                                  int filter,
                                  SortOrder sortOrder,
                                  AllColumnsForPlan allColumnsSet)
        Description copied from class: Table
        Get the scan index for this table.
        Overrides:
        getScanIndex in class Table
        Parameters:
        session - the session
        masks - the search mask
        filters - the table filters
        filter - the filter index
        sortOrder - the sort order
        allColumnsSet - all columns
        Returns:
        the scan index
      • isDeterministic

        public boolean isDeterministic()
        Description copied from class: Table
        Check if the table is deterministic.
        Specified by:
        isDeterministic in class Table
        Returns:
        true if it is
      • addDependencies

        public final void addDependencies​(java.util.HashSet<DbObject> dependencies)
        Description copied from class: Table
        Add all objects that this table depends on to the hash set.
        Overrides:
        addDependencies in class Table
        Parameters:
        dependencies - the current set of dependencies
      • getQueryScope

        public abstract QueryScope getQueryScope()
        Returns the scope of this table
        Returns:
        the scope of this table