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

📄 hsqldatabaseproperties.java

📁 hsql是很有名的嵌入式数据库
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        setProperty(hsqldb_cache_size_scale, 8);        // number of rows from CACHED tables kept constantly in memory        // the number of rows in up to 3 * (2 to the power of        // cache_scale value).        // reduce the default 14 (3*16K rows) if memory is limited and rows        // are large.        // values between 8-16 are allowed        setProperty(hsqldb_cache_scale, 14);        // maximum size of .log file in megabytes        setProperty(hsqldb_log_size, "200");        // type of logging (0 : text , 1 : binary, 3 : compressed)        setProperty(hsqldb_script_format, 0);        setProperty(db_readonly, false);        setProperty(db_modified, "no-new-files");        // initial method of data file access        setProperty(hsqldb_nio_data_file, true);        // set default table type to MEMORY        setProperty(hsqldb_default_table_type, "memory");        // the property "version" is also set to the current version        //        // the following properties can be set by the user as defaults for        // text tables. the default values are shown.        // "textdb.fs", ","        // "textdb.vs", ",";        // "textdb.lvs", ","        // "textdb.ignore_first", false        // "textdb.quoted", true        // "textdb.all_quoted", false        // "textdb.encoding", "ASCII"        // "textdb.cache_scale", 10  -- allowed range 8-16        // "textdb.cache_size_scale", 10  -- allowed range 8-20        //        // settings for OOo integration        if (db.isStoredFileAccess()) {            setProperty(hsqldb_default_table_type, "cached");            setProperty(hsqldb_cache_scale, 13);            setProperty(hsqldb_log_size, 10);            setProperty(sql_enforce_strict_size, true);            setProperty(hsqldb_nio_data_file, false);        }    }    /**     * Creates file with defaults if it didn't exist.     * Returns false if file already existed.     */    public boolean load() throws HsqlException {        boolean exists;        if (database.getType().equals(DatabaseURL.S_MEM)) {            return true;        }        try {            exists = super.load();        } catch (Exception e) {            throw Trace.error(Trace.FILE_IO_ERROR,                              Trace.LOAD_SAVE_PROPERTIES, new Object[] {                fileName, e            });        }        if (!exists) {            return false;        }        filterLoadedProperties();        String version = getProperty(hsqldb_compatible_version);        // do not open if the database belongs to a later (future) version        int check = version.substring(0, 5).compareTo(THIS_VERSION);        Trace.check(check <= 0, Trace.WRONG_DATABASE_FILE_VERSION);        version = getProperty(db_version);        if (version.charAt(2) == '6') {            setProperty(hsqldb_cache_version, "1.6.0");        }        JavaSystem.gcFrequency = getIntegerProperty(runtime_gc_interval, 0);        return true;    }    /**     * Sets the database member variables after creating the properties object,     * openning a properties file, or changing a property with a command     */    public void setDatabaseVariables() {        if (isPropertyTrue(db_readonly)) {            database.setReadOnly();        }        if (isPropertyTrue(hsqldb_files_readonly)) {            database.setFilesReadOnly();        }        database.sqlEnforceStrictSize =            isPropertyTrue(sql_enforce_strict_size);        if (isPropertyTrue(sql_compare_in_locale)) {            stringProps.remove(sql_compare_in_locale);            database.collation.setCollationAsLocale();        }        database.txManager.setReWriteProtection(            isPropertyTrue(sql_tx_no_multi_write));        database.setMetaDirty(false);    }    public void save() throws HsqlException {        if (database.getType().equals(DatabaseURL.S_MEM)                || database.isFilesReadOnly() || database.isFilesInJar()) {            return;        }        try {            super.save();        } catch (Exception e) {            throw Trace.error(Trace.FILE_IO_ERROR,                              Trace.LOAD_SAVE_PROPERTIES, new Object[] {                fileName, e            });        }    }    void filterLoadedProperties() {        Enumeration en = stringProps.propertyNames();        while (en.hasMoreElements()) {            String key = (String) en.nextElement();            boolean accept = fullyProtectedProperties.contains(key)                             || setProtectedProperties.contains(key)                             || booleanProperties.contains(key)                             || integralProperties.contains(key)                             || stringProperties.contains(key);            if (!accept) {                stringProps.remove(key);            }        }    }    /**     *  overload file database properties with any passed on URL line     *  do not store password etc     */    public void setURLProperties(HsqlProperties props) {        if (props != null) {            for (Enumeration e =                    props.propertyNames(); e.hasMoreElements(); ) {                String propertyName = (String) e.nextElement();                if (isBoolean(propertyName) || isIntegral(propertyName)                        || isString(propertyName)                        || db_readonly.equals(propertyName)) {                    setProperty(propertyName,                                props.getProperty(propertyName));                }            }        }    }    public boolean isSetPropertyAllowed(String property) {        return !(fullyProtectedProperties.contains(property)                 || setProtectedProperties.contains(property));    }    public boolean isBoolean(String property) {        return booleanProperties.contains(property);    }    public boolean isIntegral(String property) {        return integralProperties.contains(property);    }    public boolean isString(String property) {        return stringProperties.contains(property);    }    public Set getBooleanPropertyNames() {        return booleanProperties;    }    public Set getIntegralPropertyNames() {        return integralProperties;    }    public Set getStringPropertyNames() {        return stringProperties;    }    public String setProperty(String key, String value) {        value = super.setProperty(key, value);        return value;    }    public int getDefaultWriteDelay() {        return database.isStoredFileAccess() ? 2000                                             : 20000;    }    public void setDBModified(int mode) throws HsqlException {        String value = "no";        if (mode == FILES_MODIFIED) {            value = "yes";        } else if (mode == FILES_NEW) {            value = "no-new-files";        }        setProperty(db_modified, value);        save();    }    public int getDBModified() throws HsqlException {        String value = getProperty("modified");        if ("yes".equals(value)) {            return FILES_MODIFIED;        } else if ("no-new-files".equals(value)) {            return FILES_NEW;        }        return FILES_NOT_MODIFIED;    }}

⌨️ 快捷键说明

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