db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d..@apache.org
Subject svn commit: r525549 - in /db/derby/code/trunk/java/engine/org/apache/derby: iapi/types/SQLTimestamp.java impl/sql/compile/TernaryOperatorNode.java
Date Wed, 04 Apr 2007 16:13:44 GMT
Author: djd
Date: Wed Apr  4 09:13:43 2007
New Revision: 525549

URL: http://svn.apache.org/viewvc?view=rev&rev=525549
Log:
DERBY-2386 Change {fn timestampdiff} to return a BIGINT.
Contributed by Mayuresh Nirhali Mayuresh.Nirhali@Sun.COM

Modified:
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java?view=diff&rev=525549&r1=525548&r2=525549
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLTimestamp.java Wed Apr
 4 09:13:43 2007
@@ -1170,7 +1170,7 @@
         throws StandardException
     {
         if( resultHolder == null)
-            resultHolder = new SQLInteger();
+            resultHolder = new SQLLongint();
  
        if( isNull() || time1.isNull())
         {
@@ -1206,8 +1206,6 @@
         switch( intervalType)
         {
         case FRAC_SECOND_INTERVAL:
-            if( secondsDiff > Integer.MAX_VALUE/ONE_BILLION || secondsDiff < Integer.MIN_VALUE/ONE_BILLION)
-                throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE,
"INTEGER");
             ldiff = secondsDiff*ONE_BILLION + nanosDiff;
             break;
             
@@ -1308,9 +1306,7 @@
                                                   ReuseFactory.getInteger( intervalType),
                                                   "TIMESTAMPDIFF");
         }
-		if (ldiff > Integer.MAX_VALUE || ldiff < Integer.MIN_VALUE)
-			throw StandardException.newException(SQLState.LANG_OUTSIDE_RANGE_FOR_DATATYPE, "INTEGER");
-        resultHolder.setValue( (int) ldiff);
+        resultHolder.setValue(ldiff);
         return resultHolder;
     } // end of timestampDiff
 

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java?view=diff&rev=525549&r1=525548&r2=525549
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/TernaryOperatorNode.java
Wed Apr  4 09:13:43 2007
@@ -823,7 +823,7 @@
 	{
         bindDateTimeArg( rightOperand, 2);
         bindDateTimeArg( receiver, 3);
-        setType(DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.INTEGER));
+        setType(DataTypeDescriptor.getBuiltInDataTypeDescriptor( Types.BIGINT));
         return this;
     } // End of timestampDiffBind
 



Mime
View raw message