01: /*
02: * Copyright (c) 1998 - 2005 Versant Corporation
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * Versant Corporation - initial API and implementation
10: */
11: package com.versant.core.jdbc.sql.exp;
12:
13: import com.versant.core.jdbc.sql.SqlDriver;
14: import com.versant.core.util.CharBuf;
15:
16: /**
17: * Special case of an 'and' where the expressions are all part of a join.
18: * This does not put each expression on its own line.
19: */
20: public class AndJoinExp extends AndExp {
21:
22: public AndJoinExp(SqlExp children) {
23: super (children);
24: }
25:
26: public AndJoinExp() {
27: }
28:
29: public SqlExp createInstance() {
30: return new AndJoinExp();
31: }
32:
33: /**
34: * Append SQL for this node to s.
35: *
36: * @param driver The driver being used
37: * @param s Append the SQL here
38: * @param leftSibling
39: */
40: public void appendSQLImp(SqlDriver driver, CharBuf s,
41: 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: }
|