Package org.h2.engine
Class MetaRecord
- java.lang.Object
-
- org.h2.engine.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 Summary
Fields Modifier and Type Field Description (package private) static java.util.Comparator<Prepared>
CONSTRAINTS_COMPARATOR
Comparator for prepared constraints, sorts unique and primary key constraints first.private int
id
private int
objectType
private java.lang.String
sql
-
Constructor Summary
Constructors Constructor Description MetaRecord(SearchRow r)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
compareTo(MetaRecord other)
Sort the list of meta records by 'create order'.(package private) static void
execute(Database db, Prepared command, DatabaseEventListener listener, java.lang.String sql)
Execute the meta data statement.private int
getCreateOrder()
Get the sort order id for this object type.int
getId()
int
getObjectType()
java.lang.String
getSQL()
static void
populateRowFromDBObject(DbObject obj, SearchRow r)
Copy metadata from the specified object into specified search row.(package private) Prepared
prepare(Database db, SessionLocal systemSession, DatabaseEventListener listener)
Prepares the meta data statement.(package private) void
prepareAndExecute(Database db, SessionLocal systemSession, DatabaseEventListener listener)
Execute the meta data statement.private static void
throwException(Database db, DatabaseEventListener listener, DbException e, java.lang.String sql)
java.lang.String
toString()
-
-
-
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 objectr
- search row
-
prepareAndExecute
void prepareAndExecute(Database db, SessionLocal systemSession, DatabaseEventListener listener)
Execute the meta data statement.- Parameters:
db
- the databasesystemSession
- the system sessionlistener
- the database event listener
-
prepare
Prepared prepare(Database db, SessionLocal systemSession, DatabaseEventListener listener)
Prepares the meta data statement.- Parameters:
db
- the databasesystemSession
- the system sessionlistener
- 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 databasecommand
- the prepared commandlistener
- the database event listenersql
- SQL
-
throwException
private static void throwException(Database db, DatabaseEventListener listener, DbException e, java.lang.String 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 interfacejava.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 classjava.lang.Object
-
-