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 AnyExpr extends AbstractAmberExpr { 40 private SelectQuery _query; 41 42 public AnyExpr(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 generateInternalWhere(cb, true); 77 } 78 79 82 public void generateUpdateWhere(CharBuffer cb) 83 { 84 generateInternalWhere(cb, false); 85 } 86 87 90 public void generateHaving(CharBuffer cb) 91 { 92 generateWhere(cb); 93 } 94 95 98 private void generateInternalWhere(CharBuffer cb, 99 boolean select) 100 { 101 cb.append("ANY("); 102 cb.append(_query.generateLoadSQL()); 103 cb.append(')'); 104 } 105 } 106 | Popular Tags |