1 28 29 package com.caucho.amber.expr; 30 31 import com.caucho.amber.query.FromItem; 32 import com.caucho.amber.query.QueryParser; 33 import com.caucho.amber.query.SelectQuery; 34 import com.caucho.util.CharBuffer; 35 36 39 public class ExistsExpr extends AbstractAmberExpr { 40 private SelectQuery _query; 41 42 public ExistsExpr(SelectQuery query) 43 { 44 _query = query; 45 } 46 47 50 public AmberExpr bindSelect(QueryParser parser) 51 { 52 return this; 53 } 54 55 58 public boolean isBoolean() 59 { 60 return true; 61 } 62 63 66 public boolean usesFrom(FromItem from, int type, boolean isNot) 67 { 68 return _query.usesFrom(from, type); 69 } 70 71 74 public void generateWhere(CharBuffer cb) 75 { 76 cb.append("EXISTS("); 77 cb.append(_query.generateLoadSQL(false)); 78 cb.append(')'); 79 } 80 81 84 public void generateUpdateWhere(CharBuffer cb) 85 { 86 generateWhere(cb); 87 } 88 89 92 public void generateHaving(CharBuffer cb) 93 { 94 generateWhere(cb); 95 } 96 } 97 | Popular Tags |