⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 databaseinformationfull.java

📁 hsqldb是100%java实现的数据库,是一个开放源代码的JAVA数据库 l 具有标准的SQL语法和JAVA接口 l HSQLDB可以自由使用和分发 l 非常简洁和快速的
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
        row[1] = String.valueOf(session.getId());        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "AUTOCOMMIT";        row[1] = session.isAutoCommit() ? "TRUE"                                        : "FALSE";        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "USER";        row[1] = session.getUsername();        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "SESSION_READONLY";        row[1] = session.isReadOnly() ? "TRUE"                                      : "FALSE";        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "DATABASE_READONLY";        row[1] = database.databaseReadOnly ? "TRUE"                                           : "FALSE";        t.insertSys(row);        // fredt - value set by SET MAXROWS in SQL, not Statement.setMaxRows()        row    = t.getEmptyRowData();        row[0] = "MAXROWS";        row[1] = String.valueOf(session.getSQLMaxRows());        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "DATABASE";        row[1] = database.getURI();        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "IDENTITY";        row[1] = String.valueOf(session.getLastIdentity());        t.insertSys(row);        row    = t.getEmptyRowData();        row[0] = "SCHEMA";        row[1] = String.valueOf(session.getSchemaName(null));        t.insertSys(row);        t.setDataReadOnly(true);        return t;    }    /**     * Retrieves a <code>Table</code> object describing the capabilities     * and operating parameter properties for the engine hosting this     * database, as well as their applicability in terms of scope and     * name space. <p>     *     * Reported properties include certain predefined <code>Database</code>     * properties file values as well as certain database scope     * attributes. <p>     *     * It is intended that all <code>Database</code> attributes and     * properties that can be set via the database properties file,     * JDBC connection properties or SQL SET/ALTER statements will     * eventually be reported here or, where more applicable, in an     * ANSI/ISO conforming feature info base table in the defintion     * schema. <p>     *     * Currently, the database properties reported are: <p>     *     * <OL>     *     <LI>hsqldb.cache_file_scale - the scaling factor used to translate data and index structure file pointers     *     <LI>hsqldb.cache_scale - base-2 exponent scaling allowable cache row count     *     <LI>hsqldb.cache_size_scale - base-2 exponent scaling allowable cache byte count     *     <LI>hsqldb.cache_version -     *     <LI>hsqldb.catalogs - whether to report the database catalog (database uri)     *     <LI>hsqldb.compatible_version -     *     <LI>hsqldb.files_readonly - whether the database is in files_readonly mode     *     <LI>hsqldb.gc_interval - # new records forcing gc ({0|NULL}=>never)     *     <LI>hsqldb.max_nio_scale - scale factor for cache nio mapped buffers     *     <LI>hsqldb.nio_data_file - whether cache uses nio mapped buffers     *     <LI>hsqldb.original_version -     *     <LI>sql.enforce_strict_size - column length specifications enforced strictly (raise exception on overflow)?     *     <LI>textdb.all_quoted - default policy regarding whether to quote all character field values     *     <LI>textdb.cache_scale - base-2 exponent scaling allowable cache row count     *     <LI>textdb.cache_size_scale - base-2 exponent scaling allowable cache byte count     *     <LI>textdb.encoding - default TEXT table file encoding     *     <LI>textdb.fs - default field separator     *     <LI>textdb.vs - default varchar field separator     *     <LI>textdb.lvs - default long varchar field separator     *     <LI>textdb.ignore_first - default policy regarding whether to ignore the first line     *     <LI>textdb.quoted - default policy regarding treatement character field values that _may_ require quoting     *     <LI>IGNORECASE - create table VARCHAR_IGNORECASE?     *     <LI>LOGSIZSE - # bytes to which REDO log grows before auto-checkpoint     *     <LI>REFERENTIAL_INTEGITY - currently enforcing referential integrity?     *     <LI>SCRIPTFORMAT - 0 : TEXT, 1 : BINARY, ...     *     <LI>WRITEDELAY - does REDO log currently use buffered write strategy?     * </OL> <p>     *     * @return table describing database and session operating parameters     *      and capabilities     * @throws HsqlException if an error occurs while producing the table     */    Table SYSTEM_PROPERTIES() throws HsqlException {        Table t = sysTables[SYSTEM_PROPERTIES];        if (t == null) {            t = createBlankTable(sysTableHsqlNames[SYSTEM_PROPERTIES]);            addColumn(t, "PROPERTY_SCOPE", Types.VARCHAR, false);            addColumn(t, "PROPERTY_NAMESPACE", Types.VARCHAR, false);            addColumn(t, "PROPERTY_NAME", Types.VARCHAR, false);            addColumn(t, "PROPERTY_VALUE", Types.VARCHAR);            addColumn(t, "PROPERTY_CLASS", Types.VARCHAR, false);            // order PROPERTY_SCOPE, PROPERTY_NAMESPACE, PROPERTY_NAME            // true PK            t.createPrimaryKey(null, new int[] {                0, 1, 2            }, true);            return t;        }        // calculated column values        String scope;        String nameSpace;        // intermediate holders        Object[]               row;        HsqlDatabaseProperties props;        // column number mappings        final int iscope = 0;        final int ins    = 1;        final int iname  = 2;        final int ivalue = 3;        final int iclass = 4;        // First, we want the names and values for        // all JDBC capabilities constants        scope     = "SESSION";        props     = database.getProperties();        nameSpace = "database.properties";        // boolean properties        Iterator it = props.getUserDefinedPropertyData().iterator();        while (it.hasNext()) {            Object[] metaData = (Object[]) it.next();            row         = t.getEmptyRowData();            row[iscope] = scope;            row[ins]    = nameSpace;            row[iname]  = metaData[HsqlDatabaseProperties.indexName];            row[ivalue] = props.getProperty((String) row[iname]);            row[iclass] = metaData[HsqlDatabaseProperties.indexClass];            t.insertSys(row);        }        row         = t.getEmptyRowData();        row[iscope] = scope;        row[ins]    = nameSpace;        row[iname]  = "SCRIPTFORMAT";        try {            row[ivalue] =                ScriptWriterBase                    .LIST_SCRIPT_FORMATS[database.logger.getScriptType()];        } catch (Exception e) {}        row[iclass] = "java.lang.String";        t.insertSys(row);        // write delay        row         = t.getEmptyRowData();        row[iscope] = scope;        row[ins]    = nameSpace;        row[iname]  = "WRITE_DELAY";        row[ivalue] = "" + database.logger.getWriteDelay();        row[iclass] = "int";        t.insertSys(row);        // ignore case        row         = t.getEmptyRowData();        row[iscope] = scope;        row[ins]    = nameSpace;        row[iname]  = "IGNORECASE";        row[ivalue] = database.isIgnoreCase() ? "true"                                              : "false";        row[iclass] = "boolean";        t.insertSys(row);        // referential integrity        row         = t.getEmptyRowData();        row[iscope] = scope;        row[ins]    = nameSpace;        row[iname]  = "REFERENTIAL_INTEGRITY";        row[ivalue] = database.isReferentialIntegrity() ? "true"                                                        : "false";        row[iclass] = "boolean";        t.insertSys(row);        t.setDataReadOnly(true);        return t;    }    /**     * Retrieves a <code>Table</code> object describing all visible     * sessions. ADMIN users see *all* sessions     * while non-admin users see only their own session.<p>     *     * Each row is a session state description with the following columns: <p>     *     * <pre class="SqlCodeExample">     * SESSION_ID         INTEGER   session identifier     * CONNECTED          TIMESTAMP time at which session was created     * USER_NAME          VARCHAR   db user name of current session user     * IS_ADMIN           BOOLEAN   is session user an admin user?     * AUTOCOMMIT         BOOLEAN   is session in autocommit mode?     * READONLY           BOOLEAN   is session in read-only mode?     * MAXROWS            INTEGER   session's MAXROWS setting     * LAST_IDENTITY      INTEGER   last identity value used by this session     * TRANSACTION_SIZE   INTEGER   # of undo items in current transaction     * SCHEMA             VARCHAR   current schema for session     * </pre> <p>     *     * @return a <code>Table</code> object describing all visible     *      sessions     * @throws HsqlException if an error occurs while producing the table     */    Table SYSTEM_SESSIONS() throws HsqlException {        Table t = sysTables[SYSTEM_SESSIONS];        if (t == null) {            t = createBlankTable(sysTableHsqlNames[SYSTEM_SESSIONS]);            addColumn(t, "SESSION_ID", Types.INTEGER, false);            addColumn(t, "CONNECTED", Types.TIMESTAMP, false);            addColumn(t, "USER_NAME", Types.VARCHAR, false);            addColumn(t, "IS_ADMIN", Types.BOOLEAN, false);            addColumn(t, "AUTOCOMMIT", Types.BOOLEAN, false);            addColumn(t, "READONLY", Types.BOOLEAN, false);            addColumn(t, "MAXROWS", Types.INTEGER, false);            // Note: some sessions may have a NULL LAST_IDENTITY value            addColumn(t, "LAST_IDENTITY", Types.BIGINT);            addColumn(t, "TRANSACTION_SIZE", Types.INTEGER, false);            addColumn(t, "SCHEMA", Types.VARCHAR, false);            // order:  SESSION_ID            // true primary key            t.createPrimaryKey(null, new int[]{ 0 }, true);            return t;        }        // intermediate holders        Session[] sessions;        Session   s;        Object[]  row;        // column number mappings        final int isid      = 0;        final int ict       = 1;        final int iuname    = 2;        final int iis_admin = 3;        final int iautocmt  = 4;        final int ireadonly = 5;        final int imaxrows  = 6;        final int ilast_id  = 7;        final int it_size   = 8;        final int it_schema = 9;        // Initialisation        sessions = ns.listVisibleSessions(session);        // Do it.        for (int i = 0; i < sessions.length; i++) {            s              = sessions[i];            row            = t.getEmptyRowData();            row[isid]      = ValuePool.getInt(s.getId());            row[ict]       = HsqlDateTime.getTimestamp(s.getConnectTime());            row[iuname]    = s.getUsername();            row[iis_admin] = ValuePool.getBoolean(s.isAdmin());            row[iautocmt]  = ValuePool.getBoolean(s.isAutoCommit());            row[ireadonly] = ValuePool.getBoolean(s.isReadOnly());            row[imaxrows]  = ValuePool.getInt(s.getSQLMaxRows());            row[ilast_id] =                ValuePool.getLong(s.getLastIdentity().longValue());            row[it_size]   = ValuePool.getInt(s.getTransactionSize());            row[it_schema] = s.getSchemaName(null);            t.insertSys(row);        }        t.setDataReadOnly(true);        return t;    }    /**     * Retrieves a <code>Table</code> object describing the accessible     * direct super table (if any) of each accessible table defined     * within this database. <p>     *     * Each row is a super table description with the following columns: <p>     *     * <pre class="SqlCodeExample">     * TABLE_CAT       VARCHAR   the table's catalog     * TABLE_SCHEM     VARCHAR   table schema     * TABLE_NAME      VARCHAR   table name     * SUPERTABLE_NAME VARCHAR   the direct super table's name     * </pre> <p>     * @return a <code>Table</code> object describing the accessible     *        direct supertable (if any) of each accessible     *        table defined within this database     * @throws HsqlException if an error occurs while producing the table     */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -