/** * Get the value of the given property. * * @param setting the setting id * @param defaultValue the default value * @return the value as an integer */ int getIntProperty(int setting, int defaultValue) { String key = SetTypes.getTypeName(setting); String s = getProperty(key, null); try { return s == null ? defaultValue : Integer.decode(s); } catch (NumberFormatException e) { return defaultValue; } }
public Session(Database database, User user, int id) { this.database = database; this.queryTimeout = database.getSettings().maxQueryTimeout; this.queryCacheSize = database.getSettings().queryCacheSize; this.undoLog = new UndoLog(this); this.user = user; this.id = id; Setting setting = database.findSetting(SetTypes.getTypeName(SetTypes.DEFAULT_LOCK_TIMEOUT)); this.lockTimeout = setting == null ? Constants.INITIAL_LOCK_TIMEOUT : setting.getIntValue(); this.currentSchemaName = Constants.SCHEMA_MAIN; }
/** * Get the value of the given property. * * @param setting the setting id * @param defaultValue the default value * @return the value as a String */ String getProperty(int setting, String defaultValue) { String key = SetTypes.getTypeName(setting); String s = getProperty(key); return s == null ? defaultValue : s; }