Class H2TableIndex

  • All Implemented Interfaces:
    org.h2.util.HasSQL

    public class H2TableIndex
    extends org.h2.index.Index
    ScanIndex of FileDriver, the key is the row index [1-n].
    Author:
    Nicolas Fortin, Erwan Bocher, CNRS, 2020
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  H2TableIndex.DriverRow
      This class is requiring only field value on demand instead of gathering the full row values from drivers
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static String PK_COLUMN_NAME  
      • Fields inherited from class org.h2.index.Index

        columnIds, columns, indexColumns, indexType, table, uniqueColumnColumn
      • Fields inherited from class org.h2.engine.DbObject

        AGGREGATE, comment, COMMENT, CONSTANT, CONSTRAINT, database, DOMAIN, FUNCTION_ALIAS, INDEX, RIGHT, ROLE, SCHEMA, SEQUENCE, SETTING, SYNONYM, TABLE_OR_VIEW, trace, TRIGGER, USER
      • Fields inherited from interface org.h2.util.HasSQL

        ADD_PLAN_INFORMATION, DEFAULT_SQL_FLAGS, NO_CASTS, QUOTE_ONLY_WHEN_REQUIRED, REPLACE_LOBS_FOR_TRACE, TRACE_SQL_FLAGS
    • Constructor Summary

      Constructors 
      Constructor Description
      H2TableIndex​(org.h2gis.api.FileDriver driver, org.h2.table.Table table, int id, String indexName, org.h2.table.IndexColumn indexColumn)
      Constructor for primary key index.
      H2TableIndex​(org.h2gis.api.FileDriver driver, org.h2.table.Table table, int id, org.h2.table.IndexColumn indexColumn)
      Constructor for scan index.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(org.h2.engine.SessionLocal session, org.h2.result.Row row)  
      boolean canGetFirstOrLast()  
      void checkRename()  
      void close​(org.h2.engine.SessionLocal session)  
      org.h2.index.Cursor find​(org.h2.engine.SessionLocal session, org.h2.result.SearchRow first, org.h2.result.SearchRow last)  
      org.h2.index.Cursor findFirstOrLast​(org.h2.engine.SessionLocal session, boolean first)  
      double getCost​(org.h2.engine.SessionLocal session, int[] masks, org.h2.table.TableFilter[] tableFilters, int filter, org.h2.result.SortOrder sortOrder, org.h2.command.query.AllColumnsForPlan allColumnsForPlan)  
      long getDiskSpaceUsed()  
      org.h2gis.api.FileDriver getDriver()  
      org.h2.result.Row getRow​(org.h2.engine.SessionLocal session, long key)  
      long getRowCount​(org.h2.engine.SessionLocal session)  
      long getRowCountApproximation​(org.h2.engine.SessionLocal session)  
      boolean isRowIdIndex()  
      boolean needRebuild()  
      void remove​(org.h2.engine.SessionLocal session)  
      void remove​(org.h2.engine.SessionLocal session, org.h2.result.Row row)  
      void truncate​(org.h2.engine.SessionLocal session)  
      • Methods inherited from class org.h2.index.Index

        canFindNext, canScan, checkIndexColumnTypes, compareRows, findNext, getColumnIndex, getColumns, getCostRangeIndex, getCreateSQL, getCreateSQLForCopy, getDuplicateKeyException, getDuplicatePrimaryKeyMessage, getIndexColumns, getIndexType, getPlanSQL, getRowFactory, getTable, getType, getUniqueColumnCount, getUniqueRowFactory, isFindUsingFullTableScan, isFirstColumn, isHidden, mayHaveNullDuplicates, removeChildrenAndResources, update
      • Methods inherited from class org.h2.schema.SchemaObject

        getSchema, getSQL, getSQL
      • Methods inherited from class org.h2.engine.DbObject

        getChildren, getComment, getCreateSQLForMeta, getDatabase, getDropSQL, getId, getModificationId, getName, invalidate, isTemporary, isValid, rename, setComment, setModified, setObjectName, setTemporary, toString
      • Methods inherited from interface org.h2.util.HasSQL

        getTraceSQL
    • Constructor Detail

      • H2TableIndex

        public H2TableIndex​(org.h2gis.api.FileDriver driver,
                            org.h2.table.Table table,
                            int id,
                            org.h2.table.IndexColumn indexColumn)
        Constructor for scan index. Hidden column _ROWID_.
        Parameters:
        driver - Linked file driver
        table - Linked table
        id - Index identifier
        indexColumn - Column to index
      • H2TableIndex

        public H2TableIndex​(org.h2gis.api.FileDriver driver,
                            org.h2.table.Table table,
                            int id,
                            String indexName,
                            org.h2.table.IndexColumn indexColumn)
        Constructor for primary key index.
        Parameters:
        driver - Linked file driver
        table - Linked table
        id - Index identifier
        indexName - Unique index name
        indexColumn - Column to index
    • Method Detail

      • checkRename

        public void checkRename()
        Overrides:
        checkRename in class org.h2.engine.DbObject
      • getDriver

        public org.h2gis.api.FileDriver getDriver()
      • getRow

        public org.h2.result.Row getRow​(org.h2.engine.SessionLocal session,
                                        long key)
        Overrides:
        getRow in class org.h2.index.Index
      • close

        public void close​(org.h2.engine.SessionLocal session)
        Specified by:
        close in class org.h2.index.Index
      • add

        public void add​(org.h2.engine.SessionLocal session,
                        org.h2.result.Row row)
        Specified by:
        add in class org.h2.index.Index
      • remove

        public void remove​(org.h2.engine.SessionLocal session,
                           org.h2.result.Row row)
        Specified by:
        remove in class org.h2.index.Index
      • find

        public org.h2.index.Cursor find​(org.h2.engine.SessionLocal session,
                                        org.h2.result.SearchRow first,
                                        org.h2.result.SearchRow last)
        Specified by:
        find in class org.h2.index.Index
      • getCost

        public double getCost​(org.h2.engine.SessionLocal session,
                              int[] masks,
                              org.h2.table.TableFilter[] tableFilters,
                              int filter,
                              org.h2.result.SortOrder sortOrder,
                              org.h2.command.query.AllColumnsForPlan allColumnsForPlan)
        Specified by:
        getCost in class org.h2.index.Index
      • remove

        public void remove​(org.h2.engine.SessionLocal session)
        Specified by:
        remove in class org.h2.index.Index
      • truncate

        public void truncate​(org.h2.engine.SessionLocal session)
        Specified by:
        truncate in class org.h2.index.Index
      • canGetFirstOrLast

        public boolean canGetFirstOrLast()
        Overrides:
        canGetFirstOrLast in class org.h2.index.Index
      • findFirstOrLast

        public org.h2.index.Cursor findFirstOrLast​(org.h2.engine.SessionLocal session,
                                                   boolean first)
        Overrides:
        findFirstOrLast in class org.h2.index.Index
      • needRebuild

        public boolean needRebuild()
        Specified by:
        needRebuild in class org.h2.index.Index
      • getRowCount

        public long getRowCount​(org.h2.engine.SessionLocal session)
        Specified by:
        getRowCount in class org.h2.index.Index
      • getRowCountApproximation

        public long getRowCountApproximation​(org.h2.engine.SessionLocal session)
        Specified by:
        getRowCountApproximation in class org.h2.index.Index
      • getDiskSpaceUsed

        public long getDiskSpaceUsed()
        Overrides:
        getDiskSpaceUsed in class org.h2.index.Index
      • isRowIdIndex

        public boolean isRowIdIndex()
        Overrides:
        isRowIdIndex in class org.h2.index.Index