db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From banda...@apache.org
Subject svn commit: r390839 - in /db/derby/code/branches/10.1/java: engine/org/apache/derby/iapi/types/SQLBinary.java testing/org/apache/derbyTesting/functionTests/master/bit.out testing/org/apache/derbyTesting/functionTests/tests/lang/bit.sql
Date Sun, 02 Apr 2006 15:54:55 GMT
Author: bandaram
Date: Sun Apr  2 08:54:53 2006
New Revision: 390839

URL: http://svn.apache.org/viewcvs?rev=390839&view=rev
Log:
DERBY-1085: Fix NullPointerException in SQLBinary.java that causes exception for all FOR BIT
DATA types while getting length for NULL values.

Submitted by Satheesh Bandaram (satheesh@sourcery.org)

Modified:
    db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBinary.java
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/bit.out
    db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bit.sql

Modified: db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBinary.java
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBinary.java?rev=390839&r1=390838&r2=390839&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBinary.java (original)
+++ db/derby/code/branches/10.1/java/engine/org/apache/derby/iapi/types/SQLBinary.java Sun
Apr  2 08:54:53 2006
@@ -229,8 +229,7 @@
 				return streamLength;
 		}
 
-		return getBytes().length;
-
+		return (getBytes() == null) ? 0 : getBytes().length;
 	}
 
 	/*

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/bit.out
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/bit.out?rev=390839&r1=390838&r2=390839&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/bit.out
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/master/bit.out
Sun Apr  2 08:54:53 2006
@@ -807,4 +807,32 @@
 ------------------------------------------------------------------------------------------------------------------------------------------------------
 ij> values cast(X'00680069' as char(30)), cast(X'00680069' as varchar(30)), cast(X'00680069'
as long varchar);
 ERROR 42846: Cannot convert types 'CHAR () FOR BIT DATA' to 'CHAR'.
+ij> -- DERBY-1085
+create table npetest1 (col1 varchar(36) for bit data not null, constraint pknpe1 primary
key (col1));
+0 rows inserted/updated/deleted
+ij> create table npetest2 (col2 varchar(36) for bit data, constraint fknpe1 foreign key
(col2) references npetest1(col1) on delete cascade);
+0 rows inserted/updated/deleted
+ij> insert into npetest1 (col1) values (X'0000000001');
+1 row inserted/updated/deleted
+ij> insert into npetest1 (col1) values (X'0000000002');
+1 row inserted/updated/deleted
+ij> insert into npetest1 (col1) values (X'0000000003');
+1 row inserted/updated/deleted
+ij> insert into npetest2 (col2) values (X'0000000001');
+1 row inserted/updated/deleted
+ij> insert into npetest2 (col2) values (NULL);
+1 row inserted/updated/deleted
+ij> insert into npetest2 (col2) values (X'0000000002');
+1 row inserted/updated/deleted
+ij> select col1 from npetest1 where col1 not in (select col2 from npetest2);
+COL1                                                                    
+------------------------------------------------------------------------
+ij> select col1 from npetest1 where col1 not in (select col2 from npetest2 where col2
is not null);
+COL1                                                                    
+------------------------------------------------------------------------
+0000000003                                                              
+ij> drop table npetest2;
+0 rows inserted/updated/deleted
+ij> drop table npetest1;
+0 rows inserted/updated/deleted
 ij> 

Modified: db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bit.sql
URL: http://svn.apache.org/viewcvs/db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bit.sql?rev=390839&r1=390838&r2=390839&view=diff
==============================================================================
--- db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bit.sql
(original)
+++ db/derby/code/branches/10.1/java/testing/org/apache/derbyTesting/functionTests/tests/lang/bit.sql
Sun Apr  2 08:54:53 2006
@@ -413,3 +413,19 @@
 insert into t5612 values (X'00680069', X'00680069', X'00680069');
 select * from t5612;
 values cast(X'00680069' as char(30)), cast(X'00680069' as varchar(30)), cast(X'00680069'
as long varchar);
+
+-- DERBY-1085
+
+create table npetest1 (col1 varchar(36) for bit data not null, constraint pknpe1 primary
key (col1));
+create table npetest2 (col2 varchar(36) for bit data, constraint fknpe1 foreign key (col2)
references npetest1(col1) on delete cascade);
+insert into npetest1 (col1) values (X'0000000001');
+insert into npetest1 (col1) values (X'0000000002');
+insert into npetest1 (col1) values (X'0000000003');
+insert into npetest2 (col2) values (X'0000000001');
+insert into npetest2 (col2) values (NULL);
+insert into npetest2 (col2) values (X'0000000002');
+select col1 from npetest1 where col1 not in (select col2 from npetest2);
+select col1 from npetest1 where col1 not in (select col2 from npetest2 where col2 is not
null);
+
+drop table npetest2;
+drop table npetest1;



Mime
View raw message