1 | /* |
2 | * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0, |
3 | * and the EPL 1.0 (http://h2database.com/html/license.html). |
4 | * Initial Developer: H2 Group |
5 | */ |
6 | package org.h2.command.dml; |
7 | |
8 | import java.util.ArrayList; |
9 | import org.h2.util.New; |
10 | |
11 | /** |
12 | * The list of setting for a SET statement. |
13 | */ |
14 | public class SetTypes { |
15 | |
16 | /** |
17 | * The type of a SET IGNORECASE statement. |
18 | */ |
19 | public static final int IGNORECASE = 1; |
20 | |
21 | /** |
22 | * The type of a SET MAX_LOG_SIZE statement. |
23 | */ |
24 | public static final int MAX_LOG_SIZE = 2; |
25 | |
26 | /** |
27 | * The type of a SET MODE statement. |
28 | */ |
29 | public static final int MODE = 3; |
30 | |
31 | /** |
32 | * The type of a SET READONLY statement. |
33 | */ |
34 | public static final int READONLY = 4; |
35 | |
36 | /** |
37 | * The type of a SET LOCK_TIMEOUT statement. |
38 | */ |
39 | public static final int LOCK_TIMEOUT = 5; |
40 | |
41 | /** |
42 | * The type of a SET DEFAULT_LOCK_TIMEOUT statement. |
43 | */ |
44 | public static final int DEFAULT_LOCK_TIMEOUT = 6; |
45 | |
46 | /** |
47 | * The type of a SET DEFAULT_TABLE_TYPE statement. |
48 | */ |
49 | public static final int DEFAULT_TABLE_TYPE = 7; |
50 | |
51 | /** |
52 | * The type of a SET CACHE_SIZE statement. |
53 | */ |
54 | public static final int CACHE_SIZE = 8; |
55 | |
56 | /** |
57 | * The type of a SET TRACE_LEVEL_SYSTEM_OUT statement. |
58 | */ |
59 | public static final int TRACE_LEVEL_SYSTEM_OUT = 9; |
60 | |
61 | /** |
62 | * The type of a SET TRACE_LEVEL_FILE statement. |
63 | */ |
64 | public static final int TRACE_LEVEL_FILE = 10; |
65 | |
66 | /** |
67 | * The type of a SET TRACE_MAX_FILE_SIZE statement. |
68 | */ |
69 | public static final int TRACE_MAX_FILE_SIZE = 11; |
70 | |
71 | /** |
72 | * The type of a SET COLLATION statement. |
73 | */ |
74 | public static final int COLLATION = 12; |
75 | |
76 | /** |
77 | * The type of a SET CLUSTER statement. |
78 | */ |
79 | public static final int CLUSTER = 13; |
80 | |
81 | /** |
82 | * The type of a SET WRITE_DELAY statement. |
83 | */ |
84 | public static final int WRITE_DELAY = 14; |
85 | |
86 | /** |
87 | * The type of a SET DATABASE_EVENT_LISTENER statement. |
88 | */ |
89 | public static final int DATABASE_EVENT_LISTENER = 15; |
90 | |
91 | /** |
92 | * The type of a SET MAX_MEMORY_ROWS statement. |
93 | */ |
94 | public static final int MAX_MEMORY_ROWS = 16; |
95 | |
96 | /** |
97 | * The type of a SET LOCK_MODE statement. |
98 | */ |
99 | public static final int LOCK_MODE = 17; |
100 | |
101 | /** |
102 | * The type of a SET DB_CLOSE_DELAY statement. |
103 | */ |
104 | public static final int DB_CLOSE_DELAY = 18; |
105 | |
106 | /** |
107 | * The type of a SET LOG statement. |
108 | */ |
109 | public static final int LOG = 19; |
110 | |
111 | /** |
112 | * The type of a SET THROTTLE statement. |
113 | */ |
114 | public static final int THROTTLE = 20; |
115 | |
116 | /** |
117 | * The type of a SET MAX_MEMORY_UNDO statement. |
118 | */ |
119 | public static final int MAX_MEMORY_UNDO = 21; |
120 | |
121 | /** |
122 | * The type of a SET MAX_LENGTH_INPLACE_LOB statement. |
123 | */ |
124 | public static final int MAX_LENGTH_INPLACE_LOB = 22; |
125 | |
126 | /** |
127 | * The type of a SET COMPRESS_LOB statement. |
128 | */ |
129 | public static final int COMPRESS_LOB = 23; |
130 | |
131 | /** |
132 | * The type of a SET ALLOW_LITERALS statement. |
133 | */ |
134 | public static final int ALLOW_LITERALS = 24; |
135 | |
136 | /** |
137 | * The type of a SET MULTI_THREADED statement. |
138 | */ |
139 | public static final int MULTI_THREADED = 25; |
140 | |
141 | /** |
142 | * The type of a SET SCHEMA statement. |
143 | */ |
144 | public static final int SCHEMA = 26; |
145 | |
146 | /** |
147 | * The type of a SET OPTIMIZE_REUSE_RESULTS statement. |
148 | */ |
149 | public static final int OPTIMIZE_REUSE_RESULTS = 27; |
150 | |
151 | /** |
152 | * The type of a SET SCHEMA_SEARCH_PATH statement. |
153 | */ |
154 | public static final int SCHEMA_SEARCH_PATH = 28; |
155 | |
156 | /** |
157 | * The type of a SET UNDO_LOG statement. |
158 | */ |
159 | public static final int UNDO_LOG = 29; |
160 | |
161 | /** |
162 | * The type of a SET REFERENTIAL_INTEGRITY statement. |
163 | */ |
164 | public static final int REFERENTIAL_INTEGRITY = 30; |
165 | |
166 | /** |
167 | * The type of a SET MVCC statement. |
168 | */ |
169 | public static final int MVCC = 31; |
170 | |
171 | /** |
172 | * The type of a SET MAX_OPERATION_MEMORY statement. |
173 | */ |
174 | public static final int MAX_OPERATION_MEMORY = 32; |
175 | |
176 | /** |
177 | * The type of a SET EXCLUSIVE statement. |
178 | */ |
179 | public static final int EXCLUSIVE = 33; |
180 | |
181 | /** |
182 | * The type of a SET CREATE_BUILD statement. |
183 | */ |
184 | public static final int CREATE_BUILD = 34; |
185 | |
186 | /** |
187 | * The type of a SET \@VARIABLE statement. |
188 | */ |
189 | public static final int VARIABLE = 35; |
190 | |
191 | /** |
192 | * The type of a SET QUERY_TIMEOUT statement. |
193 | */ |
194 | public static final int QUERY_TIMEOUT = 36; |
195 | |
196 | /** |
197 | * The type of a SET REDO_LOG_BINARY statement. |
198 | */ |
199 | public static final int REDO_LOG_BINARY = 37; |
200 | |
201 | /** |
202 | * The type of a SET BINARY_COLLATION statement. |
203 | */ |
204 | public static final int BINARY_COLLATION = 38; |
205 | |
206 | /** |
207 | * The type of a SET JAVA_OBJECT_SERIALIZER statement. |
208 | */ |
209 | public static final int JAVA_OBJECT_SERIALIZER = 39; |
210 | |
211 | /** |
212 | * The type of a SET RETENTION_TIME statement. |
213 | */ |
214 | public static final int RETENTION_TIME = 40; |
215 | |
216 | /** |
217 | * The type of a SET QUERY_STATISTICS_ACTIVE statement. |
218 | */ |
219 | public static final int QUERY_STATISTICS = 41; |
220 | |
221 | private static final ArrayList<String> TYPES = New.arrayList(); |
222 | |
223 | private SetTypes() { |
224 | // utility class |
225 | } |
226 | |
227 | static { |
228 | ArrayList<String> list = TYPES; |
229 | list.add(null); |
230 | list.add(IGNORECASE, "IGNORECASE"); |
231 | list.add(MAX_LOG_SIZE, "MAX_LOG_SIZE"); |
232 | list.add(MODE, "MODE"); |
233 | list.add(READONLY, "READONLY"); |
234 | list.add(LOCK_TIMEOUT, "LOCK_TIMEOUT"); |
235 | list.add(DEFAULT_LOCK_TIMEOUT, "DEFAULT_LOCK_TIMEOUT"); |
236 | list.add(DEFAULT_TABLE_TYPE, "DEFAULT_TABLE_TYPE"); |
237 | list.add(CACHE_SIZE, "CACHE_SIZE"); |
238 | list.add(TRACE_LEVEL_SYSTEM_OUT, "TRACE_LEVEL_SYSTEM_OUT"); |
239 | list.add(TRACE_LEVEL_FILE, "TRACE_LEVEL_FILE"); |
240 | list.add(TRACE_MAX_FILE_SIZE, "TRACE_MAX_FILE_SIZE"); |
241 | list.add(COLLATION, "COLLATION"); |
242 | list.add(CLUSTER, "CLUSTER"); |
243 | list.add(WRITE_DELAY, "WRITE_DELAY"); |
244 | list.add(DATABASE_EVENT_LISTENER, "DATABASE_EVENT_LISTENER"); |
245 | list.add(MAX_MEMORY_ROWS, "MAX_MEMORY_ROWS"); |
246 | list.add(LOCK_MODE, "LOCK_MODE"); |
247 | list.add(DB_CLOSE_DELAY, "DB_CLOSE_DELAY"); |
248 | list.add(LOG, "LOG"); |
249 | list.add(THROTTLE, "THROTTLE"); |
250 | list.add(MAX_MEMORY_UNDO, "MAX_MEMORY_UNDO"); |
251 | list.add(MAX_LENGTH_INPLACE_LOB, "MAX_LENGTH_INPLACE_LOB"); |
252 | list.add(COMPRESS_LOB, "COMPRESS_LOB"); |
253 | list.add(ALLOW_LITERALS, "ALLOW_LITERALS"); |
254 | list.add(MULTI_THREADED, "MULTI_THREADED"); |
255 | list.add(SCHEMA, "SCHEMA"); |
256 | list.add(OPTIMIZE_REUSE_RESULTS, "OPTIMIZE_REUSE_RESULTS"); |
257 | list.add(SCHEMA_SEARCH_PATH, "SCHEMA_SEARCH_PATH"); |
258 | list.add(UNDO_LOG, "UNDO_LOG"); |
259 | list.add(REFERENTIAL_INTEGRITY, "REFERENTIAL_INTEGRITY"); |
260 | list.add(MVCC, "MVCC"); |
261 | list.add(MAX_OPERATION_MEMORY, "MAX_OPERATION_MEMORY"); |
262 | list.add(EXCLUSIVE, "EXCLUSIVE"); |
263 | list.add(CREATE_BUILD, "CREATE_BUILD"); |
264 | list.add(VARIABLE, "@"); |
265 | list.add(QUERY_TIMEOUT, "QUERY_TIMEOUT"); |
266 | list.add(REDO_LOG_BINARY, "REDO_LOG_BINARY"); |
267 | list.add(BINARY_COLLATION, "BINARY_COLLATION"); |
268 | list.add(JAVA_OBJECT_SERIALIZER, "JAVA_OBJECT_SERIALIZER"); |
269 | list.add(RETENTION_TIME, "RETENTION_TIME"); |
270 | list.add(QUERY_STATISTICS, "QUERY_STATISTICS"); |
271 | } |
272 | |
273 | /** |
274 | * Get the set type number. |
275 | * |
276 | * @param name the set type name |
277 | * @return the number |
278 | */ |
279 | public static int getType(String name) { |
280 | for (int i = 0; i < getTypes().size(); i++) { |
281 | if (name.equals(getTypes().get(i))) { |
282 | return i; |
283 | } |
284 | } |
285 | return -1; |
286 | } |
287 | |
288 | public static ArrayList<String> getTypes() { |
289 | return TYPES; |
290 | } |
291 | |
292 | /** |
293 | * Get the set type name. |
294 | * |
295 | * @param type the type number |
296 | * @return the name |
297 | */ |
298 | public static String getTypeName(int type) { |
299 | return getTypes().get(type); |
300 | } |
301 | |
302 | } |