KickJava   Java API By Example, From Geeks To Geeks.

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


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.sql.SqlDriver;
15 import com.versant.core.util.CharBuf;
16
17 /**
18  * An expression with one child.
19  */

20 public class UnaryExp extends SqlExp {
21
22     public UnaryExp(SqlExp child) {
23         super(child);
24     }
25
26     public UnaryExp() {
27     }
28
29     public SqlExp createInstance() {
30         return new UnaryExp();
31     }
32
33     /**
34      * Create an aliases for any tables we may have.
35      */

36     public int createAlias(int index) {
37         return childList.createAlias(index);
38     }
39
40     /**
41      * Append SQL for this node to s.
42      *
43      * @param driver The driver being used
44      * @param s Append the SQL here
45      * @param leftSibling
46      */

47     public void appendSQLImp(SqlDriver driver, CharBuf s, SqlExp leftSibling) {
48         childList.appendSQL(driver, s, null);
49     }
50
51     /**
52      * Normalize this node i.e. transform it into its simplist possible form.
53      * This will turn sub selects into joins and so on.
54      */

55     public SqlExp normalize(SqlDriver driver, SelectExp sel, boolean convertExists) {
56         SqlExp r = childList.normalize(driver, sel, convertExists);
57         if (r != null) childList = r;
58         return null;
59     }
60
61     /**
62      * Replace any references to old with nw. This is used when redundant
63      * joins are removed.
64      */

65     public void replaceSelectExpRef(SelectExp old, SelectExp nw) {
66         childList.replaceSelectExpRef(old, nw);
67     }
68
69     /**
70      * What is the JDBC type of this expression (0 if unknown)?
71      */

72     public int getJdbcType() {
73         return childList.getJdbcType();
74     }
75
76     /**
77      * What is the java type code of this expression (0 if unknown)?
78      */

79     public int getJavaTypeCode() {
80         return childList.getJavaTypeCode();
81     }
82 }
83
84
Popular Tags