KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > cjdbc > common > sql > ParsingGranularities


1 /**
2  * C-JDBC: Clustered JDBC.
3  * Copyright (C) 2002-2004 French National Institute For Research In Computer
4  * Science And Control (INRIA).
5  * Contact: c-jdbc@objectweb.org
6  *
7  * This library is free software; you can redistribute it and/or modify it
8  * under the terms of the GNU Lesser General Public License as published by the
9  * Free Software Foundation; either version 2.1 of the License, or any later
10  * version.
11  *
12  * This library is distributed in the hope that it will be useful, but WITHOUT
13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15  * for more details.
16  *
17  * You should have received a copy of the GNU Lesser General Public License
18  * along with this library; if not, write to the Free Software Foundation,
19  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
20  *
21  * Initial developer(s): Emmanuel Cecchet.
22  * Contributor(s): Sara Bouchenak.
23  */

24
25 package org.objectweb.cjdbc.common.sql;
26
27 /**
28  * Defines SQL queries parsing granularities.
29  *
30  * @author <a HREF="mailto:Emmanuel.Cecchet@inria.fr">Emmanuel Cecchet</a>
31  * @author <a HREF="mailto:Sara.Bouchenak@epfl.ch">Sara Bouchenak</a>
32  * @version 1.0
33  */

34 public class ParsingGranularities
35 {
36   /** The request is not parsed. */
37   public static final int NO_PARSING = 0;
38
39   /**
40    * Table granularity. Only table dependencies are computed.
41    */

42   public static final int TABLE = 1;
43
44   /**
45    * Column granularity. Column dependencies are computed (both select and
46    * where clauses).
47    */

48   public static final int COLUMN = 2;
49
50   /**
51    * Column granularity with <code>UNIQUE</code> queries.
52    *
53    * <p>
54    * Same as <code>COLUMN</code> except that <code>UNIQUE</code> queries
55    * that select a single row based on a key are flagged <code>UNIQUE</code>
56    * (and should not be invalidated on <code>INSERTs</code>).
57    */

58   public static final int COLUMN_UNIQUE = 3;
59
60   /**
61    * Returns the granularity value in a <code>String</code> form.
62    *
63    * @param granularity a granularity value
64    * @return the <code>String</code> form of the granularity
65    */

66   public static String JavaDoc getInformation(int granularity)
67   {
68     switch (granularity)
69     {
70       case NO_PARSING :
71         return "NO_PARSING";
72       case TABLE :
73         return "TABLE";
74       case COLUMN :
75         return "COLUMN";
76       case COLUMN_UNIQUE :
77         return "COLUMN_UNIQUE";
78       default :
79         return "Illegal parsing granularity";
80     }
81   }
82 }
83
Popular Tags