KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > derbyTesting > functionTests > util > SimpleProcedureTest


1 /*
2
3 Derby - Class org.apache.derbyTesting.functionTests.util.SimpleProcedureTest
4
5 Licensed to the Apache Software Foundation (ASF) under one or more
6 contributor license agreements. See the NOTICE file distributed with
7 this work for additional information regarding copyright ownership.
8 The ASF licenses this file to You under the Apache License, Version 2.0
9 (the "License"); you may not use this file except in compliance with
10 the License. You may obtain a copy of the License at
11
12    http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19
20 */

21 package org.apache.derbyTesting.functionTests.util;
22
23 import java.sql.Date JavaDoc;
24 import java.sql.Time JavaDoc;
25 import java.sql.Timestamp JavaDoc;
26
27 /**
28  * Procedures to be used with J2ME/CDC/FP and JSR169
29  */

30
31 public class SimpleProcedureTest {
32
33     /*
34     ** Procedures for parameter mapping testing.
35     */

36
37     public static void pmap(short in, short[] inout, short[] out) {
38
39         inout[0] += 6;
40         out[0] = 77;
41     }
42     public static void pmap(int in, int[] inout, int[] out) {
43         inout[0] += 9;
44         out[0] = 88;
45
46     }
47     public static void pmap(long in, long[] inout, long[] out) {
48         inout[0] += 8;
49         out[0] = 99;
50     }
51     public static void pmap(float in, float[] inout, float[] out) {
52         inout[0] += 9.9f;
53         out[0] = 88.8f;
54     }
55     public static void pmap(double in, double[] inout, double[] out) {
56         inout[0] += 3.9;
57         out[0] = 66.8;
58     }
59     public static void pmap(byte[] in, byte[][] inout, byte[][] out) {
60
61         inout[0][2] = 0x56;
62         out[0] = new byte[4];
63         out[0][0] = (byte) 0x09;
64         out[0][1] = (byte) 0xfe;
65         out[0][2] = (byte) 0xed;
66         out[0][3] = (byte) 0x02;
67
68     }
69     public static void pmap(Date JavaDoc in, Date JavaDoc[] inout, Date JavaDoc[] out) {
70
71         inout[0] = java.sql.Date.valueOf("2004-03-08");
72         out[0] = java.sql.Date.valueOf("2005-03-08");
73
74     }
75     public static void pmap(Time JavaDoc in, Time JavaDoc[] inout, Time JavaDoc[] out) {
76         inout[0] = java.sql.Time.valueOf("19:44:42");
77         out[0] = java.sql.Time.valueOf("20:44:42");
78     }
79     public static void pmap(Timestamp JavaDoc in, Timestamp JavaDoc[] inout, Timestamp JavaDoc[] out) {
80
81         inout[0] = java.sql.Timestamp.valueOf("2004-03-12 21:14:24.938222433");
82         out[0] = java.sql.Timestamp.valueOf("2004-04-12 04:25:26.462983731");
83     }
84     public static void pmap(String JavaDoc in, String JavaDoc[] inout, String JavaDoc[] out) {
85         inout[0] = inout[0].trim().concat("P2-PMAP");
86         out[0] = "P3-PMAP";
87     }
88     
89 }
90
Popular Tags