static {
   ArrayList<String> list = SetTypes.getTypes();
   HashSet<String> set = KNOWN_SETTINGS;
   set.addAll(list);
   String[] connectionTime = {
     "ACCESS_MODE_DATA",
     "AUTOCOMMIT",
     "CIPHER",
     "CREATE",
     "CACHE_TYPE",
     "FILE_LOCK",
     "IGNORE_UNKNOWN_SETTINGS",
     "IFEXISTS",
     "INIT",
     "PASSWORD",
     "RECOVER",
     "RECOVER_TEST",
     "USER",
     "AUTO_SERVER",
     "AUTO_SERVER_PORT",
     "NO_UPGRADE",
     "AUTO_RECONNECT",
     "OPEN_NEW",
     "PAGE_SIZE",
     "PASSWORD_HASH",
     "JMX"
   };
   for (String key : connectionTime) {
     if (SysProperties.CHECK && set.contains(key)) {
       DbException.throwInternalError(key);
     }
     set.add(key);
   }
 }
 /**
  * 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;
   }
 }
示例#3
0
 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;
 }