1 22 23 package org.xquark.extractor.sql; 24 25 26 public class SqlBinOpLike extends SqlBinaryOperator 27 { 28 29 private static final String RCSRevision = "$Revision: 1.4 $"; 30 private static final String RCSName = "$Name: $"; 31 32 private boolean _not = false; 33 34 40 public SqlBinOpLike(SqlExpression leftOperand, SqlExpression rightOperand, boolean not) 41 { 42 super ( leftOperand, rightOperand ); 43 setNot ( not ) ; 44 } 45 46 50 public SqlBinOpLike() 51 { 52 53 } 54 55 59 public void setNot(boolean not) 60 { 61 _not = not ; 62 } 63 64 68 public boolean getNot() 69 { 70 return _not ; 71 } 72 73 77 public String toSql(Context context) 78 { 79 81 StringBuffer retVal = new StringBuffer (); 82 83 retVal.append("("); 84 retVal.append(getLeftOperand().toSql(context)); 85 retVal.append(")"); 86 if ( _not ) 87 { 88 retVal.append(" NOT LIKE ") ; 89 } 90 else 91 { 92 retVal.append(" LIKE "); 93 } 94 95 retVal.append("("); 96 retVal.append(getRightOperand().toSql(context)); 97 retVal.append(")"); 98 99 return retVal.toString(); 101 } 102 } 103 | Popular Tags |