Package org.h2.table

Class TableView

All Implemented Interfaces:
HasSQL

public final class TableView extends QueryExpressionTable
A view is a virtual table that is defined by a query.
  • Constructor Details

  • Method Details

    • createIndex

      protected QueryExpressionIndex createIndex(SessionLocal session, int[] masks)
    • replace

      public void replace(String querySQL, Column[] newColumnTemplates, SessionLocal session, boolean force)
      Try to replace the SQL statement of the view and re-compile this and all dependent views.
      Parameters:
      querySQL - the SQL statement
      newColumnTemplates - the columns
      session - the session
      force - if errors should be ignored
    • recompile

      public DbException recompile(SessionLocal session, boolean force, boolean clearIndexCache)
      Re-compile the view query and all views that depend on this object.
      Parameters:
      session - the session
      force - if exceptions should be ignored
      clearIndexCache - if we need to clear view index cache
      Returns:
      the exception if re-compiling this or any dependent view failed (only when force is disabled)
    • isInvalid

      public boolean isInvalid()
      Check if this view is currently invalid.
      Returns:
      true if it is
    • getTopQuery

      public Query getTopQuery()
      Specified by:
      getTopQuery in class QueryExpressionTable
    • getDropSQL

      public String getDropSQL()
      Description copied from class: DbObject
      Construct a DROP ... SQL statement for this object.
      Overrides:
      getDropSQL in class DbObject
      Returns:
      the SQL statement
    • getCreateSQLForCopy

      public String getCreateSQLForCopy(Table table, String quotedName)
      Description copied from class: DbObject
      Build a SQL statement to re-create the object, or to create a copy of the object with a different name or referencing a different table
      Overrides:
      getCreateSQLForCopy in class DbObject
      Parameters:
      table - the new table
      quotedName - the quoted name
      Returns:
      the SQL statement
    • getCreateSQL

      public String getCreateSQL()
      Description copied from class: DbObject
      Construct the CREATE ... SQL statement for this object.
      Specified by:
      getCreateSQL in class DbObject
      Returns:
      the SQL statement
    • getCreateSQL

      public String getCreateSQL(boolean orReplace, boolean force)
      Generate "CREATE" SQL statement for the view.
      Parameters:
      orReplace - if true, then include the OR REPLACE clause
      force - if true, then include the FORCE clause
      Returns:
      the SQL statement
    • canDrop

      public boolean canDrop()
      Description copied from class: Table
      Check if this table can be dropped.
      Specified by:
      canDrop in class Table
      Returns:
      true if it can
    • getTableType

      public TableType getTableType()
      Description copied from class: Table
      Get the table type name
      Specified by:
      getTableType in class Table
      Returns:
      the table type name
    • removeChildrenAndResources

      public void removeChildrenAndResources(SessionLocal session)
      Description copied from class: DbObject
      Delete all dependent children objects and resources of this object.
      Overrides:
      removeChildrenAndResources in class Table
      Parameters:
      session - the session
    • clearIndexCaches

      public static void clearIndexCaches(Database database)
      Clear the cached indexes for all sessions.
      Parameters:
      database - the database
    • getQuerySQL

      public String getQuerySQL()
    • getQueryScope

      public QueryScope getQueryScope()
      Description copied from class: QueryExpressionTable
      Returns the scope of this table
      Specified by:
      getQueryScope in class QueryExpressionTable
      Returns:
      the scope of this table
    • 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 QueryExpressionTable
      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
    • getMaxDataModificationId

      public long getMaxDataModificationId()
      Description copied from class: Table
      Get the last data modification id.
      Overrides:
      getMaxDataModificationId in class QueryExpressionTable
      Returns:
      the modification id
    • isDeterministic

      public boolean isDeterministic()
      Description copied from class: Table
      Check if the table is deterministic.
      Overrides:
      isDeterministic in class QueryExpressionTable
      Returns:
      true if it is
    • getTables

      public List<Table> getTables()