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

📄 databaseinformationfull.java

📁 hsqldb是100%java实现的数据库,是一个开放源代码的JAVA数据库 l 具有标准的SQL语法和JAVA接口 l HSQLDB可以自由使用和分发 l 非常简洁和快速的
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
                t.insertSys(row);            }        }        t.setDataReadOnly(true);        return t;    }    /**     * Retrieves a <code>Table</code> object describing the current     * state of all row caching objects for the accessible     * tables defined within this database. <p>     *     * Currently, the row caching objects for which state is reported are: <p>     *     * <OL>     * <LI> the system-wide <code>Cache</code> object used by CACHED tables.     * <LI> any <code>TextCache</code> objects in use by [TEMP] TEXT tables.     * </OL> <p>     *     * Each row is a cache object state description with the following     * columns: <p>     *     * <pre class="SqlCodeExample">     * CACHE_FILE          VARCHAR   absolute path of cache data file     * MAX_CACHE_SIZE      INTEGER   maximum allowable cached Row objects     * MAX_CACHE_BYTE_SIZE INTEGER   maximum allowable size of cached Row objects     * CACHE_LENGTH        INTEGER   number of data bytes currently cached     * CACHE_SIZE          INTEGER   number of rows currently cached     * FREE_BYTES          INTEGER   total bytes in available file allocation units     * FREE_COUNT          INTEGER   total # of allocation units available     * FREE_POS            INTEGER   largest file position allocated + 1     * </pre> <p>     *     * <b>Notes:</b> <p>     *     * <code>TextCache</code> objects do not maintain a free list because     * deleted rows are only marked deleted and never reused. As such, the     * columns FREE_BYTES, SMALLEST_FREE_ITEM, LARGEST_FREE_ITEM, and     * FREE_COUNT are always reported as zero for rows reporting on     * <code>TextCache</code> objects. <p>     *     * Currently, CACHE_SIZE, FREE_BYTES, SMALLEST_FREE_ITEM, LARGEST_FREE_ITEM,     * FREE_COUNT and FREE_POS are the only dynamically changing values.     * All others are constant for the life of a cache object. In a future     * release, other column values may also change over the life of a cache     * object, as SQL syntax may eventually be introduced to allow runtime     * modification of certain cache properties. <p>     *     * @return a description of the current state of all row caching     *      objects associated with the accessible tables of the database     * @throws HsqlException if an error occurs while producing the table     */    Table SYSTEM_CACHEINFO() throws HsqlException {        Table t = sysTables[SYSTEM_CACHEINFO];        if (t == null) {            t = createBlankTable(sysTableHsqlNames[SYSTEM_CACHEINFO]);            addColumn(t, "CACHE_FILE", Types.VARCHAR, false);         // not null            addColumn(t, "MAX_CACHE_COUNT", Types.INTEGER, false);    // not null            addColumn(t, "MAX_CACHE_BYTES", Types.BIGINT, false);     // not null            addColumn(t, "CACHE_SIZE", Types.INTEGER, false);         // not null            addColumn(t, "CACHE_BYTES", Types.BIGINT, false);         // not null            addColumn(t, "FILE_FREE_BYTES", Types.INTEGER, false);    // not null            addColumn(t, "FILE_FREE_COUNT", Types.INTEGER, false);    // not null            addColumn(t, "FILE_FREE_POS", Types.BIGINT, false);       // not null            t.createPrimaryKey(null, new int[]{ 0 }, true);            return t;        }        DataFileCache cache;        Object[]      row;        HashSet       cacheSet;        Iterator      caches;        Iterator      tables;        Table         table;        int           iFreeBytes;        int           iLargestFreeItem;        long          lSmallestFreeItem;        // column number mappings        final int icache_file      = 0;        final int imax_cache_sz    = 1;        final int imax_cache_bytes = 2;        final int icache_size      = 3;        final int icache_length    = 4;        final int ifree_bytes      = 5;        final int ifree_count      = 6;        final int ifree_pos        = 7;        // Initialization        cacheSet = new HashSet();        // dynamic system tables are never cached        tables = database.schemaManager.allTablesIterator();        while (tables.hasNext()) {            table = (Table) tables.next();            if (table.isFileBased() && isAccessibleTable(table)) {                cache = table.getCache();                if (cache != null) {                    cacheSet.add(cache);                }            }        }        caches = cacheSet.iterator();        // Do it.        while (caches.hasNext()) {            cache = (DataFileCache) caches.next();            row   = t.getEmptyRowData();            row[icache_file] =                FileUtil.canonicalOrAbsolutePath(cache.getFileName());            row[imax_cache_sz]    = ValuePool.getInt(cache.capacity());            row[imax_cache_bytes] = ValuePool.getLong(cache.bytesCapacity());            row[icache_size] = ValuePool.getInt(cache.getCachedObjectCount());            row[icache_length] =                ValuePool.getLong(cache.getTotalCachedBlockSize());            row[ifree_bytes] =                ValuePool.getInt(cache.getTotalFreeBlockSize());            row[ifree_count] = ValuePool.getInt(cache.getFreeBlockCount());            row[ifree_pos]   = ValuePool.getLong(cache.getFileFreePos());            t.insertSys(row);        }        t.setDataReadOnly(true);        return t;    }    /**     * Retrieves a <code>Table</code> object describing the visible     * access rights for all accessible Java Class objects defined     * within this database.<p>     *     * Each row is a Class privilege description with the following     * columns: <p>     *     * <pre class="SqlCodeExample">     * CLASS_CAT    VARCHAR   catalog in which the class is defined     * CLASS_SCHEM  VARCHAR   schema in which the class is defined     * CLASS_NAME   VARCHAR   fully qualified name of class     * GRANTOR      VARCHAR   grantor of access     * GRANTEE      VARCHAR   grantee of access     * PRIVILEGE    VARCHAR   name of access: {"EXECUTE" | "TRIGGER"}     * IS_GRANTABLE VARCHAR   grantable?: {"YES" | "NO" | NULL (unknown)}     * </pre>     *     * <b>Note:</b> Users with the administrative privilege implicily have     * full and unrestricted access to all Classes available to the database     * class loader.  However, only explicitly granted rights are reported     * in this table.  Explicit Class grants/revokes to admin users have no     * effect in reality, but are reported in this table anyway for     * completeness. <p>     *     * @return a <code>Table</code> object describing the visible     *        access rights for all accessible Java Class     *        objects defined within this database     * @throws HsqlException if an error occurs while producing the table     */    Table SYSTEM_CLASSPRIVILEGES() throws HsqlException {        Table t = sysTables[SYSTEM_CLASSPRIVILEGES];        if (t == null) {            t = createBlankTable(sysTableHsqlNames[SYSTEM_CLASSPRIVILEGES]);            addColumn(t, "CLASS_CAT", Types.VARCHAR);            addColumn(t, "CLASS_SCHEM", Types.VARCHAR);            addColumn(t, "CLASS_NAME", Types.VARCHAR, false);         // not null            addColumn(t, "GRANTOR", Types.VARCHAR, false);            // not null            addColumn(t, "GRANTEE", Types.VARCHAR, false);            // not null            addColumn(t, "PRIVILEGE", Types.VARCHAR, 7, false);       // not null            addColumn(t, "IS_GRANTABLE", Types.VARCHAR, 3, false);    // not null            t.createPrimaryKey(null, new int[] {                2, 4, 5            }, true);            return t;        }        // calculated column values        String clsCat;        String clsSchem;        String clsName;        String grantorName;        String granteeName;        String privilege;        String isGrantable;        // intermediate holders        UserManager   um;        HsqlArrayList users;        HashSet       classNameSet;        Iterator      classNames;        User          granteeUser;        Object[]      row;        // column number mappings        final int icls_cat   = 0;        final int icls_schem = 1;        final int icls_name  = 2;        final int igrantor   = 3;        final int igrantee   = 4;        final int iprivilege = 5;        final int iis_grntbl = 6;        // Initialization        grantorName = GranteeManager.DBA_ADMIN_ROLE_NAME;        um          = database.getUserManager();        users       = um.listVisibleUsers(session, true);        // Do it.        for (int i = 0; i < users.size(); i++) {            granteeUser  = (User) users.get(i);            granteeName  = granteeUser.getName();            isGrantable  = granteeUser.isAdmin() ? "YES"                                                 : "NO";            classNameSet = granteeUser.getGrantedClassNames(false);            if (granteeUser.isPublic()) {                ns.addBuiltinToSet(classNameSet);            }            classNames = classNameSet.iterator();// boucherb@users 20030305 - TODO completed.// "EXECUTE" is closest to correct (from: SQL 200n ROUTINE_PRIVILEGES)// There is nothing even like CLASS_PRIVILEGES table under SQL 200n spec.            privilege = "EXECUTE";            while (classNames.hasNext()) {                clsName         = (String) classNames.next();                clsCat          = ns.getCatalogName(clsName);                clsSchem        = ns.getSchemaName(clsName);                row             = t.getEmptyRowData();                row[icls_cat]   = clsCat;                row[icls_schem] = clsSchem;                row[icls_name]  = clsName;                row[igrantor]   = grantorName;                row[igrantee]   = granteeName;                row[iprivilege] = privilege;                row[iis_grntbl] = isGrantable;                t.insertSys(row);            }            classNames = ns.iterateAccessibleTriggerClassNames(granteeUser);// boucherb@users 20030305 - TODO completed.// "TRIGGER" is closest to correct. (from: SQL 200n TABLE_PRIVILEGES)// There is nothing even like CLASS_PRIVILEGES table under SQL 200n spec.            privilege = "TRIGGER";            while (classNames.hasNext()) {                clsName         = (String) classNames.next();                clsCat          = ns.getCatalogName(clsName);                clsSchem        = ns.getSchemaName(clsName);                row             = t.getEmptyRowData();                row[icls_cat]   = clsCat;                row[icls_schem] = clsSchem;                row[icls_name]  = clsName;                row[igrantor]   = grantorName;                row[igrantee]   = granteeName;                row[iprivilege] = privilege;                row[iis_grntbl] = isGrantable;                t.insertSys(row);            }        }        t.setDataReadOnly(true);        return t;    }    /**     * Retrieves a <code>Table</code> object describing attributes     * for the calling session context.<p>     *     * The rows report the following {key,value} pairs:<p>     *     * <pre class="SqlCodeExample">     * KEY (VARCHAR)       VALUE (VARCHAR)     * ------------------- ---------------     * SESSION_ID          the id of the calling session     * AUTOCOMMIT          YES: session is in autocommit mode, else NO     * USER                the name of user connected in the calling session     * (was READ_ONLY)     * SESSION_READONLY    TRUE: session is in read-only mode, else FALSE     * (new)     * DATABASE_READONLY   TRUE: database is in read-only mode, else FALSE     * MAXROWS             the MAXROWS setting in the calling session     * DATABASE            the name of the database     * IDENTITY            the last identity value used by calling session     * </pre>     *     * <b>Note:</b>  This table <em>may</em> become deprecated in a future     * release, as the information it reports now duplicates information     * reported in the newer SYSTEM_SESSIONS and SYSTEM_PROPERTIES     * tables. <p>     *     * @return a <code>Table</code> object describing the     *        attributes of the connection associated     *        with the current execution context     * @throws HsqlException if an error occurs while producing the table     */    Table SYSTEM_SESSIONINFO() throws HsqlException {        Table t = sysTables[SYSTEM_SESSIONINFO];        if (t == null) {            t = createBlankTable(sysTableHsqlNames[SYSTEM_SESSIONINFO]);            addColumn(t, "KEY", Types.VARCHAR, false);      // not null            addColumn(t, "VALUE", Types.VARCHAR, false);    // not null            t.createPrimaryKey(null);            return t;        }        Object[] row;        row    = t.getEmptyRowData();        row[0] = "SESSION_ID";

⌨️ 快捷键说明

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