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 Thu, 19 May 2005 17:47:24 GMT
I thought that I read somewhere that TIMESTAMPADD was supposed to take 
the integer part of its count argument. I think that I was wrong. The 
Microsoft ODBC documentation says "Arguments denoted as /integer_exp/ 
can be the name of a column, the result of another scalar function, or a 
/numeric-literal/, where the underlying data type can be represented as 
SQL_TINYINT, SQL_SMALLINT, SQL_INTEGER, or SQL_BIGINT". I will change 
the timestampAddBind method to check that the count argument is an 
integer type.

Jack

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
>


Mime
View raw message