KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Special case of an 'and' where the expressions are all part of a join.
19  * This does not put each expression on its own line.
20  */

21 public class AndJoinExp extends AndExp {
22
23     public AndJoinExp(SqlExp children) {
24         super(children);
25     }
26
27     public AndJoinExp() {
28     }
29
30     public SqlExp createInstance() {
31         return new AndJoinExp();
32     }
33
34     /**
35      * Append SQL for this node to s.
36      *
37      * @param driver The driver being used
38      * @param s Append the SQL here
39      * @param leftSibling
40      */

41     public void appendSQLImp(SqlDriver driver, CharBuf s, SqlExp leftSibling) {
42         childList.appendSQL(driver, s, null);
43         SqlExp prev = childList;
44         for (SqlExp e = childList.next; e != null; prev = e, e = e.next) {
45             s.append(" and ");
46             e.appendSQL(driver, s, prev);
47         }
48     }
49
50     /**
51      * Make us an outer join or not. This is a NOP except for JoinExp and
52      * AndJoinExp.
53      * @see JoinExp
54      * @see AndJoinExp
55      */

56     public void setOuter(boolean on) {
57         for (SqlExp e = childList; e != null; e = e.next) {
58             e.setOuter(on);
59         }
60     }
61
62 }
63
64
Popular Tags