db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhille...@apache.org
Subject svn commit: r1042682 [2/2] - in /db/derby/code/branches/10.7/java: client/org/apache/derby/client/am/ engine/org/apache/derby/iapi/reference/ engine/org/apache/derby/iapi/types/ engine/org/apache/derby/impl/jdbc/ testing/org/apache/derbyTesting/functio...
Date Mon, 06 Dec 2010 15:46:41 GMT
Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/insert.out?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/insert.out
Mon Dec  6 15:46:40 2010
@@ -376,10 +376,10 @@ ij> insert into i3 values (null, null, n
 ij> insert into i4 select * from i3;
 2 rows inserted/updated/deleted
 ij> select * from i4;
-B   |BV  |LBV                                                                           
                                                 |C         |CV        |LVC              
                                                                                         
                    |DT        |T       |TS                        
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-11  |22  |25                                                                            
                                                 |3         |4         |5                
                                                                                         
                    |1990-10-10|11:11:11|1990-11-11 11:11:11.0     
-NULL|NULL|NULL                                                                          
                                                 |NULL      |NULL      |NULL             
                                                                                         
                    |NULL      |NULL    |NULL                      
+B   |BV  |LBV                                                                           
                                                 |C         |CV        |LVC              
                                                                                         
                    |DT        |T       |TS                           
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+11  |22  |25                                                                            
                                                 |3         |4         |5                
                                                                                         
                    |1990-10-10|11:11:11|1990-11-11 11:11:11.0        
+NULL|NULL|NULL                                                                          
                                                 |NULL      |NULL      |NULL             
                                                                                         
                    |NULL      |NULL    |NULL                         
 ij> delete from i4;
 2 rows inserted/updated/deleted
 ij> create table tab2 (
@@ -398,10 +398,10 @@ ij> insert into tab2 values (null, null,
 ij> insert into i4 (c, cv, lvc, dt, t, ts) select c, cv, lvc, dt, t, ts from tab2;
 2 rows inserted/updated/deleted
 ij> select * from i4;
-B   |BV  |LBV                                                                           
                                                 |C         |CV        |LVC              
                                                                                         
                    |DT        |T       |TS                        
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-NULL|NULL|NULL                                                                          
                                                 |3         |4         |5                
                                                                                         
                    |1990-10-10|11:11:11|1990-11-11 11:11:11.0     
-NULL|NULL|NULL                                                                          
                                                 |NULL      |NULL      |NULL             
                                                                                         
                    |NULL      |NULL    |NULL                      
+B   |BV  |LBV                                                                           
                                                 |C         |CV        |LVC              
                                                                                         
                    |DT        |T       |TS                           
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+NULL|NULL|NULL                                                                          
                                                 |3         |4         |5                
                                                                                         
                    |1990-10-10|11:11:11|1990-11-11 11:11:11.0        
+NULL|NULL|NULL                                                                          
                                                 |NULL      |NULL      |NULL             
                                                                                         
                    |NULL      |NULL    |NULL                         
 ij> -- drop the tables
 drop table t1;
 0 rows inserted/updated/deleted

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/nonreserved.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/nonreserved.out?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/nonreserved.out
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/nonreserved.out
Mon Dec  6 15:46:40 2010
@@ -181,29 +181,29 @@ create table timestamp (timestamp timest
 ij> insert into timestamp(timestamp) values (timestamp('2002-05-22 16:17:34.144'));
 1 row inserted/updated/deleted
 ij> select timestamp from timestamp;
-TIMESTAMP                 
---------------------------
-2002-05-22 16:17:34.144   
+TIMESTAMP                    
+-----------------------------
+2002-05-22 16:17:34.144      
 ij> select timestamp( '2003-05-22 16:17:34.144'), timestamp "2003-05-22 16:17:34.144"
from timestamp;
-1                         |2003-05-22 16:17:34.144   
------------------------------------------------------
-2003-05-22 16:17:34.144   |2002-05-22 16:17:34.144   
+1                            |2003-05-22 16:17:34.144      
+-----------------------------------------------------------
+2003-05-22 16:17:34.144      |2002-05-22 16:17:34.144      
 ij> select timestamp timestamp from timestamp;
-TIMESTAMP                 
---------------------------
-2002-05-22 16:17:34.144   
+TIMESTAMP                    
+-----------------------------
+2002-05-22 16:17:34.144      
 ij> select timestamp as timestamp from timestamp;
-TIMESTAMP                 
---------------------------
-2002-05-22 16:17:34.144   
+TIMESTAMP                    
+-----------------------------
+2002-05-22 16:17:34.144      
 ij> select timestamp.timestamp as timestamp from timestamp timestamp;
-TIMESTAMP                 
---------------------------
-2002-05-22 16:17:34.144   
+TIMESTAMP                    
+-----------------------------
+2002-05-22 16:17:34.144      
 ij> select timestamp.timestamp as timestamp from timestamp as timestamp;
-TIMESTAMP                 
---------------------------
-2002-05-22 16:17:34.144   
+TIMESTAMP                    
+-----------------------------
+2002-05-22 16:17:34.144      
 ij> delete from timestamp where timestamp = timestamp('2002-05-22 16:17:34.144');
 1 row inserted/updated/deleted
 ij> create index timestamp on timestamp(timestamp);

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/orderby.out
Mon Dec  6 15:46:40 2010
@@ -680,12 +680,12 @@ D         |C         
 1992-01-01|theend    
 1992-01-01|NULL      
 ij> select ts,t from missed order by ts desc, t;
-TS                        |T       
------------------------------------
-1997-02-04 12:02:00.001   |20:01:01
-1997-02-04 12:02:00.001   |20:01:01
-1993-02-04 12:02:00.001   |23:01:01
-1993-02-04 12:02:00.001   |23:01:01
+TS                           |T       
+--------------------------------------
+1997-02-04 12:02:00.001      |20:01:01
+1997-02-04 12:02:00.001      |20:01:01
+1993-02-04 12:02:00.001      |23:01:01
+1993-02-04 12:02:00.001      |23:01:01
 ij> select l from missed order by l;
 L                   
 --------------------
@@ -792,10 +792,10 @@ ij> insert into tab1 values (1, cast(1 a
 ij> insert into tab1 values (2, cast(2 as int), cast(2 as smallint), cast(2 as bigint),
'2', '2', '2', cast(2.2 as double precision), cast(2.2 as real), '1995-02-02', '12:12:12',
'1996-02-02 12:10:10.1', cast(2.2 as decimal(2,1)));
 1 row inserted/updated/deleted
 ij> select * from tab1 order by 1;
-I          |TN         |S          |L          |C         |V         |LVC       |D      
              |R            |DT        |T       |TS                        |DC  
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
-1          |1          |1          |1          |1         |1         |1         |1.1    
              |1.1          |1996-01-01|11:11:11|1996-01-01 11:10:10.1     |1.1 
-2          |2          |2          |2          |2         |2         |2         |2.2    
              |2.2          |1995-02-02|12:12:12|1996-02-02 12:10:10.1     |2.2 
+I          |TN         |S          |L          |C         |V         |LVC       |D      
              |R            |DT        |T       |TS                           |DC  
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+1          |1          |1          |1          |1         |1         |1         |1.1    
              |1.1          |1996-01-01|11:11:11|1996-01-01 11:10:10.1        |1.1 
+2          |2          |2          |2          |2         |2         |2         |2.2    
              |2.2          |1995-02-02|12:12:12|1996-02-02 12:10:10.1        |2.2 
 ij> rollback;
 ij> -- bug 2769 (correlation columns, group by and order by)
 create table bug2769(c1 int, c2 int);

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/specjPlans.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/specjPlans.out?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/specjPlans.out
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/specjPlans.out
Mon Dec  6 15:46:40 2010
@@ -655,8 +655,8 @@ call SYSCS_UTIL.SYSCS_SET_RUNTIMESTATIST
 ij> maximumdisplaywidth 3500;
 ij> SELECT T1.O_STATUS, T1.O_SHIP_DATE, T1.O_ENTRY_DATE, T1.O_TOTAL, T1.O_DISCOUNT, T1.O_OL_CNT,
T1.O_C_ID, T1.O_ID 
  FROM O_ORDERS  T1 WHERE o_c_id = 0 FOR UPDATE ;
-O_STATUS   |O_SHIP_DA&|O_ENTRY_DATE              |O_TOTAL    |O_DIS&|O_OL_CNT   |O_C_ID
    |O_ID       
---------------------------------------------------------------------------------------------------------
+O_STATUS   |O_SHIP_DA&|O_ENTRY_DATE                 |O_TOTAL    |O_DIS&|O_OL_CNT
  |O_C_ID     |O_ID       
+-----------------------------------------------------------------------------------------------------------
 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
 1                                                                                       
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         

                                    
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -----------------------------------
@@ -815,8 +815,8 @@ Source result set:
 					Negate comparison result: false
 ij> SELECT T1.WO_NUMBER, T1.WO_O_ID, T1.WO_OL_ID, T1.WO_STATUS, T1.WO_ORIG_QTY, T1.WO_COMP_QTY,
T1.WO_ASSEMBLY_ID, 
  T1.WO_DUE_DATE, T1.WO_START_DATE FROM M_WORKORDER  T1 WHERE T1.WO_NUMBER = 1 FOR UPDATE;
-WO_NUMBER  |WO_O_ID    |WO_OL_ID   |WO_STATUS  |WO_ORIG_QTY|WO_COMP_QTY|WO_ASSEMBLY_ID |WO_DUE_DA&|WO_START_DATE
            
------------------------------------------------------------------------------------------------------------------------------
+WO_NUMBER  |WO_O_ID    |WO_OL_ID   |WO_STATUS  |WO_ORIG_QTY|WO_COMP_QTY|WO_ASSEMBLY_ID |WO_DUE_DA&|WO_START_DATE
               
+--------------------------------------------------------------------------------------------------------------------------------
 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
 1                                                                                       
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         

                                    
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -----------------------------------
@@ -1871,8 +1871,8 @@ Columns accessed from heap = {2, 3, 4, 5
 		qualifiers:
 			None
 ij> SELECT T1.O_STATUS, T1.O_SHIP_DATE, T1.O_ENTRY_DATE, T1.O_TOTAL, T1.O_DISCOUNT, T1.O_OL_CNT,
T1.O_C_ID, T1.O_ID FROM O_ORDERS  T1 WHERE T1.O_ID = 1 FOR UPDATE;
-O_STATUS   |O_SHIP_DA&|O_ENTRY_DATE              |O_TOTAL    |O_DIS&|O_OL_CNT   |O_C_ID
    |O_ID       
---------------------------------------------------------------------------------------------------------
+O_STATUS   |O_SHIP_DA&|O_ENTRY_DATE                 |O_TOTAL    |O_DIS&|O_OL_CNT
  |O_C_ID     |O_ID       
+-----------------------------------------------------------------------------------------------------------
 ij> values SYSCS_UTIL.SYSCS_GET_RUNTIMESTATISTICS();
 1                                                                                       
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         
                                                                                         

                                    
 -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 -----------------------------------

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/triggerRefClause.out
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/triggerRefClause.out?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/triggerRefClause.out
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/master/triggerRefClause.out
Mon Dec  6 15:46:40 2010
@@ -140,12 +140,12 @@ ij> insert into allTypes1 values (0, 10,
 					  X'12af', X'0F0F', X'1234', 111.11, 222.2);
 1 row inserted/updated/deleted
 ij> select * from allTypes1;
-I          |TN    |S     |L                   |C         |V                             
                   |LVC                                                                  
                                                          |D                     |R      
     |F                     |DT        |T       |TS                        |B   |BV  |LBV
                                                                                         
                                  |DC     |N         
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+I          |TN    |S     |L                   |C         |V                             
                   |LVC                                                                  
                                                          |D                     |R      
     |F                     |DT        |T       |TS                           |B   |BV  |LBV
                                                                                         
                                  |DC     |N         
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 0          |10    |100   |1000000             |duplicate |this is duplicated            
                   |also duplicated                                                      
                                                          |200.0                 |200.0  
     |200.0                 |1992-01-01|12:30:30|xxxxxxFILTERED-TIMESTAMPxxxxx|12af|0f0f|1234
                                                                                         
                                 |111.11 |222.2000  
 ij> select * from allTypes2;
-I          |TN    |S     |L                   |C         |V                             
                   |LVC                                                                  
                                                          |D                     |R      
     |F                     |DT        |T       |TS                        |B   |BV  |LBV
                                                                                         
                                  |DC     |N         
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
+I          |TN    |S     |L                   |C         |V                             
                   |LVC                                                                  
                                                          |D                     |R      
     |F                     |DT        |T       |TS                           |B   |BV  |LBV
                                                                                         
                                  |DC     |N         
+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
 0          |10    |100   |1000000             |duplicate |this is duplicated            
                   |also duplicated                                                      
                                                          |200.0                 |200.0  
     |200.0                 |1992-01-01|12:30:30|xxxxxxFILTERED-TIMESTAMPxxxxx|12af|0f0f|1234
                                                                                         
                                 |111.11 |222.2000  
 ij> commit;
 ij> drop trigger t1;

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/DatabaseMetaDataTest.java
Mon Dec  6 15:46:40 2010
@@ -21,6 +21,7 @@
  */
 package org.apache.derbyTesting.functionTests.tests.jdbcapi;
 
+import java.lang.reflect.Method;
 import java.io.IOException;
 import java.math.BigDecimal;
 //import java.lang.reflect.Constructor;
@@ -2185,7 +2186,7 @@ public class DatabaseMetaDataTest extend
                 precision = 8;
                 break;
             case Types.TIMESTAMP:
-                precision = 26;
+                precision = 29;
                 break;
                                 
             case Types.DECIMAL:
@@ -2363,7 +2364,7 @@ public class DatabaseMetaDataTest extend
             maxScale = 31; // Max Scale for Decimal & Numeric is 31: Derby-2262
             break;
             case Types.TIMESTAMP:
-                maxScale = 6;
+                maxScale = 9;
                 break;
             case Types.SMALLINT:
             case Types.INTEGER:
@@ -4524,7 +4525,7 @@ public class DatabaseMetaDataTest extend
                 {null,"APP","GETPCTEST1","I","1","8","DOUBLE","52","8",null,"2","1",null,null,"8",null,null,"9","YES","genid","12","8"},
               
                 {null,"APP","GETPCTEST1","K","1","91","DATE","10","6","0","10","1",null,null,"9","1",null,"10","YES","genid","12","9"},
               
                 {null,"APP","GETPCTEST1","L","1","92","TIME","8","6","0","10","1",null,null,"9","2",null,"11","YES","genid","12","10"},
               
-                {null,"APP","GETPCTEST1","T","1","93","TIMESTAMP","26","16","6","10","1",null,null,"9","3",null,"12","YES","genid","12","11"},
               
+                {null,"APP","GETPCTEST1","T","1","93","TIMESTAMP","29","16","9","10","1",null,null,"9","3",null,"12","YES","genid","12","11"},
               
                 {null,"APP","GETPCTEST2","PA","1","4","INTEGER","10","4","0","10","1",null,null,"4",null,null,"1","YES","genid","2","0"},
                 {null,"APP","GETPCTEST2","PB","1","-5","BIGINT","19","40","0","10","1",null,null,"-5",null,null,"2","YES","genid","2","1"},
                 {null,"APP","GETPCTEST3A","STRING1","1","12","VARCHAR","5","10",null,null,"1",null,null,"12",null,"10","1","YES","genid","2","0"},

@@ -4776,6 +4777,85 @@ public class DatabaseMetaDataTest extend
         return rss;        
     }
 
+    /**
+     * Test DatabaseMetaData.getFunctionColumns()
+     */
+    public void testGetFunctionColumns() throws Exception
+    {
+        // this method is supported in database meta data only from 10.2 onward
+
+        boolean supportsBoolean = true;
+        Version dataVersion = getDataVersion( getConnection() );
+        if ( dataVersion.compareTo( new Version( 10, 7, 0, 0 ) ) < 0 ) { supportsBoolean
= false; }
+        
+        if ( dataVersion.compareTo( new Version( 10, 2, 0, 0 ) ) < 0 ) { return; }
+
+        DatabaseMetaData dmd = getDMD();
+        Statement s = createStatement();
+        getConnection().setAutoCommit(false);
+        
+        s.execute("create function f_gfc_1 (" +
+                "a VARCHAR(3), b NUMERIC, c SMALLINT, " +
+                "e CHAR(3), f INTEGER, g BIGINT, h FLOAT, i DOUBLE PRECISION, " +
+                "k DATE, l TIME, T TIMESTAMP ) returns int "+
+                "language java external name " +
+                "'org.apache.derbyTesting.BlahBlah.blah'" +
+        " parameter style java"); 
+
+        if ( supportsBoolean )
+        {
+            s.execute("create function f_gfc_2 ( a boolean) returns boolean "+
+                      "language java external name " +
+                      "'org.apache.derbyTesting.functionTests.BlahBlah.blah'" +
+                      " parameter style java");
+        }
+
+        // We have to use reflection to get the getFunctionColumns() method.
+        // That is because we compile this test to run on old versions of the
+        // vm whose DatabaseMetaData doesn't include this method, even though
+        // our actual drivers do.
+        Method gfcMethod = dmd.getClass().getMethod
+            ( "getFunctionColumns", new Class[] { String.class, String.class, String.class,
String.class, } );
+        
+        ResultSet rs = (ResultSet) gfcMethod.invoke( dmd, new String[] { null, "%", "F_GFC_%",
"%" } );
+
+        String[][] expRS = new String[][]
+            {
+                {null,"APP","F_GFC_1","","4","4","INTEGER","10","4","0","10","1",null,null,"0","YES","genid","11","-1"},
               
+                {null,"APP","F_GFC_1","A","1","12","VARCHAR","3","6",null,null,"1",null,"6","1","YES","genid","11","0"},
+                {null,"APP","F_GFC_1","B","1","2","NUMERIC","5","14","0","10","1",null,null,"2","YES","genid","11","1"},
+                {null,"APP","F_GFC_1","C","1","5","SMALLINT","5","2","0","10","1",null,null,"3","YES","genid","11","2"},
+                {null,"APP","F_GFC_1","E","1","1","CHAR","3","6",null,null,"1",null,"6","4","YES","genid","11","3"},
+                {null,"APP","F_GFC_1","F","1","4","INTEGER","10","4","0","10","1",null,null,"5","YES","genid","11","4"},
               
+                {null,"APP","F_GFC_1","G","1","-5","BIGINT","19","40","0","10","1",null,null,"6","YES","genid","11","5"},
               
+                {null,"APP","F_GFC_1","H","1","8","DOUBLE","52","8",null,"2","1",null,null,"7","YES","genid","11","6"},
               
+                {null,"APP","F_GFC_1","I","1","8","DOUBLE","52","8",null,"2","1",null,null,"8","YES","genid","11","7"},
               
+                {null,"APP","F_GFC_1","K","1","91","DATE","10","6","0","10","1",null,null,"9","YES","genid","11","8"},
               
+                {null,"APP","F_GFC_1","L","1","92","TIME","8","6","0","10","1",null,null,"10","YES","genid","11","9"},
               
+                {null,"APP","F_GFC_1","T","1","93","TIMESTAMP","29","16","9","10","1",null,null,"11","YES","genid","11","10"},
               
+            };
+        if ( supportsBoolean )
+        {
+            expRS = appendArray
+                (
+                 expRS,
+                 new String[][]
+                 {
+                     {null,"APP","F_GFC_2","","4","16","BOOLEAN","1","1",null,null,"1",null,null,"0","YES","genid","1","-1"},
+                     {null,"APP","F_GFC_2","A","1","16","BOOLEAN","1","1",null,null,"1",null,null,"1","YES","genid","1","0"},
+                 }
+                 );
+        }
+
+        int rowcount = 0;
+
+        assertResults( rs, expRS, true );
+        
+        if ( supportsBoolean ) { s.execute("drop function f_gfc_2"); }
+        s.execute("drop function f_gfc_1");
+        commit();
+    }
+
     public void testBugFixes() throws SQLException {
         
         Statement s = createStatement();
@@ -4918,4 +4998,42 @@ public class DatabaseMetaDataTest extend
         }
     }
 
+    /**
+     * Assert that the ResultSet returns the desired rows.
+     */
+    private void assertResults( ResultSet rs, String[][] rows, boolean trimResults )
+        throws Exception
+    {
+        int     actualColumnCount = rs.getMetaData().getColumnCount();
+        int     rowCount = rows.length;
+
+        for ( int i = 0; i < rowCount; i++ )
+        {
+            String[]    row = rows[ i ];
+            int             columnCount = row.length;
+
+            assertTrue( rs.next() );
+            assertEquals( columnCount, actualColumnCount );
+
+            for ( int j = 0; j < columnCount; j++ )
+            {
+                String  expectedValue =  row[ j ];
+                //println( "XXX (row, column ) ( " + i + ", " +  j + " ) should be " + expectedValue
);
+                String  actualValue = null;
+                int         column = j+1;
+
+                actualValue = rs.getString( column );
+                if ( rs.wasNull() ) { actualValue = null; }
+
+                if ( (actualValue != null) && trimResults ) { actualValue = actualValue.trim();
}
+                
+                assertEquals( (expectedValue == null), rs.wasNull() );
+                
+                if ( expectedValue == null )    { assertNull( actualValue ); }
+                else if ( "genid".equals( expectedValue ) ) { assertTrue( actualValue.startsWith(
"SQL" ) ); }
+                else { assertEquals(expectedValue, actualValue); }
+            }
+        }
+    }
+
 }

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMetaDataJdbc30Test.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMetaDataJdbc30Test.java?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMetaDataJdbc30Test.java
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMetaDataJdbc30Test.java
Mon Dec  6 15:46:40 2010
@@ -31,6 +31,7 @@ import java.sql.PreparedStatement;
 import java.sql.ResultSet;
 import java.sql.Statement;
 import java.sql.SQLException;
+import java.sql.Timestamp;
 import java.sql.Types;
 import java.math.BigDecimal;
 
@@ -645,6 +646,43 @@ public class ParameterMetaDataJdbc30Test
        		stmt.execute("DROP PROCEDURE PMDC");
             stmt.close();
 	}
+
+	/**
+         * test ParameterMetaData for Java procedures with TIMESTAMP parameters
+	 *
+	 * @exception SQLException if error occurs
+         */
+    public void testParameterMetadataWithTimestampParameters () throws SQLException
+    {
+        Statement stmt = createStatement();
+        stmt.execute("CREATE PROCEDURE PMDT(IN pmdI_1 TIMESTAMP, INOUT pmdI_2 TIMESTAMP,
OUT pmdI_3 TIMESTAMP) language java parameter style java external name 'org.apache.derbyTesting.functionTests.tests.jdbcapi.ParameterMetaDataJdbc30Test.dummyString'");
+        CallableStatement cs = prepareCall("CALL PMDT(?, ?, ?)");
+        // parameter 1 is input only	
+        cs.setTimestamp(1, new Timestamp( 0L ) );
+        // parameter 2 is input and output
+        Object x = new Timestamp( 2L );
+        cs.setObject(2,x, Types.CHAR);
+        cs.registerOutParameter(2,Types.TIMESTAMP);
+        //parameter 3 is output only
+        cs.registerOutParameter(3,Types.TIMESTAMP);
+        //verify the meta data for the parameters
+        ParameterMetaData paramMetaData = cs.getParameterMetaData();
+        assertEquals("Unexpected parameter count", 3, paramMetaData.getParameterCount());
+        
+        //expected values to be stored in a 2dim. array
+        String parameterMetaDataArray0 [][] = {
+            //isNullable, isSigned, getPrecision, getScale, getParameterType, getParameterTypeName,
getParameterClassName, getParameterMode
+            {"PARAMETER_NULLABLE", "false", "29", "9", "93", "TIMESTAMP", "java.sql.Timestamp",
"PARAMETER_MODE_IN"},
+            {"PARAMETER_NULLABLE", "false", "29", "9", "93", "TIMESTAMP", "java.sql.Timestamp",
"PARAMETER_MODE_IN_OUT"},
+            {"PARAMETER_NULLABLE", "false", "29", "9", "93", "TIMESTAMP", "java.sql.Timestamp",
"PARAMETER_MODE_OUT"}};
+        
+        testParameterMetaData(cs.getParameterMetaData(), parameterMetaDataArray0);
+        
+        cs.close();
+        stmt.execute("DROP PROCEDURE PMDT");
+        stmt.close();
+    }
+    
 	/**
          *  test ParameterMetaData for Java procedures with DECIMAL parameters
 	 *
@@ -915,6 +953,13 @@ public class ParameterMetaDataJdbc30Test
         }
 	
 	/**
+     * Java method for procedure PMDT which tests ParameterMetaData for Java procedures 
+     * with TIMESTAMP parameters.  
+     */
+    public static void dummyString (Timestamp in_param1, Timestamp[] inout_param2, Timestamp[]
out_param3) {}
+
+	
+	/**
          * Java method for procedure PMDD which tests ParameterMetaData for Java procedures
 	 * with DECIMAL parameters. 
          *

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PrepStmtMetaDataTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PrepStmtMetaDataTest.java?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PrepStmtMetaDataTest.java
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/PrepStmtMetaDataTest.java
Mon Dec  6 15:46:40 2010
@@ -329,12 +329,12 @@ public class PrepStmtMetaDataTest extend
         
         // COLUMN 16 TIMESTAMP
         assertEquals("java.sql.Timestamp", rsmd.getColumnClassName(16));
-        assertEquals(26, rsmd.getColumnDisplaySize(16));
+        assertEquals(29, rsmd.getColumnDisplaySize(16));
         assertEquals("TIMESTAMPCOL", rsmd.getColumnLabel(16));
         assertEquals(java.sql.Types.TIMESTAMP,rsmd.getColumnType(16));
         assertEquals("TIMESTAMP", rsmd.getColumnTypeName(16));
-        assertEquals(26,rsmd.getPrecision(16));
-        assertEquals(6, rsmd.getScale(16));
+        assertEquals(29,rsmd.getPrecision(16));
+        assertEquals(9, rsmd.getScale(16));
 
         // COLUMN 17 BLOB
         assertEquals("java.sql.Blob", rsmd.getColumnClassName(17));

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ResultSetMiscTest.java
Mon Dec  6 15:46:40 2010
@@ -200,7 +200,7 @@ public class ResultSetMiscTest extends B
         assertFalse(met.isCurrency(7));
         assertEquals(ResultSetMetaData.columnNullable, met.isNullable(7));
         assertFalse(met.isSigned(7));
-        assertEquals(26, met.getColumnDisplaySize(7));
+        assertEquals(29, met.getColumnDisplaySize(7));
         assertEquals("TS", met.getColumnLabel(7));
         assertEquals("TS", met.getColumnName(7));
         // beetle 5323
@@ -208,8 +208,8 @@ public class ResultSetMiscTest extends B
         assertEquals("APP", met.getSchemaName(7));
         assertEquals("", met.getCatalogName(7));
         assertEquals(java.sql.Types.TIMESTAMP, met.getColumnType(7));
-        assertEquals(26, met.getPrecision(7));
-        assertEquals(6, met.getScale(7));
+        assertEquals(29, met.getPrecision(7));
+        assertEquals(9, met.getScale(7));
         assertEquals("TIMESTAMP", met.getColumnTypeName(7));
         // DERBY-142 client incorrectly returns true. Enable on client
         // once DERBY-142 is fixed

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CoalesceTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CoalesceTest.java?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CoalesceTest.java
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/CoalesceTest.java
Mon Dec  6 15:46:40 2010
@@ -339,7 +339,7 @@ public class CoalesceTest extends BaseJD
                 "COL1(datatype : TIME, precision : 8, scale : 0) null 15:30:20 15:30:20 null
",
                 "COL1(datatype : TIME, precision : 8, scale : 0) null 15:30:20 15:30:20 15:30:20
",
                 "COL1(datatype : TIME, precision : 8, scale : 0) null 15:30:20 15:30:20 15:30:20
",
-                "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
+                "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
                 "", "",
                 "COL1(datatype : BLOB, precision : 1024, scale : 0) null null null null "
         };
@@ -525,11 +525,11 @@ public class CoalesceTest extends BaseJD
                 "COL1(datatype : TIME, precision : 8, scale : 0) null 15:30:20 15:30:20 null
",
                 "COL1(datatype : TIME, precision : 8, scale : 0) null 15:30:20 15:30:20 null
",
                 "","","","","","","","","","","","","","","","",
-                "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
-                "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
+                "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
+                "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
                 "","","","","","","","","","","","","","","","",
-                "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
-                "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
+                "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
+                "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null 2000-01-01 15:30:20.0
2000-01-01 15:30:20.0 null ",
                 "","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",
                 "COL1(datatype : BLOB, precision : 1024, scale : 0) null null null null ",
                 "COL1(datatype : BLOB, precision : 1024, scale : 0) null null null null "
@@ -681,9 +681,9 @@ public class CoalesceTest extends BaseJD
         s.executeUpdate("insert into tH values(null, null, null)");
         s.executeUpdate("insert into tH values(timestamp('1992-01-01 12:30:30'), '1992-01-01
12:30:31', '1992-01-01 12:30:32')");
 
-        String expectedValue = "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null
1992-01-01 12:30:30.0 ";
-        String expectedValue1 = "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null
1992-01-01 12:30:31.0 ";
-        String expectedValue2 = "COL1(datatype : TIMESTAMP, precision : 26, scale : 6) null
1992-01-01 12:30:32.0 ";
+        String expectedValue = "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null
1992-01-01 12:30:30.0 ";
+        String expectedValue1 = "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null
1992-01-01 12:30:31.0 ";
+        String expectedValue2 = "COL1(datatype : TIMESTAMP, precision : 29, scale : 9) null
1992-01-01 12:30:32.0 ";
 
         dumpRS(s.executeQuery("select coalesce(timestampCol,timestampCol) from tH"), expectedValue);
         dumpRS(s.executeQuery("select value(timestampCol,timestampCol) from tH"), expectedValue);

Modified: db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java?rev=1042682&r1=1042681&r2=1042682&view=diff
==============================================================================
--- db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
(original)
+++ db/derby/code/branches/10.7/java/testing/org/apache/derbyTesting/functionTests/tests/lang/TableFunctionTest.java
Mon Dec  6 15:46:40 2010
@@ -788,9 +788,9 @@ public class TableFunctionTest extends B
             FUNCTION_RESULT_COLUMN,
             JDBC_TYPE_TIMESTAMP,
             "TIMESTAMP",
-            new Integer( 26 ),     // PRECISION
+            new Integer( 29 ),     // PRECISION
             new Integer( 16 ),         // LENGTH
-            new Integer( 6 ),       // SCALE
+            new Integer( 9 ),       // SCALE
             RADIX_INTEGER,    // RADIX
             ALLOWS_NULLS,
             EMPTY_REMARKS,



Mime
View raw message