Package org.h2.engine

Class MetaRecord

java.lang.Object
org.h2.engine.MetaRecord
All Implemented Interfaces:
Comparable<MetaRecord>

public class MetaRecord extends Object implements Comparable<MetaRecord>
A record in the system table of the database. It contains the SQL statement to create the database object.
  • Field Details

    • CONSTRAINTS_COMPARATOR

      static final Comparator<Prepared> CONSTRAINTS_COMPARATOR
      Comparator for prepared constraints, sorts unique and primary key constraints first.
    • id

      private final int id
    • objectType

      private final int objectType
    • sql

      private final String sql
  • Constructor Details

    • MetaRecord

      public MetaRecord(SearchRow r)
  • Method Details

    • populateRowFromDBObject

      public static void populateRowFromDBObject(DbObject obj, SearchRow r)
      Copy metadata from the specified object into specified search row.
      Parameters:
      obj - database object
      r - search row
    • prepareAndExecute

      void prepareAndExecute(Database db, SessionLocal systemSession, DatabaseEventListener listener)
      Execute the meta data statement.
      Parameters:
      db - the database
      systemSession - the system session
      listener - the database event listener
    • prepare

      Prepared prepare(Database db, SessionLocal systemSession, DatabaseEventListener listener)
      Prepares the meta data statement.
      Parameters:
      db - the database
      systemSession - the system session
      listener - the database event listener
      Returns:
      the prepared command
    • execute

      static void execute(Database db, Prepared command, DatabaseEventListener listener, String sql)
      Execute the meta data statement.
      Parameters:
      db - the database
      command - the prepared command
      listener - the database event listener
      sql - SQL
    • throwException

      private static void throwException(Database db, DatabaseEventListener listener, DbException e, String sql)
    • getId

      public int getId()
    • getObjectType

      public int getObjectType()
    • getSQL

      public String getSQL()
    • compareTo

      public int compareTo(MetaRecord other)
      Sort the list of meta records by 'create order'.
      Specified by:
      compareTo in interface Comparable<MetaRecord>
      Parameters:
      other - the other record
      Returns:
      -1, 0, or 1
    • getCreateOrder

      private int getCreateOrder()
      Get the sort order id for this object type. Objects are created in this order when opening a database.
      Returns:
      the sort index
    • toString

      public String toString()
      Overrides:
      toString in class Object