1 5 package org.h2.engine; 6 7 70 public class Constants { 71 72 public static final int BUILD_ID = 40; 73 private static final String BUILD = "2007-01-17"; 74 public static final int VERSION_MAJOR = 1; 75 public static final int VERSION_MINOR = 0; 76 77 public static final int FILE_BLOCK_SIZE = 16; 78 public static final String MAGIC_FILE_HEADER_TEXT = "-- H2 0.5/T -- ".substring(0, FILE_BLOCK_SIZE-1) + "\n"; 79 public static final String MAGIC_FILE_HEADER = "-- H2 0.5/B -- ".substring(0, FILE_BLOCK_SIZE-1) + "\n"; 80 public static final int TCP_DRIVER_VERSION = 3; 81 82 public static final int VERSION_JDBC_MAJOR = 3; 83 public static final int VERSION_JDBC_MINOR = 0; 84 85 public static String getVersion() { 86 return VERSION_MAJOR + "." + VERSION_MINOR+ " (" + BUILD + ")"; 87 } 88 89 public static final int NULL_SORT_LOW = 1, NULL_SORT_HIGH = 2; 90 public static final int NULL_SORT_START = 3, NULL_SORT_END = 4; 91 public static final int NULL_SORT_DEFAULT = NULL_SORT_LOW; 92 93 public static final int DEFAULT_SERVER_PORT = 9092; 95 public static final String START_URL = "jdbc:h2:"; 96 97 public static final String URL_FORMAT = START_URL + "{ {.|mem:}[name] | [file:]fileName | {tcp|ssl}:[//]server[:port][,server2[:port]]/name }[;key=value...]"; 98 99 public static final String PRODUCT_NAME = "H2"; 100 101 public static final String DRIVER_NAME = "H2 JDBC Driver"; 102 103 public static final int IO_BUFFER_SIZE = 4 * 1024; 104 public static final int IO_BUFFER_SIZE_COMPRESS = 128 * 1024; 105 106 public static final int DEFAULT_CACHE_SIZE = 1 << 16; 107 public static final int CACHE_SIZE_INDEX_SHIFT = 3; 108 public static final int DEFAULT_CACHE_SIZE_INDEX = DEFAULT_CACHE_SIZE >> CACHE_SIZE_INDEX_SHIFT; 109 110 public static final int DEFAULT_CACHE_SIZE_LINEAR_INDEX = 1 << 8; 111 112 public static final String SUFFIX_DATA_FILE = ".data.db"; 113 public static final String SUFFIX_LOG_FILE = ".log.db"; 114 public static final String SUFFIX_INDEX_FILE = ".index.db"; 115 public static final String SUFFIX_HASH_FILE = ".hash.db"; 116 public static final String SUFFIX_LOCK_FILE = ".lock.db"; 117 public static final String SUFFIX_TEMP_FILE = ".temp.db"; 118 public static final String SUFFIX_TRACE_FILE = ".trace.db"; 119 public static final String SUFFIX_LOB_FILE = ".lob.db"; 120 public static final String SUFFIX_TRACE_START_FILE = ".start"; 121 public static final String SUFFIX_SUMMARY_FILE = ".sum.db"; 122 public static final String SUFFIX_LOBS_DIRECTORY = ".lobs.db"; 123 124 public static final String UTF8 = "UTF8"; 125 public static final int DEFAULT_TABLE_TYPE = 0; 126 public static final int DEFAULT_MAX_LENGTH_INPLACE_LOB = 128; 127 public static final int DEFAULT_MAX_LENGTH_CLIENTSIDE_LOB = 65536; 128 public static final int SALT_LEN = 8; 129 130 public static final int DEFAULT_DATA_PAGE_SIZE = 512; 131 132 public static final String PRIMARY_KEY_PREFIX = "PRIMARY_KEY_"; 133 134 public static final int LOCK_SLEEP = 1000; 135 136 public static final int INITIAL_LOCK_TIMEOUT = 1000; 139 140 public static final char DEFAULT_ESCAPE_CHAR = '\\'; 141 public static final int DEFAULT_HTTP_PORT = 8082; public static final boolean DEFAULT_HTTP_SSL = false; 143 public static final boolean DEFAULT_HTTP_ALLOW_OTHERS = false; 144 public static final int DEFAULT_FTP_PORT = 8021; 145 146 public static final int DEFAULT_MAX_MEMORY_ROWS = 10000; 147 148 public static final int DEFAULT_MAX_MEMORY_UNDO = Integer.MAX_VALUE; 149 150 public static final int DEFAULT_WRITE_DELAY = 500; 151 152 public static final String SERVER_PROPERTIES_TITLE = "H2 Server Properties"; 153 154 public static final String SERVER_PROPERTIES_FILE = ".h2.server.properties"; 155 156 public static final long LONG_QUERY_LIMIT_MS = 100; 157 158 public static final String PUBLIC_ROLE_NAME = "PUBLIC"; 159 160 public static final String TEMP_TABLE_PREFIX = "TEMP_TABLE_"; 161 public static final String TEMP_TABLE_TRANSACTION_PREFIX = "TEMP_TRANS_TABLE_"; 162 163 public static final int BIGDECIMAL_SCALE_MAX = 100000; 164 165 public static final String SCHEMA_MAIN = "PUBLIC"; 166 public static final String SCHEMA_INFORMATION = "INFORMATION_SCHEMA"; 167 168 public static final String DBA_NAME = "DBA"; 169 170 public static final String CHARACTER_SET_NAME = "Unicode"; 171 172 public static final String CLUSTERING_DISABLED = "''"; 173 174 public static final int LOCK_MODE_OFF = 0; 175 public static final int LOCK_MODE_TABLE = 1; 176 public static final int LOCK_MODE_TABLE_GC = 2; 177 public static final int LOCK_MODE_READ_COMMITTED = 3; 178 179 public static final int SELECTIVITY_DISTINCT_COUNT = 10000; 180 public static final int SELECTIVITY_DEFAULT = 50; 181 public static final int SELECTIVITY_ANALYZE_SAMPLE_ROWS = 10000; 182 183 public static final int COST_ROW_OFFSET = 1000; 186 public static final long FLUSH_INDEX_DELAY = 0; 187 public static final int THROTTLE_DELAY = 50; 188 189 public static final String MANAGEMENT_DB_PREFIX = "management_db_"; 190 public static final String MANAGEMENT_DB_USER = "sa"; 191 192 public static final boolean SERIALIZE_JAVA_OBJECTS = true; 193 public static final long DEFAULT_MAX_LOG_SIZE = 32 * 1024 * 1024; 194 public static final long LOG_SIZE_DIVIDER = 10; 195 196 public static final int ALLOW_LITERALS_NONE = 0; 197 public static final int ALLOW_LITERALS_NUMBERS = 1; 198 public static final int ALLOW_LITERALS_ALL = 2; 199 200 public static final int DEFAULT_ALLOW_LITERALS = ALLOW_LITERALS_ALL; 201 public static final boolean AUTO_CONVERT_LOB_TO_FILES = true; 202 public static final boolean ALLOW_EMTPY_BTREE_PAGES = true; 203 public static final String CONN_URL_INTERNAL = "jdbc:default:connection"; 204 public static final String CONN_URL_COLUMNLIST = "jdbc:columnlist:connection"; 205 206 public static final int VIEW_COST_CACHE_SIZE = 64; 207 public static final int VIEW_COST_CACHE_MAX_AGE = 10000; public static final int MAX_PARAMETER_INDEX = 100000; 209 210 public static final boolean OPTIMIZE_EVALUATABLE_SUBQUERIES = false; 212 213 public static final int ENCRYPTION_KEY_HASH_ITERATIONS = 1024; 215 216 public static final String SCRIPT_SQL = "script.sql"; 217 218 public static final int CACHE_MIN_RECORDS = 16; 220 221 public static final int MIN_WRITE_DELAY = getIntSetting("h2.minWriteDelay", 5); 222 223 224 public static boolean CHECK = getBooleanSetting("h2.check", true); 225 public static final boolean CHECK2 = getBooleanSetting("h2.check2", false); 226 227 public static final boolean LOB_FILES_IN_DIRECTORIES = getBooleanSetting("h2.lobFilesInDirectories", false); 229 public static final int LOB_FILES_PER_DIRECTORY = getIntSetting("h2.lobFilesPerDirectory", 256); 230 231 public static boolean MULTI_THREADED_KERNEL = getBooleanSetting("h2.multiThreadedKernel", false); 232 public static boolean RUN_FINALIZERS = getBooleanSetting("h2.runFinalizers", true); 233 234 public static final boolean OPTIMIZE_MIN_MAX = getBooleanSetting("h2.optimizeMinMax", true); 235 public static final boolean OPTIMIZE_IN = getBooleanSetting("h2.optimizeIn", true); 236 public static final int REDO_BUFFER_SIZE = getIntSetting("h2.redoBufferSize", 256 * 1024); 237 public static final boolean RECOMPILE_ALWAYS = getBooleanSetting("h2.recompileAlways", false); 238 public static final boolean OPTIMIZE_SUBQUERY_CACHE = getBooleanSetting("h2.optimizeSubqueryCache", true); 239 public static final boolean OVERFLOW_EXCEPTIONS = getBooleanSetting("h2.overflowExceptions", true); 240 public static final boolean LOG_ALL_ERRORS = getBooleanSetting("h2.logAllErrors", false); 241 public static final String LOG_ALL_ERRORS_FILE = getStringSetting("h2.logAllErrorsFile", "h2errors.txt"); 242 public static final int SERVER_CACHED_OBJECTS = getIntSetting("h2.serverCachedObjects", 64); 243 public static final int SERVER_SMALL_RESULTSET_SIZE = getIntSetting("h2.serverSmallResultSetSize", 100); 244 public static final int EMERGENCY_SPACE_INITIAL = getIntSetting("h2.emergencySpaceInitial", 1 * 1024 * 1024); 245 public static final int EMERGENCY_SPACE_MIN = getIntSetting("h2.emergencySpaceMin", 128 * 1024); 246 public static final boolean OBJECT_CACHE = getBooleanSetting("h2.objectCache", true); 247 public static final int OBJECT_CACHE_SIZE = getIntSetting("h2.objectCacheSize", 1024); 248 public static final int OBJECT_CACHE_MAX_PER_ELEMENT_SIZE = getIntSetting("h2.objectCacheMaxPerElementSize", 4096); 249 public static final String CLIENT_TRACE_DIRECTORY = getStringSetting("h2.clientTraceDirectory", "trace.db/"); 250 public static String SCRIPT_DIRECTORY = getStringSetting("h2.scriptDirectory", ""); 251 252 public static boolean getBooleanSetting(String name, boolean defaultValue) { 253 String s = System.getProperty(name); 254 if(s != null) { 255 try { 256 return Boolean.valueOf(s).booleanValue(); 257 } catch(NumberFormatException e) { 258 } 259 } 260 return defaultValue; 261 } 262 263 public static String getStringSetting(String name, String defaultValue) { 264 String s = System.getProperty(name); 265 return s == null ? defaultValue : s; 266 } 267 268 public static int getIntSetting(String name, int defaultValue) { 269 String s = System.getProperty(name); 270 if(s != null) { 271 try { 272 return Integer.decode(s).intValue(); 273 } catch(NumberFormatException e) { 274 } 275 } 276 return defaultValue; 277 } 278 } 279 | Popular Tags |