db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kmars...@apache.org
Subject svn commit: r522639 - /db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
Date Mon, 26 Mar 2007 21:53:48 GMT
Author: kmarsden
Date: Mon Mar 26 14:53:46 2007
New Revision: 522639

URL: http://svn.apache.org/viewvc?view=rev&rev=522639
Log:
Put procedures for ParameterMappingTest in the test.
Old test paramterMapping.java is still being run so don't remove from 
util/ProcedureTest.java/SimpleProcedure.java  just yet.


Modified:
    db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java

Modified: db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java?view=diff&rev=522639&r1=522638&r2=522639
==============================================================================
--- db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
(original)
+++ db/derby/code/trunk/java/testing/org/apache/derbyTesting/functionTests/tests/jdbcapi/ParameterMappingTest.java
Mon Mar 26 14:53:46 2007
@@ -416,22 +416,13 @@
             }catch (SQLException seq) {
             }
             String procSQL;
-            if(HAVE_BIG_DECIMAL) {
-                procSQL = "CREATE PROCEDURE PMP.TYPE_AS(" +
+            procSQL = "CREATE PROCEDURE PMP.TYPE_AS(" +
                 "IN P1 " + SQLTypes[type] + 
                 ", INOUT P2 " + SQLTypes[type] +
                 ", OUT P3 " + SQLTypes[type] +
                 ") LANGUAGE JAVA PARAMETER STYLE JAVA NO SQL " +
-                " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.ProcedureTest.pmap'";
-            } else {
-                procSQL = "CREATE PROCEDURE PMP.TYPE_AS(" +
-                "IN P1 " + SQLTypes[type] + 
-                ", INOUT P2 " + SQLTypes[type] +
-                ", OUT P3 " + SQLTypes[type] +
-                ") LANGUAGE JAVA PARAMETER STYLE JAVA NO SQL " +
-                " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.util.SimpleProcedureTest.pmap'";
-            }
-            
+                " EXTERNAL NAME 'org.apache.derbyTesting.functionTests.tests.jdbcapi.ParameterMappingTest.pmap'";
+                        
             try {
                 if (!HAVE_BIG_DECIMAL && SQLTypes[type].equals("DECIMAL(10,5)"))
                     continue;
@@ -3608,5 +3599,71 @@
         else
             return  new TestSuite("ParameterMapping");
     }
-    
+        /*
+        ** Procedures for parameter mapping testing.
+        */
+
+        public static void pmap(short in, short[] inout, short[] out) {
+
+                inout[0] += 6;
+                out[0] = 77;
+        }
+        public static void pmap(int in, int[] inout, int[] out) {
+                inout[0] += 9;
+                out[0] = 88;
+
+        }
+        public static void pmap(long in, long[] inout, long[] out) {
+                inout[0] += 8;
+                out[0] = 99;
+        }
+        public static void pmap(float in, float[] inout, float[] out) {
+                inout[0] += 9.9f;
+                out[0] = 88.8f;
+        }
+        public static void pmap(double in, double[] inout, double[] out) {
+                inout[0] += 3.9;
+                out[0] = 66.8;
+        }
+        public static void pmap(byte[] in, byte[][] inout, byte[][] out) {
+
+                inout[0][2] = 0x56;
+                out[0] = new byte[4];
+                out[0][0] = (byte) 0x09;
+                out[0][1] = (byte) 0xfe;
+                out[0][2] = (byte) 0xed;
+                out[0][3] = (byte) 0x02;
+
+        }
+        public static void pmap(Date in, Date[] inout, Date[] out) {
+
+                inout[0] = java.sql.Date.valueOf("2004-03-08");
+                out[0] = java.sql.Date.valueOf("2005-03-08");
+
+        }
+        public static void pmap(Time in, Time[] inout, Time[] out) {
+                inout[0] = java.sql.Time.valueOf("19:44:42");
+                out[0] = java.sql.Time.valueOf("20:44:42");
+        }
+        public static void pmap(Timestamp in, Timestamp[] inout, Timestamp[] out) {
+
+                inout[0] = java.sql.Timestamp.valueOf("2004-03-12 21:14:24.938222433");
+                out[0] = java.sql.Timestamp.valueOf("2004-04-12 04:25:26.462983731");
+        }
+        public static void pmap(String in, String[] inout, String[] out) {
+                inout[0] = inout[0].trim().concat("P2-PMAP");
+                out[0] = "P3-PMAP";
+        }
+
+        /*
+        ** Procedure which uses BigDecimal - for parameter mapping testing.
+        */
+
+        public static void pmap(BigDecimal in, BigDecimal[] inout, BigDecimal[] out) {
+                inout[0] = inout[0].add(new BigDecimal(2.3));
+                out[0] = new BigDecimal(84.1);
+        }
+
 }
+
+



Mime
View raw message