001: /*
002:
003: Derby - Class org.apache.derbyTesting.functionTests.util.SimpleProcedureTest
004:
005: Licensed to the Apache Software Foundation (ASF) under one or more
006: contributor license agreements. See the NOTICE file distributed with
007: this work for additional information regarding copyright ownership.
008: The ASF licenses this file to You under the Apache License, Version 2.0
009: (the "License"); you may not use this file except in compliance with
010: the License. You may obtain a copy of the License at
011:
012: http://www.apache.org/licenses/LICENSE-2.0
013:
014: Unless required by applicable law or agreed to in writing, software
015: distributed under the License is distributed on an "AS IS" BASIS,
016: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017: See the License for the specific language governing permissions and
018: limitations under the License.
019:
020: */
021: package org.apache.derbyTesting.functionTests.util;
022:
023: import java.sql.Date;
024: import java.sql.Time;
025: import java.sql.Timestamp;
026:
027: /**
028: * Procedures to be used with J2ME/CDC/FP and JSR169
029: */
030:
031: public class SimpleProcedureTest {
032:
033: /*
034: ** Procedures for parameter mapping testing.
035: */
036:
037: public static void pmap(short in, short[] inout, short[] out) {
038:
039: inout[0] += 6;
040: out[0] = 77;
041: }
042:
043: public static void pmap(int in, int[] inout, int[] out) {
044: inout[0] += 9;
045: out[0] = 88;
046:
047: }
048:
049: public static void pmap(long in, long[] inout, long[] out) {
050: inout[0] += 8;
051: out[0] = 99;
052: }
053:
054: public static void pmap(float in, float[] inout, float[] out) {
055: inout[0] += 9.9f;
056: out[0] = 88.8f;
057: }
058:
059: public static void pmap(double in, double[] inout, double[] out) {
060: inout[0] += 3.9;
061: out[0] = 66.8;
062: }
063:
064: public static void pmap(byte[] in, byte[][] inout, byte[][] out) {
065:
066: inout[0][2] = 0x56;
067: out[0] = new byte[4];
068: out[0][0] = (byte) 0x09;
069: out[0][1] = (byte) 0xfe;
070: out[0][2] = (byte) 0xed;
071: out[0][3] = (byte) 0x02;
072:
073: }
074:
075: public static void pmap(Date in, Date[] inout, Date[] out) {
076:
077: inout[0] = java.sql.Date.valueOf("2004-03-08");
078: out[0] = java.sql.Date.valueOf("2005-03-08");
079:
080: }
081:
082: public static void pmap(Time in, Time[] inout, Time[] out) {
083: inout[0] = java.sql.Time.valueOf("19:44:42");
084: out[0] = java.sql.Time.valueOf("20:44:42");
085: }
086:
087: public static void pmap(Timestamp in, Timestamp[] inout,
088: Timestamp[] out) {
089:
090: inout[0] = java.sql.Timestamp
091: .valueOf("2004-03-12 21:14:24.938222433");
092: out[0] = java.sql.Timestamp
093: .valueOf("2004-04-12 04:25:26.462983731");
094: }
095:
096: public static void pmap(String in, String[] inout, String[] out) {
097: inout[0] = inout[0].trim().concat("P2-PMAP");
098: out[0] = "P3-PMAP";
099: }
100:
101: }
|