KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > h2 > command > dml > SetTypes


1 /*
2  * Copyright 2004-2006 H2 Group. Licensed under the H2 License, Version 1.0 (http://h2database.com/html/license.html).
3  * Initial Developer: H2 Group
4  */

5 package org.h2.command.dml;
6
7 import org.h2.util.ObjectArray;
8
9 public class SetTypes {
10
11     public static final int IGNORECASE = 1, MAX_LOG_SIZE = 2, MODE = 3, READONLY = 4, LOCK_TIMEOUT = 5;
12     public static final int DEFAULT_LOCK_TIMEOUT = 6, DEFAULT_TABLE_TYPE = 7;
13     public static final int CACHE_SIZE = 8;
14     public static final int TRACE_LEVEL_SYSTEM_OUT = 9, TRACE_LEVEL_FILE = 10, TRACE_MAX_FILE_SIZE = 11;
15     public static final int COLLATION = 12, CLUSTER = 13, WRITE_DELAY = 14, DATABASE_EVENT_LISTENER = 15;
16     public static final int MAX_MEMORY_ROWS = 16, LOCK_MODE = 17, ASSERT = 18, DB_CLOSE_DELAY = 19;
17     public static final int LOG = 20, THROTTLE = 21, MAX_MEMORY_UNDO = 22, MAX_LENGTH_INPLACE_LOB = 23;
18     public static final int COMPRESS_LOB = 24, ALLOW_LITERALS = 25, MULTI_THREADED = 26, SCHEMA = 27;
19     public static final int OPTIMIZE_REUSE_RESULTS = 28;
20
21     private static ObjectArray types = new ObjectArray();
22     static {
23         setType(IGNORECASE, "IGNORECASE");
24         setType(MAX_LOG_SIZE, "MAX_LOG_SIZE");
25         setType(MODE, "MODE");
26         setType(READONLY, "READONLY");
27         setType(LOCK_TIMEOUT, "LOCK_TIMEOUT");
28         setType(DEFAULT_LOCK_TIMEOUT, "DEFAULT_LOCK_TIMEOUT");
29         setType(DEFAULT_TABLE_TYPE, "DEFAULT_TABLE_TYPE");
30         setType(CACHE_SIZE, "CACHE_SIZE");
31         setType(TRACE_LEVEL_SYSTEM_OUT, "TRACE_LEVEL_SYSTEM_OUT");
32         setType(TRACE_LEVEL_FILE, "TRACE_LEVEL_FILE");
33         setType(TRACE_MAX_FILE_SIZE, "TRACE_MAX_FILE_SIZE");
34         setType(COLLATION, "COLLATION");
35         setType(CLUSTER, "CLUSTER");
36         setType(WRITE_DELAY, "WRITE_DELAY");
37         setType(DATABASE_EVENT_LISTENER, "DATABASE_EVENT_LISTENER");
38         setType(MAX_MEMORY_ROWS, "MAX_MEMORY_ROWS");
39         setType(LOCK_MODE, "LOCK_MODE");
40         setType(ASSERT, "ASSERT");
41         setType(DB_CLOSE_DELAY, "DB_CLOSE_DELAY");
42         setType(LOG, "LOG");
43         setType(THROTTLE, "THROTTLE");
44         setType(MAX_MEMORY_UNDO, "MAX_MEMORY_UNDO");
45         setType(MAX_LENGTH_INPLACE_LOB, "MAX_LENGTH_INPLACE_LOB");
46         setType(COMPRESS_LOB, "COMPRESS_LOB");
47         setType(ALLOW_LITERALS, "ALLOW_LITERALS");
48         setType(MULTI_THREADED, "MULTI_THREADED");
49         setType(SCHEMA, "SCHEMA");
50         setType(OPTIMIZE_REUSE_RESULTS, "OPTIMIZE_REUSE_RESULTS");
51     }
52
53     private static void setType(int type, String JavaDoc name) {
54         while(types.size()<=type) {
55             types.add(null);
56         }
57         types.set(type, name);
58     }
59
60     public static int getType(String JavaDoc name) {
61         for(int i=0; i<types.size(); i++) {
62             if(name.equals(types.get(i))) {
63                 return i;
64             }
65         }
66         return -1;
67     }
68
69     public static ObjectArray getSettings() {
70         return types;
71     }
72
73     public static String JavaDoc getTypeName(int type) {
74         return (String JavaDoc)types.get(type);
75     }
76
77 }
78
Popular Tags