avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hamm...@apache.org
Subject cvs commit: jakarta-avalon-cornerstone/apps/db/src/scripts/lxsql Test2.script
Date Wed, 02 Jan 2002 20:03:34 GMT
hammant     02/01/02 12:03:34

  Modified:    apps/db/src/java/org/apache/avalon/db/basic/actions
                        TestHelper.java
               apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql
                        SelectColumnHelper.java
               apps/db/src/java/org/apache/avalon/db/data Column.java
               apps/db/src/java/org/apache/avalon/db/data/impl
                        AbstractDelegatedColumn.java
                        DefaultAggregateAveColumn.java
                        DefaultAggregateMaxColumn.java
                        DefaultAggregateMinColumn.java
                        DefaultAggregateSumColumn.java
                        DefaultDelegatedNumericColumn.java
               apps/db/src/java/org/apache/avalon/db/data/types
                        NumericColumn.java
               apps/db/src/java/org/apache/avalon/db/functions
                        TemporalFunction.java
               apps/db/src/java/org/apache/avalon/db/functions/impl
                        AbstractFunction.java
                        AbstractTemporalIntegerFunction.java
               apps/db/src/scripts/lxsql Test2.script
  Added:       apps/db/src/java/org/apache/avalon/db/data/impl
                        AbstractDelegatedNumericColumn.java
                        DefaultContrivedDateFunctionColumn.java
                        DefaultContrivedTimeFunctionColumn.java
                        DefaultContrivedTimestampFunctionColumn.java
               apps/db/src/java/org/apache/avalon/db/functions
                        DateFunction.java TimeFunction.java
                        TimestampFunction.java
               apps/db/src/java/org/apache/avalon/db/functions/impl
                        CurrentDateTemporalFunction.java
                        CurrentTimeTemporalFunction.java
                        CurrentTimestampTemporalFunction.java
  Log:
  Current Date,Time etc functions.
  Plus refactoring to support this change.
  
  Revision  Changes    Path
  1.7       +40 -40    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/TestHelper.java
  
  Index: TestHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/actions/TestHelper.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- TestHelper.java	17 Dec 2001 15:59:31 -0000	1.6
  +++ TestHelper.java	2 Jan 2002 20:03:33 -0000	1.7
  @@ -45,35 +45,35 @@
   
               if (lNumCol.getPrecesion() == Column.PREC_INT
                        || rNumCol.getPrecesion() == Column.PREC_INT) {
  -                if (lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) == 0) {
  +                if (((NumericColumn) lNumCol).toInteger(row).compareTo(((NumericColumn) rNumCol).toInteger(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_BIGDEC
                        || rNumCol.getPrecesion() == Column.PREC_BIGDEC) {
  -                if (lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) == 0) {
  +                if (((NumericColumn) lNumCol).toBigDecimal(row).compareTo(((NumericColumn) rNumCol).toBigDecimal(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_FLOAT
                        || rNumCol.getPrecesion() == Column.PREC_FLOAT) {
  -                if (lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) == 0) {
  +                if (((NumericColumn) lNumCol).toFloat(row).compareTo(((NumericColumn) rNumCol).toFloat(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_LONG
                        || rNumCol.getPrecesion() == Column.PREC_LONG) {
  -                if (lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_SHORT
                        || rNumCol.getPrecesion() == Column.PREC_SHORT) {
  -                if (lNumCol.toShort(row).compareTo(rNumCol.toShort(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toShort(row).compareTo(((NumericColumn)rNumCol).toShort(row)) == 0) {
                       return true;
                   } else {
                       return false;
  @@ -110,35 +110,35 @@
   
               if (lNumCol.getPrecesion() == Column.PREC_INT
                        || rNumCol.getPrecesion() == Column.PREC_INT) {
  -                if (lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) < 0) {
  +                if (((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) < 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_BIGDEC
                        || rNumCol.getPrecesion() == Column.PREC_BIGDEC) {
  -                if (lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) < 0) {
  +                if (((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) < 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_FLOAT
                        || rNumCol.getPrecesion() == Column.PREC_FLOAT) {
  -                if (lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) < 0) {
  +                if (((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) < 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_LONG
                        || rNumCol.getPrecesion() == Column.PREC_LONG) {
  -                if (lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) < 0) {
  +                if (((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) < 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_SHORT
                        || rNumCol.getPrecesion() == Column.PREC_SHORT) {
  -                if (lNumCol.toShort(row).compareTo(rNumCol.toShort(row)) < 0) {
  +                if (((NumericColumn)lNumCol).toShort(row).compareTo(((NumericColumn)rNumCol).toShort(row)) < 0) {
                       return true;
                   } else {
                       return false;
  @@ -180,35 +180,35 @@
   
               if (lNumCol.getPrecesion() == Column.PREC_INT
                        || rNumCol.getPrecesion() == Column.PREC_INT) {
  -                if (lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) > 0) {
  +                if (((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) > 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_BIGDEC
                        || rNumCol.getPrecesion() == Column.PREC_BIGDEC) {
  -                if (lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) > 0) {
  +                if (((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) > 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_FLOAT
                        || rNumCol.getPrecesion() == Column.PREC_FLOAT) {
  -                if (lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) > 0) {
  +                if (((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) > 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_LONG
                        || rNumCol.getPrecesion() == Column.PREC_LONG) {
  -                if (lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) > 0) {
  +                if (((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) > 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_SHORT
                        || rNumCol.getPrecesion() == Column.PREC_SHORT) {
  -                if (lNumCol.toShort(row).compareTo(rNumCol.toShort(row)) > 0) {
  +                if (((NumericColumn)lNumCol).toShort(row).compareTo(((NumericColumn)rNumCol).toShort(row)) > 0) {
                       return true;
                   } else {
                       return false;
  @@ -250,35 +250,35 @@
   
               if (lNumCol.getPrecesion() == Column.PREC_INT
                        || rNumCol.getPrecesion() == Column.PREC_INT) {
  -                if (lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) != 0) {
  +                if (((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) != 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_BIGDEC
                        || rNumCol.getPrecesion() == Column.PREC_BIGDEC) {
  -                if (lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) != 0) {
  +                if (((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) != 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_FLOAT
                        || rNumCol.getPrecesion() == Column.PREC_FLOAT) {
  -                if (lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) != 0) {
  +                if (((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) != 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_LONG
                        || rNumCol.getPrecesion() == Column.PREC_LONG) {
  -                if (lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) != 0) {
  +                if (((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) != 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_SHORT
                        || rNumCol.getPrecesion() == Column.PREC_SHORT) {
  -                if (lNumCol.toShort(row).compareTo(rNumCol.toShort(row)) != 0) {
  +                if (((NumericColumn)lNumCol).toShort(row).compareTo(((NumericColumn)rNumCol).toShort(row)) != 0) {
                       return true;
                   } else {
                       return false;
  @@ -331,40 +331,40 @@
   
               if (lNumCol.getPrecesion() == Column.PREC_INT
                        || rNumCol.getPrecesion() == Column.PREC_INT) {
  -                if (lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) > 0
  -                         || lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) > 0
  +                         || ((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_BIGDEC
                        || rNumCol.getPrecesion() == Column.PREC_BIGDEC) {
  -                if (lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) > 0
  -                         || lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) > 0
  +                         || ((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_FLOAT
                        || rNumCol.getPrecesion() == Column.PREC_FLOAT) {
  -                if (lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) > 0
  -                         || lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) > 0
  +                         || ((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_LONG
                        || rNumCol.getPrecesion() == Column.PREC_LONG) {
  -                if (lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) > 0
  -                         || lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) > 0
  +                         || ((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_SHORT
                        || rNumCol.getPrecesion() == Column.PREC_SHORT) {
  -                if (lNumCol.toShort(row).compareTo(rNumCol.toShort(row)) > 0
  -                         || lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toShort(row).compareTo(((NumericColumn)rNumCol).toShort(row)) > 0
  +                         || ((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) == 0) {
                       return true;
                   } else {
                       return false;
  @@ -407,40 +407,40 @@
   
               if (lNumCol.getPrecesion() == Column.PREC_INT
                        || rNumCol.getPrecesion() == Column.PREC_INT) {
  -                if (lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) < 0
  -                         || lNumCol.toInteger(row).compareTo(rNumCol.toInteger(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) < 0
  +                         || ((NumericColumn)lNumCol).toInteger(row).compareTo(((NumericColumn)rNumCol).toInteger(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_BIGDEC
                        || rNumCol.getPrecesion() == Column.PREC_BIGDEC) {
  -                if (lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) < 0
  -                         || lNumCol.toBigDecimal(row).compareTo(rNumCol.toBigDecimal(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) < 0
  +                         || ((NumericColumn)lNumCol).toBigDecimal(row).compareTo(((NumericColumn)rNumCol).toBigDecimal(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_FLOAT
                        || rNumCol.getPrecesion() == Column.PREC_FLOAT) {
  -                if (lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) < 0
  -                         || lNumCol.toFloat(row).compareTo(rNumCol.toFloat(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) < 0
  +                         || ((NumericColumn)lNumCol).toFloat(row).compareTo(((NumericColumn)rNumCol).toFloat(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_LONG
                        || rNumCol.getPrecesion() == Column.PREC_LONG) {
  -                if (lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) < 0
  -                         || lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) < 0
  +                         || ((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) == 0) {
                       return true;
                   } else {
                       return false;
                   }
               } else if (lNumCol.getPrecesion() == Column.PREC_SHORT
                        || rNumCol.getPrecesion() == Column.PREC_SHORT) {
  -                if (lNumCol.toShort(row).compareTo(rNumCol.toShort(row)) < 0
  -                         || lNumCol.toLong(row).compareTo(rNumCol.toLong(row)) == 0) {
  +                if (((NumericColumn)lNumCol).toShort(row).compareTo(((NumericColumn)rNumCol).toShort(row)) < 0
  +                         || ((NumericColumn)lNumCol).toLong(row).compareTo(((NumericColumn)rNumCol).toLong(row)) == 0) {
                       return true;
                   } else {
                       return false;
  
  
  
  1.6       +50 -55    jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/SelectColumnHelper.java
  
  Index: SelectColumnHelper.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/basic/handlers/lxsql/SelectColumnHelper.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- SelectColumnHelper.java	31 Dec 2001 06:59:43 -0000	1.5
  +++ SelectColumnHelper.java	2 Jan 2002 20:03:33 -0000	1.6
  @@ -20,6 +20,8 @@
   import org.apache.avalon.db.data.impl.DefaultStringConstantColumn;
   import org.apache.avalon.db.data.impl.DefaultContrivedVarcharFunctionColumn;
   import org.apache.avalon.db.data.impl.DefaultContrivedIntegerFunctionColumn;
  +import org.apache.avalon.db.data.impl.DefaultContrivedDateFunctionColumn;
  +import org.apache.avalon.db.data.impl.DefaultContrivedTimeFunctionColumn;
   import org.apache.avalon.db.data.Column;
   import org.apache.avalon.db.functions.impl.IntegerDivisionFunction;
   import org.apache.avalon.db.functions.impl.IntegerMultiplicationFunction;
  @@ -38,8 +40,13 @@
   import org.apache.avalon.db.functions.impl.YearIntegerFunction;
   import org.apache.avalon.db.functions.impl.LeadingTrimStringFunction;
   import org.apache.avalon.db.functions.impl.TrailingTrimStringFunction;
  +import org.apache.avalon.db.functions.impl.CurrentDateTemporalFunction;
   import org.apache.avalon.db.functions.StringFunction;
   import org.apache.avalon.db.functions.NumericFunction;
  +import org.apache.avalon.db.functions.Function;
  +import org.apache.avalon.db.functions.TimeFunction;
  +import org.apache.avalon.db.functions.DateFunction;
  +import org.apache.avalon.db.functions.TimestampFunction;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  @@ -52,7 +59,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class SelectColumnHelper {
   
  @@ -75,43 +82,45 @@
           if (nodeName.equals("column")) {
               return getSelectColumnColumn(queryable, elem);
           } else if (nodeName.equals("concat")) {
  -            return getStringColumnFromStringFunction(queryable, elem, new ConcatFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new ConcatFunction(), colHldr);
           } else if (nodeName.equals("const")) {
               return getColumnConst(queryable, elem, colHldr);
           } else if (nodeName.equals("trim")) {
               if (elem.getAttribute("type").equals("leading")) {
  -                return getStringColumnFromStringFunction(queryable, elem, new LeadingTrimStringFunction(), colHldr);
  +                return getColumnFromFunction(queryable, elem, new LeadingTrimStringFunction(), colHldr);
               } else if (elem.getAttribute("type").equals("trailing")) {
  -                return getStringColumnFromStringFunction(queryable, elem, new TrailingTrimStringFunction(), colHldr);
  +                return getColumnFromFunction(queryable, elem, new TrailingTrimStringFunction(), colHldr);
               } else {
  -                return getStringColumnFromStringFunction(queryable, elem, new TrimStringFunction(), colHldr);
  +                return getColumnFromFunction(queryable, elem, new TrimStringFunction(), colHldr);
               }
           } else if (nodeName.equals("lowercase")) {
  -            return getStringColumnFromStringFunction(queryable, elem, new LowerCaseStringFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new LowerCaseStringFunction(), colHldr);
           } else if (nodeName.equals("uppercase")) {
  -            return getStringColumnFromStringFunction(queryable, elem, new UpperCaseStringFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new UpperCaseStringFunction(), colHldr);
           } else if (nodeName.equals("position")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new PositionFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new PositionFunction(), colHldr);
           } else if (nodeName.equals("addition")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new IntegerAdditionFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new IntegerAdditionFunction(), colHldr);
           } else if (nodeName.equals("subtraction")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new IntegerSubtractionFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new IntegerSubtractionFunction(), colHldr);
           } else if (nodeName.equals("multiplication")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new IntegerMultiplicationFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new IntegerMultiplicationFunction(), colHldr);
           } else if (nodeName.equals("division")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new IntegerDivisionFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new IntegerDivisionFunction(), colHldr);
           } else if (nodeName.equals("hourofday")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new HourOfDayIntegerFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new HourOfDayIntegerFunction(), colHldr);
           } else if (nodeName.equals("dayofmonth")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new DayOfMonthIntegerFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new DayOfMonthIntegerFunction(), colHldr);
           } else if (nodeName.equals("minute")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new MinuteIntegerFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new MinuteIntegerFunction(), colHldr);
           } else if (nodeName.equals("month")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new MonthIntegerFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new MonthIntegerFunction(), colHldr);
           } else if (nodeName.equals("second")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new SecondIntegerFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new SecondIntegerFunction(), colHldr);
           } else if (nodeName.equals("year")) {
  -            return getIntegerColumnFromIntegerFunction(queryable, elem, new YearIntegerFunction(), colHldr);
  +            return getColumnFromFunction(queryable, elem, new YearIntegerFunction(), colHldr);
  +        } else if (nodeName.equals("currentdate")) {
  +            return getColumnFromFunction(queryable, elem, new CurrentDateTemporalFunction(), colHldr);
           } else {
               throw new ActionException("Unknown node type '"+nodeName+"' under 'columns'");
           }
  @@ -140,8 +149,8 @@
   
       }
   
  -    protected Column getStringColumnFromStringFunction(AbstractQueryable queryable,
  -            Element aElem, StringFunction function, ContrivedColumnNameHolder colHldr) throws ActionException {
  +    protected Column getColumnFromFunction(AbstractQueryable queryable,
  +            Element aElem, Function function, ContrivedColumnNameHolder colHldr) throws ActionException {
           String as = aElem.getAttribute("as");
           if (as.equals("")) {
               as = colHldr.getNextColumn();
  @@ -149,7 +158,7 @@
           // TODO as might be missing
           //return queryable.getColumn(name, true);
           int count = 0;
  -        if (aElem.hasChildNodes()) {
  +        if (aElem.hasChildNodes() | function.getMinCols() > 0) {
               NodeList subConcatNodes = aElem.getChildNodes();
               Vector colVec = new Vector();
               for (int j=0; j < subConcatNodes.getLength(); j++) {
  @@ -163,49 +172,35 @@
                       colVec.add(getSelectColumn(queryable,(Element) node, colHldr));
                   }
               }
  -            if (colVec.size() > function.getMaxCols()) {
  -                throw new ActionException("String function "+aElem.getNodeName()+" can only have "+function.getMaxCols()+" child columns");
  +            if (colVec.size() > function.getMaxCols() | colVec.size() < function.getMinCols() ) {
  +                throw new ActionException("Function "+aElem.getNodeName()+" can only have "+function.getMaxCols()+" child columns");
               }
               Column[] cols = new Column[colVec.size()];
               colVec.copyInto(cols);
               function.initialize(cols);
  -            return new DefaultContrivedVarcharFunctionColumn(as,function);
  +            return makeColumn(function, as);
  +
  +        } else if (function.getMinCols() == 0) {
  +            //  no initialization needed.
  +            return makeColumn(function, as);
           } else {
  -            throw new ActionException("String function "+aElem.getNodeName()+" must have child column");
  +            System.out.println("m m " + function.getMinCols() + " " + function.getMaxCols());
  +            throw new ActionException("Function "+aElem.getNodeName()+" must have child column");
           }
       }
   
  -    protected Column getIntegerColumnFromIntegerFunction(AbstractQueryable queryable, Element aElem,
  -            NumericFunction function, ContrivedColumnNameHolder colHldr) throws ActionException {
  -        String as = aElem.getAttribute("as");
  -        if (as.equals("")) {
  -            as = colHldr.getNextColumn();
  -        }
  -        // TODO as might be missing
  -        //return queryable.getColumn(name, true);
  -        int count = 0;
  -        if (aElem.hasChildNodes()) {
  -            NodeList subConcatNodes = aElem.getChildNodes();
  -            Vector colVec = new Vector();
  -            for (int j=0; j < subConcatNodes.getLength(); j++) {
  -                Node node = subConcatNodes.item(j);
  -                String nodeName =  node.getNodeName();
  -                if (nodeName.equals("#text")) {
  -                    // do nothing
  -                } else {
  -                    count++;
  -                    colVec.add(getSelectColumn(queryable,(Element) node, colHldr));
  -                }
  -            }
  -            if (colVec.size() > function.getMaxCols() | colVec.size() < function.getMinCols() ) {
  -                throw new ActionException("Numeric function "+aElem.getNodeName()+" must have between "+function.getMinCols()+" and "+function.getMaxCols()+" ");
  -            }
  -            Column[] cols = new Column[colVec.size()];
  -            colVec.copyInto(cols);
  -            function.initialize(cols);
  -            return new DefaultContrivedIntegerFunctionColumn(as,function);
  +    private Column makeColumn(Function function, String as) throws ActionException {
  +        if (function instanceof TimeFunction) {
  +            return new DefaultContrivedTimeFunctionColumn(as, (TimeFunction) function);
  +        } else if (function instanceof DateFunction) {
  +            return new DefaultContrivedDateFunctionColumn(as, (DateFunction) function);
  +        } else if (function instanceof TimestampFunction) {
  +            return new DefaultContrivedDateFunctionColumn(as, (DateFunction) function);
  +        } else if (function instanceof NumericFunction) {
  +            // TODO different types for 'preference'
  +            return new DefaultContrivedIntegerFunctionColumn(as, (NumericFunction) function);
           } else {
  -            throw new ActionException("Numeric function "+aElem.getNodeName()+" must have child column");
  +            return new DefaultContrivedVarcharFunctionColumn(as, (StringFunction) function);
           }
       }
   }
  
  
  
  1.14      +6 -6      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/Column.java
  
  Index: Column.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/Column.java,v
  retrieving revision 1.13
  retrieving revision 1.14
  diff -u -r1.13 -r1.14
  --- Column.java	20 Dec 2001 11:08:16 -0000	1.13
  +++ Column.java	2 Jan 2002 20:03:33 -0000	1.14
  @@ -18,7 +18,7 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
  - * @version * $Revision: 1.13 $
  + * @version * $Revision: 1.14 $
    */
   public interface Column extends Nameable {
   
  @@ -65,11 +65,11 @@
       int PREC_NUMERIC_CONST = 11;
       int PREC_BOOLEAN = 12;
   
  -    Integer toInteger(Row row);
  -    Long toLong(Row row);
  -    BigDecimal toBigDecimal(Row row);
  -    Float toFloat(Row row);
  -    Short toShort(Row row);
  +    //Integer toInteger(Row row);
  +    //Long toLong(Row row);
  +    //BigDecimal toBigDecimal(Row row);
  +    //Float toFloat(Row row);
  +    //Short toShort(Row row);
       String toString(Row row);
       int getPrecesion();
   
  
  
  
  1.5       +1 -19     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractDelegatedColumn.java
  
  Index: AbstractDelegatedColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractDelegatedColumn.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractDelegatedColumn.java	20 Dec 2001 12:31:16 -0000	1.4
  +++ AbstractDelegatedColumn.java	2 Jan 2002 20:03:33 -0000	1.5
  @@ -21,7 +21,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public class AbstractDelegatedColumn implements Column {
   
  @@ -43,25 +43,7 @@
           return mColumn.getValue(row);
       }
   
  -    public Integer toInteger(Row row) {
  -        return mColumn.toInteger(row);
  -    }
  -
  -    public Long toLong(Row row) {
  -        return mColumn.toLong(row);
  -    }
  -
  -    public BigDecimal toBigDecimal(Row row) {
  -        return mColumn.toBigDecimal(row);
  -    }
  -
  -    public Float toFloat(Row row) {
  -        return mColumn.toFloat(row);
  -    }
   
  -    public Short toShort(Row row) {
  -        return mColumn.toShort(row);
  -    }
   
       public String toString(Row row) {
           return mColumn.toString(row);
  
  
  
  1.6       +3 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateAveColumn.java
  
  Index: DefaultAggregateAveColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateAveColumn.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultAggregateAveColumn.java	19 Dec 2001 18:59:26 -0000	1.5
  +++ DefaultAggregateAveColumn.java	2 Jan 2002 20:03:33 -0000	1.6
  @@ -23,7 +23,7 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class DefaultAggregateAveColumn extends AbstractAggregateFunctionColumn implements NumericColumn {
   
  @@ -31,7 +31,7 @@
       private int mTotal;
       private Integer mAve;
       private static Integer DEFAULT = new Integer(0);
  -    private Column mOnColumn;
  +    private NumericColumn mOnColumn;
   
       /**
        * Constructor DefaultAggregateAveColumn
  @@ -42,7 +42,7 @@
        */
       public DefaultAggregateAveColumn(Queryable onQueryable, String name, String on) throws ActionException {
           super(getNameOfColumn(name),SQLType.INTEGER);
  -        mOnColumn = onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
  +        mOnColumn = (NumericColumn) onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
       }
   
       private void testAve() {
  
  
  
  1.6       +3 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateMaxColumn.java
  
  Index: DefaultAggregateMaxColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateMaxColumn.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultAggregateMaxColumn.java	19 Dec 2001 18:59:26 -0000	1.5
  +++ DefaultAggregateMaxColumn.java	2 Jan 2002 20:03:33 -0000	1.6
  @@ -23,14 +23,14 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class DefaultAggregateMaxColumn extends AbstractAggregateFunctionColumn implements NumericColumn {
   
       private int mMax;
       private Integer mMax2;
       private static Integer DEFAULT = new Integer(0);
  -    private Column mOnColumn;
  +    private NumericColumn mOnColumn;
   
       /**
        * Constructor DefaultAggregateMaxColumn
  @@ -41,7 +41,7 @@
        */
       public DefaultAggregateMaxColumn(Queryable onQueryable, String name, String on) throws ActionException {
           super(getNameOfColumn(name),SQLType.INTEGER);
  -        mOnColumn = onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
  +        mOnColumn = (NumericColumn) onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
       }
   
       private void testMax() {
  
  
  
  1.6       +3 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateMinColumn.java
  
  Index: DefaultAggregateMinColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateMinColumn.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultAggregateMinColumn.java	19 Dec 2001 18:59:26 -0000	1.5
  +++ DefaultAggregateMinColumn.java	2 Jan 2002 20:03:33 -0000	1.6
  @@ -23,14 +23,14 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class DefaultAggregateMinColumn extends AbstractAggregateFunctionColumn implements NumericColumn {
   
       private int mMin;
       private Integer mMin2;
       private static Integer DEFAULT = new Integer(0);
  -    private Column mOnColumn;
  +    private NumericColumn mOnColumn;
   
       /**
        * Constructor DefaultAggregateMinColumn
  @@ -41,7 +41,7 @@
        */
       public DefaultAggregateMinColumn(Queryable onQueryable, String name, String on) throws ActionException {
           super(getNameOfColumn(name),SQLType.INTEGER);
  -        mOnColumn = onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
  +        mOnColumn = (NumericColumn) onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
       }
   
       private void testMax() {
  
  
  
  1.6       +3 -3      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateSumColumn.java
  
  Index: DefaultAggregateSumColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultAggregateSumColumn.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- DefaultAggregateSumColumn.java	19 Dec 2001 18:59:26 -0000	1.5
  +++ DefaultAggregateSumColumn.java	2 Jan 2002 20:03:33 -0000	1.6
  @@ -23,14 +23,14 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.5 $
  + * @version $Revision: 1.6 $
    */
   public class DefaultAggregateSumColumn extends AbstractAggregateFunctionColumn implements NumericColumn {
   
       private int mSum;
       private Integer mSum2;
       private static Integer DEFAULT = new Integer(0);
  -    private Column mOnColumn;
  +    private NumericColumn mOnColumn;
   
       /**
        * Constructor DefaultAggregateSumColumn
  @@ -41,7 +41,7 @@
        */
       public DefaultAggregateSumColumn(Queryable onQueryable, String name, String on) throws ActionException {
           super(getNameOfColumn(name),SQLType.INTEGER);
  -        mOnColumn = onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
  +        mOnColumn = (NumericColumn) onQueryable.getColumns()[onQueryable.getColumnIndex(on)];
       }
   
       private void testMax() {
  
  
  
  1.3       +2 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedNumericColumn.java
  
  Index: DefaultDelegatedNumericColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultDelegatedNumericColumn.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DefaultDelegatedNumericColumn.java	20 Dec 2001 12:31:16 -0000	1.2
  +++ DefaultDelegatedNumericColumn.java	2 Jan 2002 20:03:33 -0000	1.3
  @@ -17,9 +17,9 @@
    *
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.2 $
  + * @version $Revision: 1.3 $
    */
  -public class DefaultDelegatedNumericColumn extends AbstractDelegatedColumn implements NumericColumn {
  +public class DefaultDelegatedNumericColumn extends AbstractDelegatedNumericColumn  {
   
   
       /**
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/AbstractDelegatedNumericColumn.java
  
  Index: AbstractDelegatedNumericColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.types.NumericColumn;
  import org.apache.avalon.db.actions.ActionException;
  
  import java.math.BigDecimal;
  
  
  /**
   * Class AbstractDelegatedNumericColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class AbstractDelegatedNumericColumn extends AbstractDelegatedColumn implements NumericColumn {
  
  
      /**
       * Constructor AbstractDelegatedNumericColumn
       *
       *
       * @param name
       *
       */
      public AbstractDelegatedNumericColumn(NumericColumn column) throws ActionException {
          super(column);
      }
  
  
      public Integer toInteger(Row row) {
          return ((NumericColumn) mColumn).toInteger(row);
      }
  
      public Long toLong(Row row) {
          return ((NumericColumn) mColumn).toLong(row);
      }
  
      public BigDecimal toBigDecimal(Row row) {
          return ((NumericColumn) mColumn).toBigDecimal(row);
      }
  
      public Float toFloat(Row row) {
          return ((NumericColumn) mColumn).toFloat(row);
      }
  
      public Short toShort(Row row) {
          return ((NumericColumn) mColumn).toShort(row);
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultContrivedDateFunctionColumn.java
  
  Index: DefaultContrivedDateFunctionColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.types.TemporalColumn;
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.functions.TimeFunction;
  import org.apache.avalon.db.functions.StringFunction;
  import org.apache.avalon.db.functions.DateFunction;
  import org.apache.avalon.db.actions.ActionException;
  
  
  /**
   * Class DefaultContrivedDateFunctionColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultContrivedDateFunctionColumn extends AbstractContrivedColumn implements TemporalColumn {
  
      DateFunction mDateFunction;
  
      /**
       * Constructor DefaultContrivedDateFunctionColumn
       *
       *
       * @param name
       * @param stringFunction
       *
       */
      public DefaultContrivedDateFunctionColumn(String name, DateFunction dateFunction) throws ActionException {
          super(getNameOfColumn(name), SQLType.DATE);
          mDateFunction = dateFunction;
      }
  
      public Object getValue(Row row) {
          return mDateFunction.getValue(row);
      }
  
      public String toString(Row row) {
          return mDateFunction.getValue(row).toString();
      }
  
      public int getPrecesion() {
          return Column.PREC_TIME;
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultContrivedTimeFunctionColumn.java
  
  Index: DefaultContrivedTimeFunctionColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.types.TemporalColumn;
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.functions.TimeFunction;
  import org.apache.avalon.db.functions.StringFunction;
  import org.apache.avalon.db.actions.ActionException;
  
  
  /**
   * Class DefaultContrivedTimeFunctionColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultContrivedTimeFunctionColumn extends AbstractContrivedColumn implements TemporalColumn {
  
      TimeFunction mTimeFunction;
  
      /**
       * Constructor DefaultContrivedTimeFunctionColumn
       *
       *
       * @param name
       * @param timeFunction
       *
       */
      public DefaultContrivedTimeFunctionColumn(String name, TimeFunction timeFunction) throws ActionException {
          super(getNameOfColumn(name), SQLType.TIME);
          mTimeFunction = timeFunction;
      }
  
      public Object getValue(Row row) {
          return mTimeFunction.getValue(row);
      }
  
      public String toString(Row row) {
          return mTimeFunction.getValue(row).toString();
      }
  
      public int getPrecesion() {
          return Column.PREC_TIME;
      }
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/impl/DefaultContrivedTimestampFunctionColumn.java
  
  Index: DefaultContrivedTimestampFunctionColumn.java
  ===================================================================
  
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.data.impl;
  
  import org.apache.avalon.db.data.types.TemporalColumn;
  import org.apache.avalon.db.data.types.SQLType;
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.Column;
  import org.apache.avalon.db.functions.TimeFunction;
  import org.apache.avalon.db.functions.StringFunction;
  import org.apache.avalon.db.functions.DateFunction;
  import org.apache.avalon.db.functions.TimestampFunction;
  import org.apache.avalon.db.actions.ActionException;
  
  
  /**
   * Class DefaultContrivedTimestampFunctionColumn
   *
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version $Revision: 1.1 $
   */
  public class DefaultContrivedTimestampFunctionColumn extends AbstractContrivedColumn implements TemporalColumn {
  
      TimestampFunction mTimestampFunction;
  
      /**
       * Constructor DefaultContrivedTimestampFunctionColumn
       *
       *
       * @param name
       * @param timestampFunction
       *
       */
      public DefaultContrivedTimestampFunctionColumn(String name, TimestampFunction timestampFunction) throws ActionException {
          super(getNameOfColumn(name), SQLType.DATE);
          mTimestampFunction = timestampFunction;
      }
  
      public Object getValue(Row row) {
          return mTimestampFunction.getValue(row);
      }
  
      public String toString(Row row) {
          return mTimestampFunction.getValue(row).toString();
      }
  
      public int getPrecesion() {
          return Column.PREC_TIME;
      }
  
  }
  
  
  
  1.2       +11 -1     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/types/NumericColumn.java
  
  Index: NumericColumn.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/data/types/NumericColumn.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NumericColumn.java	1 Dec 2001 10:49:43 -0000	1.1
  +++ NumericColumn.java	2 Jan 2002 20:03:33 -0000	1.2
  @@ -9,6 +9,9 @@
   package org.apache.avalon.db.data.types;
   
   import org.apache.avalon.db.data.Column;
  +import org.apache.avalon.db.data.Row;
  +
  +import java.math.BigDecimal;
   
   /**
    * Class NumericColumn
  @@ -16,7 +19,14 @@
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public interface NumericColumn extends Column {
  +
  +    Integer toInteger(Row row);
  +    Long toLong(Row row);
  +    BigDecimal toBigDecimal(Row row);
  +    Float toFloat(Row row);
  +    Short toShort(Row row);
  +
   }
  
  
  
  1.2       +13 -8     jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/TemporalFunction.java
  
  Index: TemporalFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/TemporalFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TemporalFunction.java	17 Nov 2001 08:52:56 -0000	1.1
  +++ TemporalFunction.java	2 Jan 2002 20:03:34 -0000	1.2
  @@ -10,20 +10,25 @@
   import org.apache.avalon.db.data.Row;
   
   import java.util.Properties;
  +import java.sql.Timestamp;
  +import java.sql.Time;
  +import java.sql.Date;
   
   /**
    * Interface TemporalFunction
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version * $Revision: 1.1 $
  + * @version * $Revision: 1.2 $
    */
   public interface TemporalFunction extends Function {
       // note months begin at one not zero like in Java.
  -    int getMonthValue(Row row);
  -    int getDayValue(Row row);
  -    int getYearValue(Row row);
  -    int getHourValue(Row row);
  -    int getMinuteValue(Row row);
  -    int getSecondValue(Row row);
  -    int getCenturyValue(Row row);
  +    // Not sure about these... - PH
  +    //int getMonthValue(Row row);
  +    //int getDayValue(Row row);
  +    //int getYearValue(Row row);
  +    //int getHourValue(Row row);
  +    //int getMinuteValue(Row row);
  +    //int getSecondValue(Row row);
  +    //int getCenturyValue(Row row);
  +
   }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/DateFunction.java
  
  Index: DateFunction.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.functions;
  
  import org.apache.avalon.db.data.Row;
  
  import java.sql.Date;
  
  /**
   * Interface DateFunction
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface DateFunction extends TemporalFunction {
  
      Date getDateValue(Row row);
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/TimeFunction.java
  
  Index: TimeFunction.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.functions;
  
  import org.apache.avalon.db.data.Row;
  
  import java.util.Properties;
  import java.sql.Timestamp;
  import java.sql.Time;
  import java.sql.Date;
  
  /**
   * Interface TimeFunction
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface TimeFunction extends TemporalFunction {
  
      Time getTimeValue(Row row);
  
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/TimestampFunction.java
  
  Index: TimestampFunction.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.functions;
  
  import org.apache.avalon.db.data.Row;
  
  import java.sql.Timestamp;
  
  /**
   * Interface TimestampFunction
   *
   * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
   * @version * $Revision: 1.1 $
   */
  public interface TimestampFunction extends TemporalFunction {
  
      Timestamp getTimestampValue(Row row);
  
  }
  
  
  
  1.5       +2 -2      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/AbstractFunction.java
  
  Index: AbstractFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/AbstractFunction.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractFunction.java	18 Dec 2001 14:24:53 -0000	1.4
  +++ AbstractFunction.java	2 Jan 2002 20:03:34 -0000	1.5
  @@ -17,10 +17,10 @@
    * Class AbstractFunction
    *
    * @author Gerhard Froehlich <a href="mailto:g-froehlich@gmx.de">g-froehlich@gmx.de</a>
  - * @version $Revision: 1.4 $
  + * @version $Revision: 1.5 $
    */
   public abstract class AbstractFunction extends AbstractLogEnabled implements Function {
  -    protected Column[] mColumns;
  +    protected Column[] mColumns = new Column[0];
       public void initialize(Column[] columns) {
           mColumns = columns;
       }
  
  
  
  1.2       +0 -1      jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/AbstractTemporalIntegerFunction.java
  
  Index: AbstractTemporalIntegerFunction.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/AbstractTemporalIntegerFunction.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AbstractTemporalIntegerFunction.java	29 Dec 2001 00:33:09 -0000	1.1
  +++ AbstractTemporalIntegerFunction.java	2 Jan 2002 20:03:34 -0000	1.2
  @@ -7,7 +7,6 @@
    */
   package org.apache.avalon.db.functions.impl;
   
  -import org.apache.avalon.db.functions.TemporalFunction;
   import org.apache.avalon.db.functions.NumericFunction;
   import org.apache.avalon.db.data.Row;
   
  @@ -18,7 +17,7 @@
    * Class AbstractTemporalIntegerFunction
    *
    * @author Paul Hammant <a href="mailto:Paul_Hammant@yahoo.com">Paul_Hammant@yahoo.com</a>
  - * @version $Revision: 1.1 $
  + * @version $Revision: 1.2 $
    */
   public abstract class AbstractTemporalIntegerFunction extends AbstractIntegerFunction implements NumericFunction {
   
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/CurrentDateTemporalFunction.java
  
  Index: CurrentDateTemporalFunction.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.functions.impl;
  
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.types.StringColumn;
  import org.apache.avalon.db.functions.DateFunction;
  
  import java.sql.Date;
  
  /**
   * Class CurrentDateTemporalFunction
   *
   * @author Larry McCay <a href="mailto:lawrence_mccay-iii@hp.com">lawrence_mccay-iii@hp.com</a>
   * @version $Revision: 1.1 $
   */
  public class CurrentDateTemporalFunction extends AbstractFunction implements DateFunction {
  
      private Date mDate;
  
      public CurrentDateTemporalFunction() {
          mDate = new Date(System.currentTimeMillis());
      }
  
      public Object getValue(Row row) {
          return mDate;
      }
  
      public Date getDateValue(Row row) {
          return mDate;
      }
  
     /**
      * Method getMinCols
      *
      *
      * @return
      *
      */
     public int getMinCols() {
         return 0;
     }
  
     /**
      * Method getMaxCols
      *
      *
      * @return
      *
      */
     public int getMaxCols() {
         return 0;
     }
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/CurrentTimeTemporalFunction.java
  
  Index: CurrentTimeTemporalFunction.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.functions.impl;
  
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.types.StringColumn;
  import org.apache.avalon.db.functions.TimeFunction;
  
  import java.sql.Time;
  
  /**
   * Class CurrentTimeTemporalFunction
   *
   * @author Larry McCay <a href="mailto:lawrence_mccay-iii@hp.com">lawrence_mccay-iii@hp.com</a>
   * @version $Revision: 1.1 $
   */
  public class CurrentTimeTemporalFunction extends AbstractFunction implements TimeFunction {
  
      private Time mTime;
  
      public CurrentTimeTemporalFunction() {
          mTime = new Time(System.currentTimeMillis());
      }
  
      public Object getValue(Row row) {
          return mTime;
      }
  
      public Time getTimeValue(Row row) {
          return mTime;
      }
  
     /**
      * Method getMinCols
      *
      *
      * @return
      *
      */
     public int getMinCols() {
         return 0;
     }
  
     /**
      * Method getMaxCols
      *
      *
      * @return
      *
      */
     public int getMaxCols() {
         return 0;
     }
  }
  
  
  
  1.1                  jakarta-avalon-cornerstone/apps/db/src/java/org/apache/avalon/db/functions/impl/CurrentTimestampTemporalFunction.java
  
  Index: CurrentTimestampTemporalFunction.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE file.
   */
  package org.apache.avalon.db.functions.impl;
  
  import org.apache.avalon.db.data.Row;
  import org.apache.avalon.db.data.types.StringColumn;
  import org.apache.avalon.db.functions.TimestampFunction;
  
  import java.sql.Timestamp;
  
  /**
   * Class CurrentTimestampTemporalFunction
   *
   * @author Larry McCay <a href="mailto:lawrence_mccay-iii@hp.com">lawrence_mccay-iii@hp.com</a>
   * @version $Revision: 1.1 $
   */
  public class CurrentTimestampTemporalFunction extends AbstractFunction implements TimestampFunction {
  
      private Timestamp mTimestamp;
  
      public CurrentTimestampTemporalFunction() {
          mTimestamp = new Timestamp(System.currentTimeMillis());
      }
  
      public Object getValue(Row row) {
          return mTimestamp;
      }
  
      public Timestamp getTimestampValue(Row row) {
          return mTimestamp;
      }
  
     /**
      * Method getMinCols
      *
      *
      * @return
      *
      */
     public int getMinCols() {
         return 0;
     }
  
     /**
      * Method getMaxCols
      *
      *
      * @return
      *
      */
     public int getMaxCols() {
         return 0;
     }
  }
  
  
  
  1.8       +1 -0      jakarta-avalon-cornerstone/apps/db/src/scripts/lxsql/Test2.script
  
  Index: Test2.script
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-cornerstone/apps/db/src/scripts/lxsql/Test2.script,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Test2.script	29 Dec 2001 00:33:09 -0000	1.7
  +++ Test2.script	2 Jan 2002 20:03:34 -0000	1.8
  @@ -22,6 +22,7 @@
        <month as="MonthOfBirth">
          <column name="dob"/>
        </month>
  +     <currentdate as="CurrentDate"/>
      </columns>
      <from>
        <table name="Flintstones"/>
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message