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.util.CharBuf;
14: import com.versant.core.jdbc.sql.SqlDriver;
15:
16: /**
17: * An 'in' expression.
18: */
19: public class InExp extends SqlExp {
20:
21: public InExp(SqlExp children) {
22: super (children);
23: }
24:
25: public InExp() {
26: }
27:
28: public SqlExp createInstance() {
29: return new InExp();
30: }
31:
32: /**
33: * If this expression is added to an AndExp should it be enclosed in
34: * parenthesis?
35: */
36: public boolean requiresParensInAnd() {
37: return false;
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,
48: SqlExp leftSibling) {
49: childList.appendSQL(driver, s, null);
50: s.append(" IN (");
51: SqlExp e = childList.next;
52: e.appendSQL(driver, s, null);
53: for (e = e.next; e != null; e = e.next) {
54: s.append(',');
55: s.append(' ');
56: e.appendSQL(driver, s, null);
57: }
58: s.append(')');
59: }
60:
61: }
|