|
1 | 1 | packagepostgresql; |
2 | 2 |
|
3 | | -importjava.math.*; |
4 | 3 | importjava.sql.*; |
| 4 | +importjava.math.*; |
5 | 5 |
|
6 | 6 | /** |
7 | | - * @version 1.0 15-APR-1997 |
8 | | - * @author <A HREF="mailto:adrian@hottub.org">Adrian Hall</A> |
9 | | - * |
10 | | - * CallableStatement is used to execute SQL stored procedures. |
11 | | - * |
12 | | - * JDBC provides a stored procedure SQL escape that allows stored procedures |
13 | | - * to be called in a standard way for all RDBMS's. This escape syntax has |
14 | | - * one form that includes a result parameter and one that does not. If used, |
15 | | - * the result parameter must be generated as an OUT parameter. The other |
16 | | - * parameters may be used for input, output or both. Parameters are refered |
17 | | - * to sequentially, by number. The first parameter is 1. |
18 | | - * |
19 | | - * <PRE> |
20 | | - *{?= call <procedure-name>[<arg1>,<arg2>, ...]} |
21 | | - *{call <procedure-name>[<arg1>,<arg2>, ...]} |
22 | | - * </PRE> |
23 | | - * |
24 | | - * IN parameters are set using the set methods inherited from |
25 | | - * PreparedStatement. The type of all OUT parameters must be registered |
26 | | - * prior to executing the stored procedure; their values are retrieved |
27 | | - * after execution via the get methods provided here. |
28 | | - * |
29 | | - * A CallableStatement may return a ResultSet or multiple ResultSets. Multiple |
30 | | - * ResultSets are handled using operations inherited from Statement. |
31 | | - * |
32 | | - * For maximum portability, a call's ResultSets and update counts should be |
33 | | - * processed prior to getting the values of output parameters. |
34 | | - * |
35 | | - * @see java.sql.Connection#prepareCall |
36 | | - * @see java.sql.ResultSet |
37 | | - * @see java.sql.CallableStatement |
| 7 | + * JDBC Interface to Postgres95 functions |
38 | 8 | */ |
39 | | -publicclassCallableStatementimplementsjava.sql.CallableStatement |
40 | | -{ |
41 | | -publicvoidregisterOutParameter (intparamterIndex,intsqlType)throwsSQLException |
42 | | -{ |
43 | | -// XXX-Not Implemented |
44 | | -} |
45 | | - |
46 | | -publicvoidregisterOutParameter (intparameterIndex,intsqlType,intscale)throwsSQLException |
47 | | -{ |
48 | | -// XXX-Not Implemented |
49 | | -} |
50 | | - |
51 | | -publicbooleanwasNull ()throwsSQLException |
52 | | -{ |
53 | | -// XXX-Not Implemented |
54 | | -} |
55 | | - |
56 | | -publicStringgetString (intparameterIndex)throwsSQLException |
57 | | -{ |
58 | | -// XXX-Not Implemented |
59 | | -} |
60 | | - |
61 | | -publicbooleangetBoolean (intparameterIndex)throwsSQLException |
62 | | -{ |
63 | | -// XXX-Not Implemented |
64 | | -} |
65 | | - |
66 | | -publicbytegetByte (intparameterIndex)throwsSQLException |
67 | | -{ |
68 | | -// XXX-Not Implemented |
69 | | -} |
70 | | - |
71 | | -publicshortgetShort (intparameterIndex)throwsSQLException |
72 | | -{ |
73 | | -// XXX-Not Implemented |
74 | | -} |
75 | | - |
76 | | -publicintgetInt (intparameterIndex)throwsSQLException |
77 | | -{ |
78 | | -// XXX-Not Implemented |
79 | | -} |
80 | 9 |
|
81 | | -publiclonggetLong (intparameterIndex)throwsSQLException |
82 | | -{ |
83 | | -// XXX-Not Implemented |
84 | | -} |
85 | | - |
86 | | -publicfloatgetFloat (intparameterIndex)throwsSQLException |
87 | | -{ |
88 | | -// XXX-Not Implemented |
89 | | -} |
90 | | - |
91 | | -publicdoublegetDouble (intparameterIndex)throwsSQLException |
92 | | -{ |
93 | | -// XXX-Not Implemented |
94 | | -} |
95 | | - |
96 | | -publicBigDecimalgetBigDecimal (intparameterIndex,intscale)throwsSQLException |
97 | | -{ |
98 | | -// XXX-Not Implemented |
99 | | -} |
100 | | - |
101 | | -publicbyte[]getBytes (intparameterIndex)throwsSQLException |
102 | | -{ |
103 | | -// XXX-Not Implemented |
104 | | -} |
105 | | - |
106 | | -publicDategetDate (intparameterIndex)throwsSQLException |
107 | | -{ |
108 | | -// XXX-Not Implemented |
109 | | -} |
110 | | - |
111 | | -publicTimegetTime (intparameterIndex)throwsSQLException |
112 | | -{ |
113 | | -// XXX-Not Implemented |
114 | | -} |
115 | | - |
116 | | -publicTimestampgetTimestamp (intparameterIndex)throwsSQLException |
117 | | -{ |
118 | | -// XXX-Not Implemented |
119 | | -} |
120 | | - |
121 | | -publicObjectgetObject (intparameterIndex)throwsSQLException |
122 | | -{ |
123 | | -// XXX-Not Implemented |
124 | | -} |
| 10 | +// Copy methods from the Result set object here. |
125 | 11 |
|
| 12 | +publicclassCallableStatementextendsPreparedStatementimplementsjava.sql.CallableStatement |
| 13 | +{ |
| 14 | +CallableStatement(Connectionc,Stringq)throwsSQLException |
| 15 | + { |
| 16 | +super(c,q); |
| 17 | + } |
| 18 | + |
| 19 | +// Before executing a stored procedure call you must explicitly |
| 20 | +// call registerOutParameter to register the java.sql.Type of each |
| 21 | +// out parameter. |
| 22 | +publicvoidregisterOutParameter(intparameterIndex,intsqlType)throwsSQLException { |
| 23 | + } |
| 24 | + |
| 25 | +// You must also specify the scale for numeric/decimal types: |
| 26 | +publicvoidregisterOutParameter(intparameterIndex,intsqlType, |
| 27 | +intscale)throwsSQLException |
| 28 | + { |
| 29 | + } |
| 30 | + |
| 31 | +publicbooleanisNull(intparameterIndex)throwsSQLException { |
| 32 | +returntrue; |
| 33 | + } |
| 34 | + |
| 35 | +// New API (JPM) |
| 36 | +publicbooleanwasNull()throwsSQLException { |
| 37 | +// check to see if the last access threw an exception |
| 38 | +returnfalse;// fake it for now |
| 39 | + } |
| 40 | + |
| 41 | +// Methods for retrieving OUT parameters from this statement. |
| 42 | +publicStringgetChar(intparameterIndex)throwsSQLException { |
| 43 | +returnnull; |
| 44 | + } |
| 45 | + |
| 46 | +// New API (JPM) |
| 47 | +publicStringgetString(intparameterIndex)throwsSQLException { |
| 48 | +returnnull; |
| 49 | + } |
| 50 | +//public String getVarChar(int parameterIndex) throws SQLException { |
| 51 | +// return null; |
| 52 | +//} |
| 53 | + |
| 54 | +publicStringgetLongVarChar(intparameterIndex)throwsSQLException { |
| 55 | +returnnull; |
| 56 | + } |
| 57 | + |
| 58 | +// New API (JPM) (getBit) |
| 59 | +publicbooleangetBoolean(intparameterIndex)throwsSQLException { |
| 60 | +returnfalse; |
| 61 | + } |
| 62 | + |
| 63 | +// New API (JPM) (getTinyInt) |
| 64 | +publicbytegetByte(intparameterIndex)throwsSQLException { |
| 65 | +return0; |
| 66 | + } |
| 67 | + |
| 68 | +// New API (JPM) (getSmallInt) |
| 69 | +publicshortgetShort(intparameterIndex)throwsSQLException { |
| 70 | +return0; |
| 71 | + } |
| 72 | + |
| 73 | +// New API (JPM) (getInteger) |
| 74 | +publicintgetInt(intparameterIndex)throwsSQLException { |
| 75 | +return0; |
| 76 | + } |
| 77 | + |
| 78 | +// New API (JPM) (getBigInt) |
| 79 | +publiclonggetLong(intparameterIndex)throwsSQLException { |
| 80 | +return0; |
| 81 | + } |
| 82 | + |
| 83 | +publicfloatgetFloat(intparameterIndex)throwsSQLException { |
| 84 | +return (float)0.0; |
| 85 | + } |
| 86 | + |
| 87 | +publicdoublegetDouble(intparameterIndex)throwsSQLException { |
| 88 | +return0.0; |
| 89 | + } |
| 90 | + |
| 91 | +publicBigDecimalgetBigDecimal(intparameterIndex,intscale) |
| 92 | +throwsSQLException { |
| 93 | +returnnull; |
| 94 | + } |
| 95 | + |
| 96 | +// New API (JPM) (getBinary) |
| 97 | +publicbyte[]getBytes(intparameterIndex)throwsSQLException { |
| 98 | +returnnull; |
| 99 | + } |
| 100 | + |
| 101 | +// New API (JPM) (getLongVarBinary) |
| 102 | +publicbyte[]getBinaryStream(intparameterIndex)throwsSQLException { |
| 103 | +returnnull; |
| 104 | + } |
| 105 | + |
| 106 | +publicjava.sql.DategetDate(intparameterIndex)throwsSQLException { |
| 107 | +returnnull; |
| 108 | + } |
| 109 | +publicjava.sql.TimegetTime(intparameterIndex)throwsSQLException { |
| 110 | +returnnull; |
| 111 | + } |
| 112 | +publicjava.sql.TimestampgetTimestamp(intparameterIndex) |
| 113 | +throwsSQLException { |
| 114 | +returnnull; |
| 115 | + } |
| 116 | + |
| 117 | +//---------------------------------------------------------------------- |
| 118 | +// Advanced features: |
| 119 | + |
| 120 | +// You can obtain a ParameterMetaData object to get information |
| 121 | +// about the parameters to this CallableStatement. |
| 122 | +publicDatabaseMetaDatagetMetaData() { |
| 123 | +returnnull; |
| 124 | + } |
| 125 | + |
| 126 | +// getObject returns a Java object for the parameter. |
| 127 | +// See the JDBC spec's "Dynamic Programming" chapter for details. |
| 128 | +publicObjectgetObject(intparameterIndex) |
| 129 | +throwsSQLException { |
| 130 | +returnnull; |
| 131 | + } |
126 | 132 | } |
| 133 | + |