Package org.h2.engine
Class MetaRecord
java.lang.Object
org.h2.engine.MetaRecord
- All Implemented Interfaces:
Comparable<MetaRecord>
A record in the system table of the database.
It contains the SQL statement to create the database object.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final Comparator
<Prepared> Comparator for prepared constraints, sorts unique and primary key constraints first.private final int
private final int
private final String
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(MetaRecord other) Sort the list of meta records by 'create order'.(package private) static void
execute
(Database db, Prepared command, DatabaseEventListener listener, String sql) Execute the meta data statement.private int
Get the sort order id for this object type.int
getId()
int
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, String sql) toString()
-
Field Details
-
CONSTRAINTS_COMPARATOR
Comparator for prepared constraints, sorts unique and primary key constraints first. -
id
private final int id -
objectType
private final int objectType -
sql
-
-
Constructor Details
-
MetaRecord
-
-
Method Details
-
populateRowFromDBObject
Copy metadata from the specified object into specified search row.- Parameters:
obj
- database objectr
- search row
-
prepareAndExecute
Execute the meta data statement.- Parameters:
db
- the databasesystemSession
- the system sessionlistener
- the database event listener
-
prepare
Prepares the meta data statement.- Parameters:
db
- the databasesystemSession
- the system sessionlistener
- the database event listener- Returns:
- the prepared command
-
execute
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, String sql) -
getId
public int getId() -
getObjectType
public int getObjectType() -
getSQL
-
compareTo
Sort the list of meta records by 'create order'.- Specified by:
compareTo
in interfaceComparable<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
-