1 22 23 package org.xquark.extractor.sql; 24 25 26 public class SqlFunAggregate extends SqlUnaryOperator 27 { 28 29 private static final String RCSRevision = "$Revision: 1.4 $"; 30 private static final String RCSName = "$Name: $"; 31 32 private boolean _distinct; 33 private int _operator; 34 35 41 public SqlFunAggregate(int operator, SqlExpression operand, boolean distinct) 42 { 43 44 super ( operand ); 45 setDistinct (distinct ); 46 setOperator (operator) ; 47 } 48 49 52 public SqlFunAggregate() 53 { 54 55 } 56 57 61 public boolean getDistinct() 62 { 63 return _distinct ; 64 } 65 66 70 public void setDistinct(boolean distinct) 71 { 72 _distinct = distinct ; 73 } 74 75 79 public void setOperator(int operator) 80 { 81 _operator = operator ; 82 } 83 84 88 public int getOperator() 89 { 90 return _operator ; 91 } 92 93 97 public String toSql(Context context) 98 { 99 StringBuffer retVal = new StringBuffer (); 102 103 retVal.append( AGGREGATEOPS[_operator]); 104 retVal.append("("); 105 if ( _distinct ) 106 { 107 retVal.append("DISTINCT "); 108 } 109 retVal.append(getOperand().toSql(context)); 110 retVal.append(")"); 111 112 return retVal.toString() ; 115 } 116 } 117 | Popular Tags |