Package org.h2.table

Class TableSynonym

All Implemented Interfaces:
HasSQL

public class TableSynonym extends SchemaObject
Synonym for an existing table or view. All DML requests are forwarded to the backing table. Adding indices to a synonym or altering the table is not supported.
  • Field Details

    • data

      private CreateSynonymData data
    • synonymFor

      private Table synonymFor
      The table the synonym is created for.
  • Constructor Details

  • Method Details

    • getSynonymFor

      public Table getSynonymFor()
      Returns:
      the table this is a synonym for
    • updateData

      public void updateData(CreateSynonymData data)
      Set (update) the data.
      Parameters:
      data - the new data
    • getType

      public int getType()
      Description copied from class: DbObject
      Get the object type.
      Specified by:
      getType in class DbObject
      Returns:
      the object type
    • 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
      Specified by:
      getCreateSQLForCopy in class DbObject
      Parameters:
      table - the new table
      quotedName - the quoted name
      Returns:
      the SQL statement
    • rename

      public void rename(String newName)
      Description copied from class: DbObject
      Rename the object.
      Overrides:
      rename in class DbObject
      Parameters:
      newName - the new name
    • removeChildrenAndResources

      public void removeChildrenAndResources(SessionLocal session)
      Description copied from class: DbObject
      Delete all dependent children objects and resources of this object.
      Specified by:
      removeChildrenAndResources in class DbObject
      Parameters:
      session - the session
    • 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
    • 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
    • checkRename

      public void checkRename()
      Description copied from class: DbObject
      Check if renaming is allowed. Does nothing when allowed.
      Overrides:
      checkRename in class DbObject
    • getSynonymForName

      public String getSynonymForName()
      Returns:
      the table this synonym is for
    • getSynonymForSchema

      public Schema getSynonymForSchema()
      Returns:
      the schema this synonym is for
    • isInvalid

      public boolean isInvalid()
      Returns:
      true if this synonym currently points to a real table
    • updateSynonymFor

      public void updateSynonymFor()
      Update the table that this is a synonym for, to know about this synonym.