📄 databaseinformation.java
字号:
// "SYSTEM_DIRECT_SUPERTYPES",// "SYSTEM_DOMAIN_CONSTRAINTS",// "SYSTEM_DOMAINS",// "SYSTEM_ELEMENT_TYPES",// "SYSTEM_FIELDS",// "SYSTEM_FOREIGN_DATA_WRAPPER_OPTIONS",// "SYSTEM_FOREIGN_DATA_WRAPPERS",// "SYSTEM_FOREIGN_SERVER_OPTIONS",// "SYSTEM_FOREIGN_SERVERS",// "SYSTEM_FOREIGN_TABLE_OPTIONS",// "SYSTEM_FOREIGN_TABLES",// "SYSTEM_JAR_JAR_USAGE",// "SYSTEM_JARS",// "SYSTEM_KEY_COLUMN_USAGE",// "SYSTEM_METHOD_SPECIFICATION_PARAMETERS",// "SYSTEM_METHOD_SPECIFICATIONS",// "SYSTEM_MODULE_COLUMN_USAGE",// "SYSTEM_MODULE_PRIVILEGES",// "SYSTEM_MODULE_TABLE_USAGE",// "SYSTEM_MODULES",// "SYSTEM_PARAMETERS",// "SYSTEM_REFERENCED_TYPES",// "SYSTEM_REFERENTIAL_CONSTRAINTS",// "SYSTEM_ROLE_AUTHORIZATION_DESCRIPTORS", // boucherb@users 20050514 - implemented// "SYSTEM_ROLES",// "SYSTEM_ROUTINE_COLUMN_USAGE",// "SYSTEM_ROUTINE_JAR_USAGE",// "SYSTEM_ROUTINE_MAPPING_OPTIONS",// "SYSTEM_ROUTINE_MAPPINGS",// "SYSTEM_ROUTINE_PRIVILEGES",// "SYSTEM_ROUTINE_ROUTINE_USAGE",// "SYSTEM_ROUTINE_SEQUENCE_USAGE",// "SYSTEM_ROUTINE_TABLE_USAGE",// "SYSTEM_ROUTINES",// "SYSTEM_SCHEMATA", // boucherb@users 20050514 - implemented// "SYSTEM_SEQUENCES", // boucherb@users 20040107 - implemented// "SYSTEM_SQL_FEATURES",// "SYSTEM_SQL_IMPLEMENTATION_INFO",// "SYSTEM_SQL_LANGUAGES",// "SYSTEM_SQL_SIZING",// "SYSTEM_SQL_SIZING_PROFILES",// "SYSTEM_TABLE_CONSTRAINTS", // boucherb@users 20040107 - implemented// "SYSTEM_TABLE_METHOD_PRIVILEGES",// "SYSTEM_TABLE_PRIVILEGES",// "SYSTEM_TABLES",// "SYSTEM_TRANSFORMS",// "SYSTEM_TRANSLATIONS",// "SYSTEM_TRIGGER_COLUMN_USAGE",// "SYSTEM_TRIGGER_ROUTINE_USAGE",// "SYSTEM_TRIGGER_SEQUENCE_USAGE",// "SYSTEM_TRIGGER_TABLE_USAGE",// "SYSTEM_TRIGGERED_UPDATE_COLUMNS",// "SYSTEM_TRIGGERS",// "SYSTEM_TYPE_JAR_USAGE",// "SYSTEM_USAGE_PRIVILEGES", // boucherb@users 20040107 - implemented// "SYSTEM_USER_DEFINED_TYPE_PRIVILEGES",// "SYSTEM_USER_DEFINED_TYPES",// "SYSTEM_USER_MAPPING_OPTIONS",// "SYSTEM_USER_MAPPINGS",// "SYSTEM_USERS",// "SYSTEM_VIEW_COLUMN_USAGE", // boucherb@users 20040107 - implemented// "SYSTEM_VIEW_ROUTINE_USAGE", // boucherb@users 20040107 - implemented// "SYSTEM_VIEW_TABLE_USAGE", // boucherb@users 20040107 - implemented// "SYSTEM_VIEWS", // boucherb@users 20030305 - implemented }; /** Map: table name => table id */ protected static final IntValueHashMap sysTableNamesMap; static { sysTableNamesMap = new IntValueHashMap(47); for (int i = 0; i < sysTableNames.length; i++) { sysTableNamesMap.put(sysTableNames[i], i); } } static int getSysTableID(String token) { return sysTableNamesMap.get(token, -1); } /** Database for which to produce tables */ protected final Database database; /** * Simple object-wide flag indicating that all of this object's cached * data is dirty. */ protected boolean isDirty = true; /** * state flag -- if true, contentful tables are to be produced, else * empty (surrogate) tables are to be produced. This allows faster * database startup where user views reference system tables and faster * system table structural reflection for table metadata. */ protected boolean withContent = false; /** * Factory method retuns the fullest system table producer * implementation available. This instantiates implementations beginning * with the most complete, finally choosing an empty table producer * implemenation (this class) if no better instance can be constructed. * @param db The Database object for which to produce system tables * @return the fullest system table producer * implementation available * @throws HsqlException never - required by constructor */ static final DatabaseInformation newDatabaseInformation(Database db) throws HsqlException { Class clazz = null; try { clazz = Class.forName("org.hsqldb.DatabaseInformationFull"); } catch (Exception e) { try { clazz = Class.forName("org.hsqldb.DatabaseInformationMain"); } catch (Exception e2) {} } try { Class[] ctorParmTypes = new Class[]{ Database.class }; Object[] ctorParms = new Object[]{ db }; Constructor ctor = clazz.getDeclaredConstructor(ctorParmTypes); return (DatabaseInformation) ctor.newInstance(ctorParms); } catch (Exception e) {} return new DatabaseInformation(db); } /** * Constructs a new DatabaseInformation instance which knows the names of * all system tables (isSystemTable()) but simpy returns null for all * getSystemTable() requests. <p> * * @param db The Database object for which to produce system tables * @throws HsqlException never (required for descendents) */ DatabaseInformation(Database db) throws HsqlException { database = db; } /** * Tests if the specified name is that of a system table. <p> * * @param name the name to test * @return true if the specified name is that of a system table */ final boolean isSystemTable(String name) { return sysTableNamesMap.containsKey(name); } /** * Retrieves a table with the specified name whose content may depend on * the execution context indicated by the session argument as well as the * current value of <code>withContent</code>. <p> * * @param session the context in which to produce the table * @param name the name of the table to produce * @throws HsqlException if a database access error occurs * @return a table corresponding to the name and session arguments, or * <code>null</code> if there is no such table to be produced */ Table getSystemTable(Session session, String name) throws HsqlException { return null; } /** * Controls caching of all tables produced by this object. <p> * * Subclasses are free to ignore this, since they may choose an * implementation that does not dynamically generate and/or cache * table content on an as-needed basis. <p> * * If not ignored, this call indicates to this object that all cached * table data may be dirty, requiring a complete cache clear at some * point.<p> * * Subclasses are free to delay cache clear until next getSystemTable(). * However, subclasses may have to be aware of additional methods with * semantics similar to getSystemTable() and act accordingly (e.g. * clearing earlier than next invocation of getSystemTable()). */ final void setDirty() { isDirty = true; } /** * Switches this table producer between producing empty (surrogate) * or contentful tables. <p> * * @param withContent if true, then produce contentful tables, else * produce emtpy (surrogate) tables */ final void setWithContent(boolean withContent) { this.withContent = withContent; }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -