db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jack Klebanoff <klebanoff-de...@sbcglobal.net>
Subject Re: [PATCH] Timestamp Arithmetic
Date Fri, 20 May 2005 19:30:02 GMT
Satheesh Bandaram wrote:

> TimestampAdd seems to allow adding non-integer intervals, but the 
> behavior doesn't seem right. Either the result should be "10:10:20.9" 
> or the statement should error. Though JDBC documenation is not very 
> clear, I thought the "count" intervals need to be an integer?
>
> ij> values {fn timestampadd(SQL_TSI_SECOND, 10.9, time('10:10:10'))};
> 1
> --------------------------
> 2005-05-18 10:10:20.0
>
> If we only allow integers for count, then the following needs to change:
>
> +        if( ! bindParameter( rightOperand, Types.INTEGER))
> +        {
> +            if( ! rightOperand.getTypeId().isNumericTypeId())
> +                throw 
> StandardException.newException(SQLState.LANG_INVALID_FUNCTION_ARG_TYPE,
> +                                                     
> rightOperand.getTypeId().getSQLTypeName(),
> +                                                     
> ReuseFactory.getInteger(2),
> +                                                     operator);
> +        }
>
> Satheesh
>
I have attached a new patch with the change that Satheesh requested.

svn status:
M      java/engine/org/apache/derby/impl/sql/compile/NodeFactoryImpl.java
M      
java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
M      java/engine/org/apache/derby/impl/sql/compile/sqlgrammar.jj
M      java/engine/org/apache/derby/iapi/sql/compile/C_NodeTypes.java
M      java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java
M      java/engine/org/apache/derby/iapi/types/SQLDate.java
M      java/engine/org/apache/derby/iapi/types/SQLTime.java
M      java/engine/org/apache/derby/iapi/types/SQLTimestamp.java
M      java/engine/org/apache/derby/iapi/reference/SQLState.java
M      java/engine/org/apache/derby/loc/messages_en.properties
A      
java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java
A      
java/testing/org/apache/derbyTesting/functionTests/master/timestampArith.out
M      
java/testing/org/apache/derbyTesting/functionTests/suites/derbylang.runall

Jack

Mime
View raw message