KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdbc > sql > exp > SqlParamUsage


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.jdbc.sql.exp;
13
14 import com.versant.core.jdbc.metadata.JdbcField;
15 import com.versant.core.jdbc.metadata.JdbcColumn;
16
17 import java.util.Map JavaDoc;
18
19 /**
20  * This tracks usage of this parameter in an SqlExp tree.
21  * A parameter may be used several times in the same tree if it is
22  * used more than once in the original filter expression. This will be
23  * null if the param is not used.<p>
24  *
25  * A parameter may also have to be split into more than one SqlExp
26  * if it is compared to a field with multiple columns. The first
27  * expression is expList. The expcount field specifies how far down
28  * the list to go as expList may be part of a larger list.
29  *
30  * @see com.versant.core.jdo.query.ParamNode#usageList
31  */

32 public class SqlParamUsage {
33
34     /**
35      * The field for this parameter or null if it is not being compared
36      * to a field.
37      * @see #javaTypeCode
38      * @see #jdbcType
39      */

40     public JdbcField jdbcField;
41
42     public JdbcColumn col;
43     /**
44      * The java type code of this usage of the parameter. This is not
45      * set if jdbcField is not null.
46      * @see #jdbcField
47      */

48     public int javaTypeCode;
49     /**
50      * The JDBC type of this usage of the parameter. This is not
51      * set if jdbcField is not null.
52      * @see java.sql.Types
53      * @see #jdbcField
54      */

55     public int jdbcType;
56     /**
57      * The class index of the class for this parameter (-1 if unknown).
58      * This is used for OID parameters compared to columns that are
59      * not associated with a field e.g. in a link table.
60      */

61     public int classIndex;
62     /**
63      * The first expression for this usage of the parameter. This is
64      * the parent of the first ParamExp instance for this usage.
65      */

66     public SqlExp expList;
67     /**
68      * The number of expressions in expList for this usage of the
69      * parameter. If a param is used with a field split over multiple
70      * columns then this will be more than 1. This will be zero if
71      * the parameter never has to be converted into a 'is null' or
72      * 'is not null' expression.
73      */

74     public int expCount;
75     /**
76      * How must the parameter value be modified before being set? This is
77      * used for startsWith and endsWith for databases that do not allow
78      * expressions on the right hand side of a LIKE (e.g. Informix).
79      * @see com.versant.core.jdbc.query.SqlStruct.Param#MOD_APPEND_PERCENT
80      */

81     public int mod;
82     /**
83      * The next usage in the list.
84      */

85     public SqlParamUsage next;
86
87     public SqlParamUsage getClone(Map JavaDoc cloneMap) {
88         SqlParamUsage sqlUsage = new SqlParamUsage();
89         sqlUsage.jdbcField = jdbcField;
90         sqlUsage.javaTypeCode = javaTypeCode;
91         sqlUsage.jdbcType = jdbcType;
92         sqlUsage.classIndex = classIndex;
93         sqlUsage.expCount = expCount;
94         sqlUsage.mod = mod;
95         sqlUsage.expList = SqlExp.createClone(expList, cloneMap);
96         if (next != null) {
97             sqlUsage.next = next.getClone(cloneMap);
98         }
99         return sqlUsage;
100     }
101 }
102
103
Popular Tags