Author: djd
Date: Wed Jan 30 11:36:14 2008
New Revision: 616853
URL: http://svn.apache.org/viewvc?rev=616853&view=rev
Log:
DERBY-2275 Remove last use of DataTypeDescriptor.setNullability() to make DTD's use immutable
wrt nullability. Fixes DERBY-3346 and DERBY-3342 which were cases when a query was getting
the incorrect nullability for some columns due to the mutability of DTD when shared across
nodes.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java?rev=616853&r1=616852&r2=616853&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/sql/compile/ConditionalNode.java
Wed Jan 30 11:36:14 2008
@@ -297,7 +297,7 @@
if (castType == null) return;
// need to have nullNodes nullable
- castType.setNullability(true);
+ castType = castType.getNullabilityType(true);
ValueNode thenNode = (ValueNode)thenElseList.elementAt(0);
ValueNode elseNode = (ValueNode)thenElseList.elementAt(1);
Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java?rev=616853&r1=616852&r2=616853&view=diff
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
Wed Jan 30 11:36:14 2008
@@ -2216,7 +2216,8 @@
boolean[] ODBC_COLUMN_NULLABILITY = new boolean[ODBC_COLUMN_NAMES.length];
System.arraycopy(JDBC_COLUMN_NULLABILITY, 0, ODBC_COLUMN_NULLABILITY, 0,
JDBC_COLUMN_NULLABILITY.length);
-
+ //SQL_DATA_TYPE is NULL in JDBC but a valid non-null value in ODBC
+ ODBC_COLUMN_NULLABILITY[16 - 1] = false;
ODBC_COLUMN_NULLABILITY[19 - 1] = true; // INTERVAL_PRECISION (extra column comapred
to JDBC)
CallableStatement cs = prepareCall(
@@ -3315,7 +3316,7 @@
int [] columnTypes = {
Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,
Types.VARCHAR,Types.VARCHAR,Types.VARCHAR,Types.VARCHAR};
- boolean [] nullability = {false,false,false,false,false,false,true,true};
+ boolean [] nullability = {false,false,false,false,false,false,false,false};
assertMetaDataResultSet(rss[0], columnNames, columnTypes, nullability);
assertMetaDataResultSet(rss[1], columnNames, columnTypes, nullability);
@@ -3540,7 +3541,7 @@
columnTypes[4 - 1] = Types.SMALLINT;
boolean [] nullability = {false,false,false,
- true,false,true,true,true,false,true,true,true,true};
+ false,false,true,true,true,false,false,true,true,true};
// JDBC result set
assertMetaDataResultSet(rss[0], columnNames, columnTypes, nullability);
@@ -4448,8 +4449,8 @@
, Types.SMALLINT, Types.SMALLINT};
boolean[] nullability = new boolean[] {
- true, false, false, false, false, false, false, false, true, true,
- true, false, true, true, true, true, true, false, true, false//};
+ true, false, false, false, false, false, false, false, false, true,
+ true, false, true, true, true, true, true, false, false, false//};
, false, false};
@@ -4482,6 +4483,8 @@
odbcColumnTypes[6 - 1] = Types.SMALLINT;
odbcColumnTypes[15 - 1] = Types.SMALLINT;
odbcColumnTypes[16 - 1] = Types.SMALLINT;
+
+ odbcNullability[15 - 1] = false; // SQL_DATA_TYPE NULL in JDBC, valid type in ODBC
// odbc result set
assertMetaDataResultSet(
|