Package org.h2.engine

Class MetaRecord

  • All Implemented Interfaces:
    java.lang.Comparable<MetaRecord>

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

      • CONSTRAINTS_COMPARATOR

        static final java.util.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 java.lang.String sql
    • Constructor Detail

      • MetaRecord

        public MetaRecord​(SearchRow r)
    • Method Detail

      • 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,
                            java.lang.String sql)
        Execute the meta data statement.
        Parameters:
        db - the database
        command - the prepared command
        listener - the database event listener
        sql - SQL
      • getId

        public int getId()
      • getObjectType

        public int getObjectType()
      • getSQL

        public java.lang.String getSQL()
      • compareTo

        public int compareTo​(MetaRecord other)
        Sort the list of meta records by 'create order'.
        Specified by:
        compareTo in interface java.lang.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 java.lang.String toString()
        Overrides:
        toString in class java.lang.Object