1 22 23 package org.xquark.extractor.sql; 24 25 26 public class SqlUnOpExists extends SqlUnaryOperator 27 { 28 29 private static final String RCSRevision = "$Revision: 1.4 $"; 30 private static final String RCSName = "$Name: $"; 31 32 private boolean _notExists; 33 34 39 public SqlUnOpExists(SqlExpression query, boolean notExists) 40 { 41 super ( query ) ; 42 setNot ( notExists ) ; 43 } 44 45 49 public SqlUnOpExists(SqlExpression query) 50 { 51 super ( query ) ; 52 setNot ( false ) ; 53 } 54 55 58 public SqlUnOpExists() 59 { 60 61 } 62 63 67 public void setNot(boolean notExists) 68 { 69 _notExists = notExists ; 70 } 71 72 76 public boolean getNot() 77 { 78 return _notExists ; 79 } 80 81 85 public String toSql(Context context) 86 { 87 89 StringBuffer retVal = new StringBuffer (); 90 if ( _notExists ) 91 { 92 retVal.append("NOT EXISTS ( "); 93 } 94 else 95 { 96 retVal.append("EXISTS ( "); 97 } 98 99 retVal.append(getOperand().toSql(context)); 100 retVal.append(" )"); 101 102 return retVal.toString(); 104 } 105 } 106 | Popular Tags |