Author: djd Date: Fri Apr 22 11:49:43 2005 New Revision: 164266 URL: http://svn.apache.org/viewcvs?rev=164266&view=rev Log: Cleanup in SQLDecimal to explictly call the static getWHoleDigits method using SQLDecimal.getWHoleDigits as a prelude to fixing Derby-225. Fix minor error in NumericContstantNode where a String is obtained from a DataValueDescriptoor using toString() but the correct method for the type system is getString(). toString() may return debugging info, some implementations return "NULL" for a null value, where getString() correctly returns null.
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java?rev=164266&r1=164265&r2=164266&view=diff ============================================================================== --- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/SQLDecimal.java Fri Apr 22 11:49:43 2005 @@ -931,7 +931,7 @@ divisorBigDecimal, scale > -1 ? scale : Math.max((dividendBigDecimal.scale() + - getWholeDigits(divisorBigDecimal) + + SQLDecimal.getWholeDigits(divisorBigDecimal) + 1), NumberDataValue.MIN_DECIMAL_DIVIDE_SCALE), BigDecimal.ROUND_DOWN)); @@ -1051,7 +1051,7 @@ { if (isNull()) return this; - + // the getWholeDigits() call will ensure via getBigDecimal() // that the rawData is translated into the BigDecimal in value. if (desiredPrecision != IGNORE_PRECISION && @@ -1083,7 +1083,7 @@ return 0; } - return getWholeDigits(decimalValue) + decimalValue.scale(); + return SQLDecimal.getWholeDigits(decimalValue) + decimalValue.scale(); } public int getDecimalValueScale() @@ -1127,7 +1127,7 @@ private int getWholeDigits() { - return getWholeDigits(getBigDecimal()); + return SQLDecimal.getWholeDigits(getBigDecimal()); } private static int getWholeDigits(BigDecimal decimalValue) Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java URL: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java?rev=164266&r1=164265&r2=164266&view=diff ============================================================================== --- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java (original) +++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericConstantNode.java Fri Apr 22 11:49:43 2005 @@ -235,7 +235,7 @@ break; case C_NodeTypes.DECIMAL_CONSTANT_NODE: mb.pushNewStart("java.math.BigDecimal"); - mb.push(value.toString()); + mb.push(value.getString()); mb.pushNewComplete(1); break; case C_NodeTypes.DOUBLE_CONSTANT_NODE: