1 21 22 package org.apache.derby.impl.sql.compile; 23 24 import org.apache.derby.iapi.sql.conn.LanguageConnectionContext; 25 import org.apache.derby.iapi.services.sanity.SanityManager; 26 27 import org.apache.derby.impl.sql.execute.MaxMinAggregator; 28 29 import org.apache.derby.catalog.TypeDescriptor; 30 import org.apache.derby.iapi.types.TypeId; 31 import org.apache.derby.iapi.types.DataTypeDescriptor; 32 import org.apache.derby.iapi.types.NumberDataValue; 33 34 import org.apache.derby.iapi.error.StandardException; 35 36 import org.apache.derby.iapi.services.context.ContextService; 37 import org.apache.derby.iapi.reference.ClassName; 38 39 44 public class MaxMinAggregateDefinition 45 implements AggregateDefinition 46 { 47 private boolean isMax; 48 49 53 public MaxMinAggregateDefinition() { super(); } 54 55 68 public final TypeDescriptor getAggregator(TypeDescriptor inputType, 69 StringBuffer aggregatorClass) 70 { 71 LanguageConnectionContext lcc = (LanguageConnectionContext) 72 ContextService.getContext(LanguageConnectionContext.CONTEXT_ID); 73 74 77 DataTypeDescriptor dts = new DataTypeDescriptor((DataTypeDescriptor) inputType, true); 78 TypeId compType = dts.getTypeId(); 79 80 85 if (compType.orderable( 86 lcc.getLanguageConnectionFactory().getClassFactory())) 87 { 88 aggregatorClass.append(ClassName.MaxMinAggregator); 89 90 return dts; 91 } 92 return null; 93 } 94 95 98 public final void setMaxOrMin(boolean isMax) 99 { 100 this.isMax = isMax; 101 } 102 103 108 public final boolean isMax() 109 { 110 return(isMax); 111 } 112 } 113 | Popular Tags |