01: /**
02: * Sequoia: Database clustering technology.
03: * Copyright (C) 2002-2004 French National Institute For Research In Computer
04: * Science And Control (INRIA).
05: * Contact: sequoia@continuent.org
06: *
07: * Licensed under the Apache License, Version 2.0 (the "License");
08: * you may not use this file except in compliance with the License.
09: * You may obtain a copy of the License at
10: *
11: * http://www.apache.org/licenses/LICENSE-2.0
12: *
13: * Unless required by applicable law or agreed to in writing, software
14: * distributed under the License is distributed on an "AS IS" BASIS,
15: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16: * See the License for the specific language governing permissions and
17: * limitations under the License.
18: *
19: * Initial developer(s): Emmanuel Cecchet.
20: * Contributor(s): Sara Bouchenak.
21: */package org.continuent.sequoia.controller.requests;
22:
23: /**
24: * Defines SQL queries parsing granularities.
25: *
26: * @author <a href="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
27: * @author <a href="mailto:Sara.Bouchenak@epfl.ch">Sara Bouchenak</a>
28: * @version 1.0
29: */
30: public class ParsingGranularities {
31: /** The request is not parsed. */
32: public static final int NO_PARSING = 0;
33:
34: /**
35: * Table granularity. Only table dependencies are computed.
36: */
37: public static final int TABLE = 1;
38:
39: /**
40: * Column granularity. Column dependencies are computed (both select and where
41: * clauses).
42: */
43: public static final int COLUMN = 2;
44:
45: /**
46: * Column granularity with <code>UNIQUE</code> queries.
47: * <p>
48: * Same as <code>COLUMN</code> except that <code>UNIQUE</code> queries
49: * that select a single row based on a key are flagged <code>UNIQUE</code>
50: * (and should not be invalidated on <code>INSERTs</code>).
51: */
52: public static final int COLUMN_UNIQUE = 3;
53:
54: /**
55: * Returns the granularity value in a <code>String</code> form.
56: *
57: * @param granularity a granularity value
58: * @return the <code>String</code> form of the granularity
59: */
60: public static String getInformation(int granularity) {
61: switch (granularity) {
62: case NO_PARSING:
63: return "NO_PARSING";
64: case TABLE:
65: return "TABLE";
66: case COLUMN:
67: return "COLUMN";
68: case COLUMN_UNIQUE:
69: return "COLUMN_UNIQUE";
70: default:
71: return "Illegal parsing granularity";
72: }
73: }
74: }
|