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 not exists sub select.
18: */
19: public class NotExistsExp extends SelectExp {
20:
21: public NotExistsExp() {
22: }
23:
24: public SqlExp createInstance() {
25: return new NotExistsExp();
26: }
27:
28: public String toString() {
29: return super .toString();
30: }
31:
32: /**
33: * Append SQL for this node to s.
34: *
35: * @param driver The driver being used
36: * @param s Append the SQL here
37: * @param leftSibling
38: */
39: public void appendSQLImp(SqlDriver driver, CharBuf s,
40: SqlExp leftSibling) {
41: s.append("not exists (");
42: super .appendSQLImp(driver, s, leftSibling);
43: s.append(')');
44: }
45:
46: /**
47: * Check that the select list is valid.
48: */
49: protected void finishSelectList(CharBuf s, int start) {
50: int n = s.size() - start;
51: if (n <= 7) {
52: s.append('1');
53: } else {
54: s.setSize(n - 2); // remove the extra comma and space
55: }
56: }
57: }
|