db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From myrn...@apache.org
Subject svn commit: r497678 - in /db/derby/code/trunk/java: testing/org/apache/derbyTesting/functionTests/master/j9_foundation/ testing/org/apache/derbyTesting/functionTests/tests/lang/ testing/org/apache/derbyTesting/functionTests/util/ tools/org/apache/derby...
Date Fri, 19 Jan 2007 01:33:58 GMT
Author: myrnavl
Date: Thu Jan 18 17:33:57 2007
New Revision: 497678

URL: http://svn.apache.org/viewvc?view=rev&rev=497678
Log:
DERBY-2224 - update j9_foundation master/canons to weme 6.1 (J2ME 1.1) results
- this change includes a change to ij because java.math.BigDecimal
  is now available, but JSR169 does not support methods like 
  ResultSet.getBigDecimal(...).
- this change also accepts incorrect behavior in timestampArith.java, which is
  covered in DERBY-2225.


Added:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/timestampArith.out
  (with props)
Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/floattypes.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/grantRevokeDDL.out
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java
    db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/floattypes.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/floattypes.out?view=diff&rev=497678&r1=497677&r2=497678
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/floattypes.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/floattypes.out
Thu Jan 18 17:33:57 2007
@@ -1789,7 +1789,7 @@
 -6.6E38               |3.3E40                |-3.3E40               
 -6.6E38               |3.333E40              |-3.333E40             
 -3.1979999994446195E38|-1.1226600001832754E77|1.1226600001832754E77 
--3.300000034517288E38 |-1.088999988609295E77 |1.088999988609295E77  
+-3.3000000345172877E38|-1.088999988609295E77 |1.088999988609295E77  
 ij> -- see two more rows
 select -d from s;
 1            

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/grantRevokeDDL.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/grantRevokeDDL.out?view=diff&rev=497678&r1=497677&r2=497678
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/grantRevokeDDL.out
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/grantRevokeDDL.out
Thu Jan 18 17:33:57 2007
@@ -2088,15 +2088,18 @@
 ij(MAMTA3)> -- following will pass because all the required privileges are in place for
mamta3
 create trigger tr31t31 after insert on t31TriggerTest for each statement
         insert into mamta1.t13TriggerTest values (values mamta1.selectFromSpecificSchema(1));
-ERROR: Failed with SQLSTATE XJ001
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- following insert will cause a row to be inserted into mamta1.t13TriggerTest
if the session user
 --    has SELECT privilege on mamta1.t12RoutineTest. This shows that although triggers execute
 --    with definer privileges, routines always execute with session user's privilege, even
when 
 --    called by an object which runs with definer's privilege 
 insert into t31TriggerTest values(1);
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 38000
+ERROR: Failed with SQLSTATE XJ001
 ij(MAMTA3)> select * from t31TriggerTest;
-ERROR: Failed with SQLSTATE 08003
+C11        
+-----------
+0 rows selected
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> select * from t12RoutineTest;
 C121       
@@ -2115,9 +2118,8 @@
 insert into mamta3.t31TriggerTest values(1);
 ERROR: Failed with SQLSTATE 28506
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> grant insert on t31TriggerTest to mamta2;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> -- should still fail because trigger on mamta3.t31TriggerTest accesses a routine
which
 --   accesses a table on which mamta2 doesn't have SELECT privilege on. mamta3 doesn't
@@ -2125,18 +2127,21 @@
 --   with the definer privilege. But the routine itself never runs with definer privilege
and
 --   hence the session user needs access to objects accessed by the routine.
 insert into mamta3.t31TriggerTest values(1);
-ERROR: Failed with SQLSTATE 28506
+ERROR: Failed with SQLSTATE 38000
+ERROR: Failed with SQLSTATE XJ001
 ij(MAMTA2)> set connection mamta1;
 ij(MAMTA1)> grant select on t12RoutineTest to mamta2;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta2;
 ij(MAMTA2)> -- mamta2 got the SELECT privilege on mamta1.t12RoutineTest and hence following
insert should pass
 insert into mamta3.t31TriggerTest values(1);
-ERROR: Failed with SQLSTATE 28506
+ERROR: Failed with SQLSTATE 38000
+ERROR: Failed with SQLSTATE XJ001
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> select * from t31TriggerTest;
-ERROR: Failed with SQLSTATE 08003
+C11        
+-----------
+0 rows selected
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> select * from t12RoutineTest;
 C121       
@@ -2156,11 +2161,12 @@
 -- Derby supports only RESTRICT form of revoke execute. Which means that it can be revoked
only if there are no
 -- objects relying on that permission
 revoke execute on function selectFromSpecificSchema from mamta3 restrict;
-0 rows inserted/updated/deleted
+ERROR: Failed with SQLSTATE X0Y25
 ij(MAMTA1)> -- now try the insert and make sure the insert trigger still fires
 set connection mamta2;
 ij(MAMTA2)> insert into mamta3.t31TriggerTest values(1);
-ERROR: Failed with SQLSTATE 28506
+ERROR: Failed with SQLSTATE 38000
+ERROR: Failed with SQLSTATE XJ001
 ij(MAMTA2)> set connection mamta1;
 ij(MAMTA1)> -- If number of rows returned by following select is 1, then we know insert
trigger did get fire.
 -- Insert's trigger's action is to insert into following table. 
@@ -2169,20 +2175,17 @@
 -----------
 0 rows selected
 ij(MAMTA1)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- drop the trigger manually
 drop trigger tr31t31;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> -- Now, we should be able to revoke execute permission on routine because
there are no dependent objects on that permission
 revoke execute on function selectFromSpecificSchema from mamta3 restrict;
 0 rows inserted/updated/deleted
-WARNING 01006: Privilege not revoked from user MAMTA3.
 ij(MAMTA1)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- cleanup
 drop table t31TriggerTest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> -- cleanup
 drop table t12RoutineTest;
@@ -2217,29 +2220,31 @@
 ij(MAMTA1)> grant execute on function selectFromSpecificSchema to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> drop view v21ViewTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE X0X05
 ij(MAMTA3)> -- following will succeed because mamta3 has EXECUTE privileges on the function
 create view v21ViewTest(c211) as values mamta1.selectFromSpecificSchema(1);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> select * from v21ViewTest;
-ERROR: Failed with SQLSTATE 08003
+C211       
+-----------
+ERROR: Failed with SQLSTATE 38000
+ERROR: Failed with SQLSTATE XJ001
 ij(MAMTA3)> grant select on v21ViewTest to mamta2;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> -- Although mamta2 has SELECT privileges on mamta3.v21ViewTest, mamta2 doesn't
have
 --    SELECT privileges on table mamta1.t12RoutineTest accessed by the routine
 --    (which is underneath the view) and hence select from view will fail
 select * from mamta3.v21ViewTest;
-ERROR: Failed with SQLSTATE 42X05
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA2)> set connection mamta1;
 ij(MAMTA1)> grant select  on t12RoutineTest to mamta2;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta2;
 ij(MAMTA2)> -- should fail
 select * from mamta3.v21ViewTest;
-ERROR: Failed with SQLSTATE 42X05
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA2)> -- In this test, the trigger is accessing a view. Any user that has insert
privilege
 --  on trigger table will be able to make an insert even if that user doesn't have
 --  privileges on objects referenced by the trigger.
@@ -2262,13 +2267,12 @@
 ij(MAMTA2)> grant select on v21ViewTest to mamta4;
 ERROR: Failed with SQLSTATE 2850G
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> drop table t31TriggerTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 42Y55
 ij(MAMTA3)> create table t31TriggerTest (c311 int);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> grant insert on t31TriggerTest to mamta4;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> set connection mamta4;
 ij(MAMTA4)> drop table t41TriggerTest;
 ERROR: Failed with SQLSTATE 42Y07
@@ -2278,7 +2282,7 @@
 ERROR: Failed with SQLSTATE 42X94
 ij(MAMTA4)> create trigger tr41t41 after insert on t41TriggerTest for each statement
         insert into mamta3.t31TriggerTest (select * from mamta2.v21ViewTest);
-ERROR: Failed with SQLSTATE 28506
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA4)> insert into t41TriggerTest values(1);
 1 row inserted/updated/deleted
 ij(MAMTA4)> insert into t41TriggerTest values(2);
@@ -2304,27 +2308,27 @@
 2          
 2 rows selected
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> select * from t31TriggerTest;
-ERROR: Failed with SQLSTATE 08003
+C311       
+-----------
+0 rows selected
 ij(MAMTA3)> -- will fail because no permissions on mamta4.t41TriggerTest
 insert into mamta4.t41TriggerTest values(1);
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 28506
 ij(MAMTA3)> -- will fail because no permissions on mamta2.v21ViewTest
 select * from mamta2.v21ViewTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> -- will fail because no permissions on mamta1.t11TriggerTest
 select * from mamta1.t11TriggerTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> set connection mamta4;
 ij(MAMTA4)> grant insert on t41TriggerTest to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA4)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- although mamta3 doesn't have access to the objects referenced by the insert
trigger
 --   following insert will still pass because triggers run with definer's privileges.
 insert into mamta4.t41TriggerTest values(1);
-ERROR: Failed with SQLSTATE 08003
+1 row inserted/updated/deleted
 ij(MAMTA3)> -- Test constraints
 set connection mamta1;
 ij(MAMTA1)> drop table t11ConstraintTest;
@@ -2349,11 +2353,10 @@
 ij(MAMTA2)> grant references on t21ConstraintTest to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> create table t31ConstraintTest (c311 int references mamta1.t11ConstraintTest,
c312 int references mamta2.t21ConstraintTest);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> drop table t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- multi-key foreign key constraint and the REFERENCES privilege granted at
user level. This should cause only
 --   one row in SYSDEPENDS for REFERENCES privilege.
 set connection mamta1;
@@ -2364,13 +2367,12 @@
 ij(MAMTA1)> grant references on t11ConstraintTest to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> drop table t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 42Y55
 ij(MAMTA3)> create table t31ConstraintTest (c311 int, c312 int, foreign key(c311, c312)
references mamta1.t11ConstraintTest);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> drop table t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- Same test as above with multi-key foreign key constraint but one column
REFERENCES privilege granted at user level
 --   and other column REFERENCES privilege granted at PUBLIC level. This should cause two
rows in SYSDEPENDS for REFERENCES privilege.
 set connection mamta1;
@@ -2384,28 +2386,27 @@
 0 rows inserted/updated/deleted
 ij(MAMTA1)> --connect 'jdbc:derby:c:/dellater/dbmaintest2;create=true' user 'mamta3' as
mamta3;
 set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> drop table t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 42Y55
 ij(MAMTA3)> create table t31ConstraintTest (c311 int,  c312 int, foreign key(c311, c312)
references mamta1.t11ConstraintTest);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> drop table t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- Same test as above with multi-key foreign key constraint, one column REFERENCES
privilege granted at user level
 --   and other column REFERENCES privilege granted at PUBLIC level. This should cause two
rows in SYSDEPENDS for REFERENCES privilege.
 --   But foreign key reference is added using alter table rather than at create table time
 create table t31constrainttest(c311 int, c312 int);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> alter table t31constrainttest add foreign key (c311, c312) references mamta1.t11constrainttest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> drop table t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- create the table again, but this time one foreign key constraint on one
table with single column primary key and
 --   another foreign key constraint on another table with multi-column primary key
 create table t31constrainttest(c311 int, c312 int, c313 int references mamta2.t21ConstraintTest);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> alter table t31constrainttest add foreign key (c311, c312) references mamta1.t11constrainttest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- revoke of TRIGGERS and other privileges should drop dependent triggers
 set connection mamta1;
 ij(MAMTA1)> drop table t11TriggerRevokeTest;
@@ -3084,13 +3085,12 @@
 ij(MAMTA1)> grant references on d1589t11ConstraintTest to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> drop table d1589t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 42Y55
 ij(MAMTA3)> create table d1589t31ConstraintTest (c311 int, c312 int, foreign key(c311,
c312) references mamta1.d1589t11ConstraintTest);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> drop table d1589t31ConstraintTest;
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> set connection mamta1;
 ij(MAMTA1)> drop table d1589t11ConstraintTest;
 0 rows inserted/updated/deleted
@@ -3101,9 +3101,8 @@
 ij(MAMTA1)> grant references(c112) on d1589t11ConstraintTest to PUBLIC;
 0 rows inserted/updated/deleted
 ij(MAMTA1)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> create table d1589t31ConstraintTest (c311 int, c312 int, foreign key(c311,
c312) references mamta1.d1589t11ConstraintTest);
-ERROR: Failed with SQLSTATE 08003
+0 rows inserted/updated/deleted
 ij(MAMTA3)> -- DERBY-1847 SELECT statement asserts with XJ001 when attempted to select
a newly added column
 -- Grant access on 2 columns and then add another column to the table. The select on the
new column
 -- by another user should complain about no permissions granted on that new column.
@@ -3115,41 +3114,40 @@
 ij(MAMTA2)> alter table t1Derby1847 add c3 int;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- should fail because mamta3 doesn't have any permission on this column in
table mamta2.t1Derby1847
 select c3 from mamta2.t1Derby1847;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> grant select on t1Derby1847 to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- should work now because mamta3 got select permission on new column in table
mamta2.t1Derby1847 through table level select permission
 select c3 from mamta2.t1Derby1847;
-ERROR: Failed with SQLSTATE 08003
+C3         
+-----------
+0 rows selected
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> revoke select on t1Derby1847 from mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- should fail because mamta3 lost it's select permission on new column in
table mamta2.t1Derby1847
 select c3 from mamta2.t1Derby1847;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 28508
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> grant select(c3) on t1Derby1847 to mamta3;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> -- should work now because mamta3 got select permission on new column in table
mamta2.t1Derby1847 through column level select permission
 select c3 from mamta2.t1Derby1847;
-ERROR: Failed with SQLSTATE 08003
+C3         
+-----------
+0 rows selected
 ij(MAMTA3)> set connection mamta2;
 ij(MAMTA2)> drop table t1Derby1847;
 0 rows inserted/updated/deleted
 ij(MAMTA2)> set connection mamta3;
-ERROR: Failed with SQLSTATE 08003
 ij(MAMTA3)> select c3 from mamta2.t1Derby1847;
-ERROR: Failed with SQLSTATE 08003
+ERROR: Failed with SQLSTATE 42X05
 ij(MAMTA3)> -- DERBY-1716
 -- Revoking select privilege from a user times out when that user still have
 -- a cursor open before the patch.
@@ -3229,4 +3227,32 @@
 IJ ERROR: Unable to establish cursor
 ij(USER2)> autocommit on;
 ij(USER2)> set connection user1;
+ij(USER1)> -- Another test for DERBY-1847: verify that columns field is updated
+-- correctly when adding a column to a table:
+create table d1847_c (a int, b int, c int);
+0 rows inserted/updated/deleted
+ij(USER1)> grant select (a) on d1847_c to first_user;
+0 rows inserted/updated/deleted
+ij(USER1)> grant update (b) on d1847_c to second_user;
+0 rows inserted/updated/deleted
+ij(USER1)> grant select (c) on d1847_c to third_user;
+0 rows inserted/updated/deleted
+ij(USER1)> select c.grantee, c.type, c.columns from sys.syscolperms c, sys.systables t
+    where c.tableid = t.tableid and t.tablename='D1847_C';
+GRANTEE                                                                                 
                                       |&|COLUMNS        
+--------------------------------------------------------------------------------------------------------------------------------------------------
+FIRST_USER                                                                              
                                       |s|{0}            
+SECOND_USER                                                                             
                                       |u|{1}            
+THIRD_USER                                                                              
                                       |s|{2}            
+3 rows selected
+ij(USER1)> alter table d1847_c add column d int;
+0 rows inserted/updated/deleted
+ij(USER1)> select c.grantee, c.type, c.columns from sys.syscolperms c, sys.systables t
+    where c.tableid = t.tableid and t.tablename='D1847_C';
+GRANTEE                                                                                 
                                       |&|COLUMNS        
+--------------------------------------------------------------------------------------------------------------------------------------------------
+FIRST_USER                                                                              
                                       |s|{0}            
+SECOND_USER                                                                             
                                       |u|{1}            
+THIRD_USER                                                                              
                                       |s|{2}            
+3 rows selected
 ij(USER1)> 

Added: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/timestampArith.out
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/timestampArith.out?view=auto&rev=497678
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/timestampArith.out
(added)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/timestampArith.out
Thu Jan 18 17:33:57 2007
@@ -0,0 +1,4 @@
+Test timestamp arithmetic starting.
+Unexpected result from 'values( {fn TIMESTAMPADD( SQL_TSI_FRAC_SECOND, -1000,{d '2005-05-11'})})'.
 Expected xxxxxxFILTERED-TIMESTAMPxxxxxgot xxxxxxFILTERED-TIMESTAMPxxxxx.
+Unexpected result from 'values( {fn TIMESTAMPADD( SQL_TSI_FRAC_SECOND, -1000,{d '2005-05-11'})})'.
 Expected xxxxxxFILTERED-TIMESTAMPxxxxxgot xxxxxxFILTERED-TIMESTAMPxxxxx.
+FAILED. 2 errors.

Propchange: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/master/j9_foundation/timestampArith.out
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java?view=diff&rev=497678&r1=497677&r2=497678
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/lang/timestampArith.java
Thu Jan 18 17:33:57 2007
@@ -172,6 +172,7 @@
         // Test add with all combinatons of interval types and datetime types
         new OneAddTest( FRAC_SECOND_INTERVAL, 1000, ts("2005-05-11 15:55:00"), ts("2005-05-11
15:55:00.000001"),
                         null, null),
+        // following gives an error with J2ME j9_foundation 1.1 (DERBY-2225):
         new OneAddTest( FRAC_SECOND_INTERVAL, -1000, dt("2005-05-11"), ts("2005-05-10 23:59:59.999999"),
                         null, null),
         new OneAddTest( SECOND_INTERVAL, 60, ts("2005-05-11 15:55:00"), ts("2005-05-11 15:56:00"),
null, null),

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java?view=diff&rev=497678&r1=497677&r2=497678
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/util/BigDecimalHandler.java
Thu Jan 18 17:33:57 2007
@@ -25,12 +25,16 @@
 import java.sql.CallableStatement;
 import java.sql.PreparedStatement;
 import java.math.BigDecimal;
+import java.lang.reflect.*;
 
 /**
  *  BigDecimalHandler provides wrappers for JDBC API methods which use BigDecimal.
  *  When writing tests which use BigDecimal, the methods in this class can be called
  *  instead of directly calling JDBC methods. This way the same test can be used in JVMs

- *  like J2ME/CDC/Foundation Profile, which do not have BigDecimal class. 
+ *  like J2ME/CDC/Foundation Profile 1.0, which do not have BigDecimal class, or
+ *  JSR169 Profile, which does not support method calls using BigDecimal (such 
+ *  as ResultSet.getBigDecimal(..).
+ *  
  * 
  *  * @author deepa
  *
@@ -45,11 +49,22 @@
 		try{
 			Class.forName("java.math.BigDecimal");
 			representation = BIGDECIMAL_REPRESENTATION;
+			// This class will attempt calls to ResultSet.getBigDecimal,
+			// which may not be available with jvms that support JSR169,
+			// even if BigDecimal itself has been made available (e.g. 
+			// supporting J2ME/CDC/Foundation Profile 1.1).
+			Method getbd = ResultSet.class.getMethod("getBigDecimal", new Class[] {int.class});
+			representation = BIGDECIMAL_REPRESENTATION;
 		}
 		catch(ClassNotFoundException e){
 			//Used for J2ME/Foundation
 			representation = STRING_REPRESENTATION;
 		}
+		catch(NoSuchMethodException e){
+			//Used for J2ME/Foundation
+			representation = STRING_REPRESENTATION;
+		}
+
 	}
 	
 	//Type conversions supported by ResultSet getBigDecimal method - JDBC3.0 Table B-6 

Modified: db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java?view=diff&rev=497678&r1=497677&r2=497678
==============================================================================
--- db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
(original)
+++ db/derby/code/trunk/java/tools/org/apache/derby/iapi/tools/i18n/LocalizedResource.java
Thu Jan 18 17:33:57 2007
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.UnsupportedEncodingException;
+import java.lang.reflect.Method;
 
 import java.util.ResourceBundle;
 import java.util.Date;
@@ -45,17 +46,24 @@
 
 public final class LocalizedResource  implements java.security.PrivilegedAction {
 
-	private static final boolean HAVE_BIG_DECIMAL;
+	private static final boolean SUPPORTS_BIG_DECIMAL_CALLS;
 	
 	static {
-		boolean haveBigDecimal;
+		boolean supportsBigDecimalCalls;
 		try {
+			// This class attempts to make a call to a 
+			// ResultSet.getBigDecimal method, which may not be available.
+			// For instance, java.math.BigDecimal is not available with
+			// J2ME/CDC/Foundation 1.0 profile.
 			Class.forName("java.math.BigDecimal");
-			haveBigDecimal = true;
+			supportsBigDecimalCalls = true;
+			// And no methods using BigDecimal are available with JSR169 spec.
+			Method getbd = ResultSet.class.getMethod("getBigDecimal", new Class[] {int.class});
+			supportsBigDecimalCalls = true;
 		} catch (Throwable t) {
-			haveBigDecimal = false;
+			supportsBigDecimalCalls = false;
 		}
-		HAVE_BIG_DECIMAL = haveBigDecimal;
+		SUPPORTS_BIG_DECIMAL_CALLS = supportsBigDecimalCalls;
 	}
 	
 	private ResourceBundle res;
@@ -331,7 +339,7 @@
 					type == Types.DOUBLE ) {
 				return getNumberAsString(rs.getDouble(columnNumber));
 			}
-			else if (HAVE_BIG_DECIMAL && (type == Types.NUMERIC || type == Types.DECIMAL))
{
+			else if (SUPPORTS_BIG_DECIMAL_CALLS && (type == Types.NUMERIC || type == Types.DECIMAL))
{
 				return	getNumberAsString(rs.getBigDecimal(columnNumber,
 											rsm.getScale(columnNumber)));
 			}



Mime
View raw message