You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2005/01/17 17:23:05 UTC
svn commit: r125423 - in incubator/derby/code/trunk/java/engine/org/apache/derby: iapi/sql/conn iapi/types impl/sql/compile impl/sql/conn
Author: djd
Date: Mon Jan 17 08:23:02 2005
New Revision: 125423
URL: http://svn.apache.org/viewcvs?view=rev&rev=125423
Log:
Remove passing identity value areound as a BigDecimal since the underlying
value is a long. Consistent naming for DataValueFactory methods related to DECIMAL.
JSR169 releted cleanup.
Modified:
incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java
incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java
incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java
incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/conn/LanguageConnectionContext.java Mon Jan 17 08:23:02 2005
@@ -54,7 +54,6 @@
import java.util.Locale;
import java.util.Hashtable;
import java.util.Vector;
-import java.math.BigDecimal;
/**
* LanguageConnectionContext keeps the result sets,
@@ -515,7 +514,7 @@
*
* @return the generated identity column value
*/
- public BigDecimal getIdentityValue();
+ public Long getIdentityValue();
/**
* Set the field of most recently generated identity column value.
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactory.java Mon Jan 17 08:23:02 2005
@@ -298,10 +298,20 @@
*
* @exception StandardException Thrown on error
*/
- NumberDataValue getDataValue(BigDecimal value) throws StandardException;
- NumberDataValue getDataValue(BigDecimal value, NumberDataValue previous)
+ NumberDataValue getDecimalDataValue(BigDecimal value) throws StandardException;
+ NumberDataValue getDecimalDataValue(BigDecimal value, NumberDataValue previous)
throws StandardException;
+
+ /**
+ * Get a SQL DECIMAL with the given value.
+ *
+ * @exception StandardException Thrown on error
+ */
+ NumberDataValue getDecimalDataValue(Long value, NumberDataValue previous)
+ throws StandardException;
+
+
/**
* Get a SQL DECIMAL with the given value. The second form re-uses the
* previous value, if non-null, as the data holder to return.
@@ -482,7 +492,7 @@
* that value.
*
*/
- NumberDataValue getNullBigDecimal(NumberDataValue dataValue);
+ NumberDataValue getNullDecimal(NumberDataValue dataValue);
/**
* Get a SQL boolean with a SQL null value. If the supplied value
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DataValueFactoryImpl.java Mon Jan 17 08:23:02 2005
@@ -286,8 +286,7 @@
previous.setValue(value);
return previous;
}
-
- public NumberDataValue getDataValue(BigDecimal value)
+ public NumberDataValue getDecimalDataValue(BigDecimal value)
{
if (value != null)
return new SQLDecimal(value);
@@ -295,17 +294,24 @@
return new SQLDecimal();
}
- public NumberDataValue getDataValue(BigDecimal value,
- NumberDataValue previous)
+ public NumberDataValue getDecimalDataValue(BigDecimal value, NumberDataValue previous)
throws StandardException
{
if (previous == null)
- return getDataValue(value);
+ return getDecimalDataValue(value);
previous.setValue(value);
return previous;
}
+ public NumberDataValue getDecimalDataValue(Long value, NumberDataValue previous)
+ throws StandardException
+ {
+ if (previous == null)
+ previous = new SQLDecimal();
+ previous.setValue(value);
+ return previous;
+ }
public NumberDataValue getDecimalDataValue(String value) throws StandardException
{
if (value != null)
@@ -702,7 +708,7 @@
}
}
- public NumberDataValue getNullBigDecimal(NumberDataValue dataValue)
+ public NumberDataValue getNullDecimal(NumberDataValue dataValue)
{
if (dataValue == null)
{
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/iapi/types/DateTimeDataValue.java Mon Jan 17 08:23:02 2005
@@ -22,10 +22,6 @@
import org.apache.derby.iapi.error.StandardException;
-import java.sql.Date;
-import java.sql.Time;
-import java.sql.Timestamp;
-
public interface DateTimeDataValue extends DataValueDescriptor
{
public static final int YEAR_FIELD = 0;
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/BaseTypeCompiler.java Mon Jan 17 08:23:02 2005
@@ -153,6 +153,10 @@
protected abstract String nullMethodName();
+ /**
+ Return the method name to get a Derby DataValueDescriptor
+ object of the correct type. This implementation returns "getDataValue".
+ */
protected String dataValueMethodName()
{
return "getDataValue";
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/CurrentUserNode.java Mon Jan 17 08:23:02 2005
@@ -182,7 +182,7 @@
mb.callMethod(VMOpcode.INVOKEINTERFACE, ClassName.Activation, "getLanguageConnectionContext",
ClassName.LanguageConnectionContext, 0);
if (whichType == IDENTITY_VAL)
- mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getIdentityValue", "java.math.BigDecimal", 0);
+ mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getIdentityValue", "java.lang.Long", 0);
else if (whichType == SCHEMA)
mb.callMethod(VMOpcode.INVOKEINTERFACE, (String) null, "getCurrentSchemaName", "java.lang.String", 0);
else
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/NumericTypeCompiler.java Mon Jan 17 08:23:02 2005
@@ -334,13 +334,25 @@
return numberStorable(getTypeId(), otherType, cf);
}
+ /**
+ Return the method name to get a Derby DataValueDescriptor
+ object of the correct type. This implementation returns "getDataValue".
+ */
+ protected String dataValueMethodName()
+ {
+ if (getStoredFormatIdFromTypeId() == StoredFormatIds.DECIMAL_TYPE_ID)
+ return "getDecimalDataValue";
+ else
+ return super.dataValueMethodName();
+ }
+
protected String nullMethodName()
{
int formatId = getStoredFormatIdFromTypeId();
switch (formatId)
{
case StoredFormatIds.DECIMAL_TYPE_ID:
- return "getNullBigDecimal";
+ return "getNullDecimal";
case StoredFormatIds.DOUBLE_TYPE_ID:
return "getNullDouble";
Modified: incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java
Url: http://svn.apache.org/viewcvs/incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java?view=diff&rev=125423&p1=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java&r1=125422&p2=incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java&r2=125423
==============================================================================
--- incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java (original)
+++ incubator/derby/code/trunk/java/engine/org/apache/derby/impl/sql/conn/GenericLanguageConnectionContext.java Mon Jan 17 08:23:02 2005
@@ -89,7 +89,6 @@
import java.util.Vector;
import java.util.Stack;
import java.io.Serializable;
-import java.math.BigDecimal;
/**
* LanguageConnectionContext keeps the pool of prepared statements,
@@ -1727,9 +1726,9 @@
*
* @return the generated identity column value
*/
- public BigDecimal getIdentityValue()
+ public Long getIdentityValue()
{
- return identityNotNull ? BigDecimal.valueOf(identityVal) : null;
+ return identityNotNull ? new Long(identityVal) : null;
}
/**