001    package org.rakeshv.dbutils;
002    
003    import java.sql.Array;
004    import java.sql.Blob;
005    import java.sql.CallableStatement;
006    import java.sql.Clob;
007    import java.sql.Connection;
008    import java.sql.Date;
009    import java.sql.Ref;
010    import java.sql.SQLException;
011    import java.sql.Time;
012    import java.sql.Timestamp;
013    
014    import java.math.BigDecimal;
015    import java.util.Calendar;
016    
017    import org.rakeshv.Statistics;
018    
019    /**
020     * A decorator around a <code>CallableStatement</code> to enable caching
021     * and reuse of <code>CallableStatement</code> objects.  These work
022     * only if the underlying <code>Connection</code> is kept open, as is
023     * the case with connection pools or when using the {@link
024     * ConnectionDecorator}.
025     *
026     * <p>Copyright 2005 Rakesh Vidyadharan</p>
027     * @author Rakesh Vidyadharan 2005-11-20
028     * @version $Id: ConnectionFactory.java,v 1.2 2005/10/29 22:27:38 rakesh Exp $
029     */
030    public class CallableStatementDecorator 
031        extends PreparedStatementDecorator implements CallableStatement
032    {    
033      /**
034       * The <code>CallableStatement</code> that this object decorates.
035       */
036      private CallableStatement statement;
037    
038      /**
039       * Default constructor.  Cannot be instantiated.
040       */
041      protected CallableStatementDecorator()
042      {
043        statistics = new Statistics();
044      }
045    
046      /**
047       * Create a new instance of the class using the specified 
048       * CallableStatement  object that will be decorated.
049       *
050       * @param statement The CallableStatement that is to be decorated.
051       */
052      public CallableStatementDecorator( CallableStatement statement )
053      {
054        this();
055        this.statement = statement;
056      }
057    
058      /**
059       * Registers the OUT parameter in ordinal position 
060       * <code>parameterIndex</code> to the JDBC type 
061       * <code>sqlType</code>.  All OUT parameters must be registered
062       * before a stored procedure is executed.
063       * <p>
064       * The JDBC type specified by <code>sqlType</code> for an OUT
065       * parameter determines the Java type that must be used
066       * in the <code>get</code> method to read the value of that parameter.
067       * <p>
068       * If the JDBC type expected to be returned to this output parameter
069       * is specific to this particular database, <code>sqlType</code>
070       * should be <code>java.sql.Types.OTHER</code>.  The method 
071       * {@link #getObject} retrieves the value.
072       *
073       * @param parameterIndex the first parameter is 1, the second is 2, 
074       *        and so on
075       * @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
076       *        If the parameter is of JDBC type <code>NUMERIC</code>
077       *        or <code>DECIMAL</code>, the version of
078       *        <code>registerOutParameter</code> that accepts a scale value
079       *        should be used.
080       *
081       * @exception SQLException if a database access error occurs
082       */
083      public void registerOutParameter(int parameterIndex, int sqlType) 
084        throws SQLException
085      {
086        statement.registerOutParameter( parameterIndex, sqlType );
087      }
088    
089      /**
090       * Registers the parameter in ordinal position
091       * <code>parameterIndex</code> to be of JDBC type
092       * <code>sqlType</code>.  This method must be called
093       * before a stored procedure is executed.
094       * <p>
095       * The JDBC type specified by <code>sqlType</code> for an OUT
096       * parameter determines the Java type that must be used
097       * in the <code>get</code> method to read the value of that parameter.
098       * <p>
099       * This version of <code>registerOutParameter</code> should be
100       * used when the parameter is of JDBC type <code>NUMERIC</code>
101       * or <code>DECIMAL</code>.
102       *
103       * @param parameterIndex the first parameter is 1, the second is 2,
104       * and so on
105       * @param sqlType the SQL type code defined by <code>java.sql.Types</code>.
106       * @param scale the desired number of digits to the right of the
107       * decimal point.  It must be greater than or equal to zero.
108       * @exception SQLException if a database access error occurs
109       */
110      public void registerOutParameter(int parameterIndex, int sqlType, 
111          int scale) throws SQLException
112      {
113        statement.registerOutParameter( parameterIndex, sqlType, scale );
114      }
115    
116      /**
117       * Retrieves whether the last OUT parameter read had the value of
118       * SQL <code>NULL</code>.  Note that this method should be called only after
119       * calling a getter method; otherwise, there is no value to use in 
120       * determining whether it is <code>null</code> or not.
121       *
122       * @return <code>true</code> if the last parameter read was SQL
123       * <code>NULL</code>; <code>false</code> otherwise 
124       * @exception SQLException if a database access error occurs
125       */
126      public boolean wasNull() throws SQLException
127      {
128        return statement.wasNull();
129      }
130    
131      /**
132       * Retrieves the value of the designated JDBC <code>CHAR</code>, 
133       * <code>VARCHAR</code>, or <code>LONGVARCHAR</code> parameter as a 
134       * <code>String</code> in the Java programming language.
135       * <p>
136       * For the fixed-length type JDBC <code>CHAR</code>,
137       * the <code>String</code> object
138       * returned has exactly the same value the JDBC
139       * <code>CHAR</code> value had in the
140       * database, including any padding added by the database.
141       *
142       * @param parameterIndex the first parameter is 1, the second is 2, 
143       * and so on
144       * @return the parameter value. If the value is SQL <code>NULL</code>, 
145       *         the result 
146       *         is <code>null</code>.
147       * @exception SQLException if a database access error occurs
148       * @see #setString
149       */
150      public String getString(int parameterIndex) throws SQLException
151      {
152        return statement.getString( parameterIndex );
153      }
154    
155      /**
156       * Retrieves the value of the designated JDBC <code>BIT</code> parameter as a 
157       * <code>boolean</code> in the Java programming language.
158       *
159       * @param parameterIndex the first parameter is 1, the second is 2, 
160       *        and so on
161       * @return the parameter value.  If the value is SQL <code>NULL</code>, 
162       *         the result is <code>false</code>.
163       * @exception SQLException if a database access error occurs
164       * @see #setBoolean
165       */
166      public boolean getBoolean(int parameterIndex) throws SQLException
167      {
168        return statement.getBoolean( parameterIndex );
169      }
170    
171      /**
172       * Retrieves the value of the designated JDBC <code>TINYINT</code> parameter 
173       * as a <code>byte</code> in the Java programming language.
174       *
175       * @param parameterIndex the first parameter is 1, the second is 2, 
176       * and so on
177       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
178       * is <code>0</code>.
179       * @exception SQLException if a database access error occurs
180       * @see #setByte
181       */
182      public byte getByte(int parameterIndex) throws SQLException
183      {
184        return statement.getByte( parameterIndex );
185      }
186    
187      /**
188       * Retrieves the value of the designated JDBC <code>SMALLINT</code> parameter 
189       * as a <code>short</code> in the Java programming language.
190       *
191       * @param parameterIndex the first parameter is 1, the second is 2, 
192       * and so on
193       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
194       * is <code>0</code>.
195       * @exception SQLException if a database access error occurs
196       * @see #setShort
197       */
198      public short getShort(int parameterIndex) throws SQLException
199      {
200        return statement.getShort( parameterIndex );
201      }
202    
203      /**
204       * Retrieves the value of the designated JDBC <code>INTEGER</code> parameter 
205       * as an <code>int</code> in the Java programming language.
206       *
207       * @param parameterIndex the first parameter is 1, the second is 2, 
208       * and so on
209       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
210       * is <code>0</code>.
211       * @exception SQLException if a database access error occurs
212       * @see #setInt
213       */
214      public int getInt(int parameterIndex) throws SQLException
215      {
216        return statement.getInt( parameterIndex );
217      }
218    
219      /**
220       * Retrieves the value of the designated JDBC <code>BIGINT</code> parameter 
221       * as a <code>long</code> in the Java programming language.
222       *
223       * @param parameterIndex the first parameter is 1, the second is 2, 
224       * and so on
225       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
226       * is <code>0</code>.
227       * @exception SQLException if a database access error occurs
228       * @see #setLong
229       */
230      public long getLong(int parameterIndex) throws SQLException
231      {
232        return statement.getLong( parameterIndex );
233      }
234    
235      /**
236       * Retrieves the value of the designated JDBC <code>FLOAT</code> parameter 
237       * as a <code>float</code> in the Java programming language.
238       *
239       * @param parameterIndex the first parameter is 1, the second is 2, 
240       *        and so on
241       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
242       *         is <code>0</code>.
243       * @exception SQLException if a database access error occurs
244       * @see #setFloat
245       */
246      public float getFloat(int parameterIndex) throws SQLException
247      {
248        return statement.getFloat( parameterIndex );
249      }
250    
251      /**
252       * Retrieves the value of the designated JDBC <code>DOUBLE</code> parameter as a <code>double</code>
253       * in the Java programming language.
254       * @param parameterIndex the first parameter is 1, the second is 2,
255       *        and so on
256       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
257       *         is <code>0</code>.
258       * @exception SQLException if a database access error occurs
259       * @see #setDouble
260       */
261      public double getDouble(int parameterIndex) throws SQLException
262      {
263        return statement.getDouble( parameterIndex );
264      }
265    
266      /** 
267       * Retrieves the value of the designated JDBC <code>NUMERIC</code> parameter as a 
268       * <code>java.math.BigDecimal</code> object with <i>scale</i> digits to
269       * the right of the decimal point.
270       * @param parameterIndex the first parameter is 1, the second is 2, 
271       *        and so on
272       * @param scale the number of digits to the right of the decimal point 
273       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
274       *         is <code>null</code>. 
275       * @exception SQLException if a database access error occurs
276       * @deprecated use <code>getBigDecimal(int parameterIndex)</code>
277       *             or <code>getBigDecimal(String parameterName)</code>
278       * @see #setBigDecimal
279       */
280      @Deprecated
281      public BigDecimal getBigDecimal(int parameterIndex, int scale) 
282        throws SQLException
283      {
284        return statement.getBigDecimal( parameterIndex, scale );
285      }
286    
287      /**
288       * Retrieves the value of the designated JDBC <code>BINARY</code> or 
289       * <code>VARBINARY</code> parameter as an array of <code>byte</code> 
290       * values in the Java programming language.
291       * @param parameterIndex the first parameter is 1, the second is 2, 
292       *        and so on
293       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
294       *         is <code>null</code>.
295       * @exception SQLException if a database access error occurs
296       * @see #setBytes
297       */
298      public byte[] getBytes(int parameterIndex) throws SQLException
299      {
300        return statement.getBytes( parameterIndex );
301      }
302    
303      /**
304       * Retrieves the value of the designated JDBC <code>DATE</code> parameter as a 
305       * <code>java.sql.Date</code> object.
306       * @param parameterIndex the first parameter is 1, the second is 2, 
307       *        and so on
308       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
309       *         is <code>null</code>.
310       * @exception SQLException if a database access error occurs
311       * @see #setDate
312       */
313      public Date getDate(int parameterIndex) throws SQLException
314      {
315        return statement.getDate( parameterIndex );
316      }
317    
318      /**
319       * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a 
320       * <code>java.sql.Time</code> object.
321       *
322       * @param parameterIndex the first parameter is 1, the second is 2, 
323       *        and so on
324       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
325       *         is <code>null</code>.
326       * @exception SQLException if a database access error occurs
327       * @see #setTime
328       */
329      public Time getTime(int parameterIndex) throws SQLException
330      {
331        return statement.getTime( parameterIndex );
332      }
333    
334      /**
335       * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a 
336       * <code>java.sql.Timestamp</code> object.
337       *
338       * @param parameterIndex the first parameter is 1, the second is 2, 
339       *        and so on
340       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
341       *         is <code>null</code>.
342       * @exception SQLException if a database access error occurs
343       * @see #setTimestamp
344       */
345      public Timestamp getTimestamp(int parameterIndex) throws SQLException
346      {
347        return statement.getTimestamp( parameterIndex );
348      }
349    
350      //----------------------------------------------------------------------
351      // Advanced features:
352    
353    
354      /**
355       * Retrieves the value of the designated parameter as an <code>Object</code> 
356       * in the Java programming language. If the value is an SQL <code>NULL</code>,
357       * the driver returns a Java <code>null</code>.
358       * <p>
359       * This method returns a Java object whose type corresponds to the JDBC
360       * type that was registered for this parameter using the method
361       * <code>registerOutParameter</code>.  By registering the target JDBC
362       * type as <code>java.sql.Types.OTHER</code>, this method can be used
363       * to read database-specific abstract data types.
364       *
365       * @param parameterIndex the first parameter is 1, the second is 2, 
366       *        and so on
367       * @return A <code>java.lang.Object</code> holding the OUT parameter value
368       * @exception SQLException if a database access error occurs
369       * @see #setObject
370       */
371      public Object getObject(int parameterIndex) throws SQLException
372      {
373        return statement.getObject( parameterIndex );
374      }
375    
376    
377      //--------------------------JDBC 2.0-----------------------------
378    
379      /**
380       * Retrieves the value of the designated JDBC <code>NUMERIC</code> parameter as a 
381       * <code>java.math.BigDecimal</code> object with as many digits to the
382       * right of the decimal point as the value contains.
383       * @param parameterIndex the first parameter is 1, the second is 2,
384       * and so on
385       * @return the parameter value in full precision.  If the value is 
386       * SQL <code>NULL</code>, the result is <code>null</code>. 
387       * @exception SQLException if a database access error occurs
388       * @see #setBigDecimal
389       * @since 1.2
390       */
391      public BigDecimal getBigDecimal(int parameterIndex) 
392        throws SQLException
393      {
394        return statement.getBigDecimal( parameterIndex );
395      }
396    
397      /**
398       * Returns an object representing the value of OUT parameter 
399       * <code>i</code> and uses <code>map</code> for the custom
400       * mapping of the parameter value.
401       * <p>
402       * This method returns a Java object whose type corresponds to the
403       * JDBC type that was registered for this parameter using the method
404       * <code>registerOutParameter</code>.  By registering the target
405       * JDBC type as <code>java.sql.Types.OTHER</code>, this method can
406       * be used to read database-specific abstract data types.  
407       * @param i the first parameter is 1, the second is 2, and so on
408       * @param map the mapping from SQL type names to Java classes
409       * @return a <code>java.lang.Object</code> holding the OUT parameter value
410       * @exception SQLException if a database access error occurs
411       * @see #setObject
412       * @since 1.2
413       */
414      public Object getObject(int i, java.util.Map<String,Class<?>> map) 
415        throws SQLException
416      {
417        return statement.getObject( i, map );
418      }
419    
420      /**
421       * Retrieves the value of the designated JDBC <code>REF(&lt;structured-type&gt;)</code>
422       * parameter as a {@link Ref} object in the Java programming language.
423       * @param i the first parameter is 1, the second is 2, 
424       * and so on
425       * @return the parameter value as a <code>Ref</code> object in the
426       * Java programming language.  If the value was SQL <code>NULL</code>, the value
427       * <code>null</code> is returned.
428       * @exception SQLException if a database access error occurs
429       * @since 1.2
430       */
431      public Ref getRef (int i) throws SQLException
432      {
433        return statement.getRef( i );
434      }
435    
436      /**
437       * Retrieves the value of the designated JDBC <code>BLOB</code> parameter as a
438       * {@link Blob} object in the Java programming language.
439       * @param i the first parameter is 1, the second is 2, and so on
440       * @return the parameter value as a <code>Blob</code> object in the
441       * Java programming language.  If the value was SQL <code>NULL</code>, the value
442       * <code>null</code> is returned.
443       * @exception SQLException if a database access error occurs
444       * @since 1.2
445       */
446      public Blob getBlob (int i) throws SQLException
447      {
448        return statement.getBlob( i );
449      }
450    
451      /**
452       * Retrieves the value of the designated JDBC <code>CLOB</code> parameter as a
453       * <code>Clob</code> object in the Java programming language.
454       * @param i the first parameter is 1, the second is 2, and
455       * so on
456       * @return the parameter value as a <code>Clob</code> object in the
457       * Java programming language.  If the value was SQL <code>NULL</code>, the
458       * value <code>null</code> is returned.
459       * @exception SQLException if a database access error occurs
460       * @since 1.2
461       */
462      public Clob getClob (int i) throws SQLException
463      {
464        return statement.getClob( i );
465      }
466    
467      /**
468       *
469       * Retrieves the value of the designated JDBC <code>ARRAY</code> parameter as an
470       * {@link Array} object in the Java programming language.
471       * @param i the first parameter is 1, the second is 2, and 
472       * so on
473       * @return the parameter value as an <code>Array</code> object in
474       * the Java programming language.  If the value was SQL <code>NULL</code>, the
475       * value <code>null</code> is returned.
476       * @exception SQLException if a database access error occurs
477       * @since 1.2
478       */
479      public Array getArray (int i) throws SQLException
480      {
481        return statement.getArray( i );
482      }
483    
484      /**
485       * Retrieves the value of the designated JDBC <code>DATE</code> parameter as a 
486       * <code>java.sql.Date</code> object, using
487       * the given <code>Calendar</code> object
488       * to construct the date.
489       * With a <code>Calendar</code> object, the driver
490       * can calculate the date taking into account a custom timezone and locale.
491       * If no <code>Calendar</code> object is specified, the driver uses the
492       * default timezone and locale.
493       *
494       * @param parameterIndex the first parameter is 1, the second is 2, 
495       * and so on
496       * @param cal the <code>Calendar</code> object the driver will use
497       *            to construct the date
498       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
499       *         is <code>null</code>.
500       * @exception SQLException if a database access error occurs
501       * @see #setDate
502       * @since 1.2
503       */
504      public Date getDate(int parameterIndex, Calendar cal) 
505        throws SQLException
506      {
507        return statement.getDate( parameterIndex, cal );
508      }
509    
510      /**
511       * Retrieves the value of the designated JDBC <code>TIME</code> parameter as a 
512       * <code>java.sql.Time</code> object, using
513       * the given <code>Calendar</code> object
514       * to construct the time.
515       * With a <code>Calendar</code> object, the driver
516       * can calculate the time taking into account a custom timezone and locale.
517       * If no <code>Calendar</code> object is specified, the driver uses the
518       * default timezone and locale.
519       *
520       * @param parameterIndex the first parameter is 1, the second is 2,
521       * and so on
522       * @param cal the <code>Calendar</code> object the driver will use
523       *            to construct the time
524       * @return the parameter value; if the value is SQL <code>NULL</code>, the result 
525       *         is <code>null</code>.
526       * @exception SQLException if a database access error occurs
527       * @see #setTime
528       * @since 1.2
529       */
530      public Time getTime(int parameterIndex, Calendar cal) 
531        throws SQLException
532      {
533        return statement.getTime( parameterIndex, cal );
534      }
535    
536      /**
537       * Retrieves the value of the designated JDBC <code>TIMESTAMP</code> parameter as a
538       * <code>java.sql.Timestamp</code> object, using
539       * the given <code>Calendar</code> object to construct
540       * the <code>Timestamp</code> object.
541       * With a <code>Calendar</code> object, the driver
542       * can calculate the timestamp taking into account a custom timezone and locale.
543       * If no <code>Calendar</code> object is specified, the driver uses the
544       * default timezone and locale.
545       *
546       *
547       * @param parameterIndex the first parameter is 1, the second is 2, 
548       * and so on
549       * @param cal the <code>Calendar</code> object the driver will use
550       *            to construct the timestamp
551       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
552       *         is <code>null</code>.
553       * @exception SQLException if a database access error occurs
554       * @see #setTimestamp
555       * @since 1.2
556       */
557      public Timestamp getTimestamp(int parameterIndex, Calendar cal) 
558        throws SQLException
559      {
560        return statement.getTimestamp( parameterIndex, cal );
561      }
562    
563    
564      /**
565       * Registers the designated output parameter.  This version of 
566       * the method <code>registerOutParameter</code>
567       * should be used for a user-defined or <code>REF</code> output parameter.  Examples
568       * of user-defined types include: <code>STRUCT</code>, <code>DISTINCT</code>,
569       * <code>JAVA_OBJECT</code>, and named array types.
570       *
571       * Before executing a stored procedure call, you must explicitly
572       * call <code>registerOutParameter</code> to register the type from
573       * <code>java.sql.Types</code> for each
574       * OUT parameter.  For a user-defined parameter, the fully-qualified SQL
575       * type name of the parameter should also be given, while a <code>REF</code>
576       * parameter requires that the fully-qualified type name of the
577       * referenced type be given.  A JDBC driver that does not need the
578       * type code and type name information may ignore it.   To be portable,
579       * however, applications should always provide these values for
580       * user-defined and <code>REF</code> parameters.
581       *
582       * Although it is intended for user-defined and <code>REF</code> parameters,
583       * this method may be used to register a parameter of any JDBC type.
584       * If the parameter does not have a user-defined or <code>REF</code> type, the
585       * <i>typeName</i> parameter is ignored.
586       *
587       * <P><B>Note:</B> When reading the value of an out parameter, you
588       * must use the getter method whose Java type corresponds to the
589       * parameter's registered SQL type.
590       *
591       * @param paramIndex the first parameter is 1, the second is 2,...
592       * @param sqlType a value from {@link java.sql.Types}
593       * @param typeName the fully-qualified name of an SQL structured type
594       * @exception SQLException if a database access error occurs
595       * @since 1.2
596       */
597      public void registerOutParameter (int paramIndex, int sqlType, 
598          String typeName) throws SQLException
599      {
600        statement.registerOutParameter( paramIndex, sqlType, typeName );
601      }
602    
603    //--------------------------JDBC 3.0-----------------------------
604    
605      /**
606       * Registers the OUT parameter named 
607       * <code>parameterName</code> to the JDBC type 
608       * <code>sqlType</code>.  All OUT parameters must be registered
609       * before a stored procedure is executed.
610       * <p>
611       * The JDBC type specified by <code>sqlType</code> for an OUT
612       * parameter determines the Java type that must be used
613       * in the <code>get</code> method to read the value of that parameter.
614       * <p>
615       * If the JDBC type expected to be returned to this output parameter
616       * is specific to this particular database, <code>sqlType</code>
617       * should be <code>java.sql.Types.OTHER</code>.  The method 
618       * {@link #getObject} retrieves the value.
619       * @param parameterName the name of the parameter
620       * @param sqlType the JDBC type code defined by <code>java.sql.Types</code>.
621       * If the parameter is of JDBC type <code>NUMERIC</code>
622       * or <code>DECIMAL</code>, the version of
623       * <code>registerOutParameter</code> that accepts a scale value 
624       * should be used.
625       * @exception SQLException if a database access error occurs
626       * @since 1.4
627       */
628      public void registerOutParameter(String parameterName, int sqlType) 
629        throws SQLException
630      {
631        statement.registerOutParameter( parameterName, sqlType );
632      }
633    
634      /**
635       * Registers the parameter named 
636       * <code>parameterName</code> to be of JDBC type
637       * <code>sqlType</code>.  This method must be called
638       * before a stored procedure is executed.
639       * <p>
640       * The JDBC type specified by <code>sqlType</code> for an OUT
641       * parameter determines the Java type that must be used
642       * in the <code>get</code> method to read the value of that parameter.
643       * <p>
644       * This version of <code>registerOutParameter</code> should be
645       * used when the parameter is of JDBC type <code>NUMERIC</code>
646       * or <code>DECIMAL</code>.
647       * @param parameterName the name of the parameter
648       * @param sqlType SQL type code defined by <code>java.sql.Types</code>.
649       * @param scale the desired number of digits to the right of the
650       * decimal point.  It must be greater than or equal to zero.
651       * @exception SQLException if a database access error occurs
652       * @since 1.4
653       */
654      public void registerOutParameter(String parameterName, int sqlType, 
655          int scale) throws SQLException
656      {
657        statement.registerOutParameter( parameterName, sqlType, scale );
658      }
659    
660      /**
661       * Registers the designated output parameter.  This version of 
662       * the method <code>registerOutParameter</code>
663       * should be used for a user-named or REF output parameter.  Examples
664       * of user-named types include: STRUCT, DISTINCT, JAVA_OBJECT, and
665       * named array types.
666       *
667       * Before executing a stored procedure call, you must explicitly
668       * call <code>registerOutParameter</code> to register the type from
669       * <code>java.sql.Types</code> for each
670       * OUT parameter.  For a user-named parameter the fully-qualified SQL
671       * type name of the parameter should also be given, while a REF
672       * parameter requires that the fully-qualified type name of the
673       * referenced type be given.  A JDBC driver that does not need the
674       * type code and type name information may ignore it.   To be portable,
675       * however, applications should always provide these values for
676       * user-named and REF parameters.
677       *
678       * Although it is intended for user-named and REF parameters,
679       * this method may be used to register a parameter of any JDBC type.
680       * If the parameter does not have a user-named or REF type, the
681       * typeName parameter is ignored.
682       *
683       * <P><B>Note:</B> When reading the value of an out parameter, you
684       * must use the <code>getXXX</code> method whose Java type XXX corresponds to the
685       * parameter's registered SQL type.
686       *
687       * @param parameterName the name of the parameter
688       * @param sqlType a value from {@link java.sql.Types}
689       * @param typeName the fully-qualified name of an SQL structured type
690       * @exception SQLException if a database access error occurs
691       * @since 1.4
692       */
693      public void registerOutParameter (String parameterName, int sqlType, 
694          String typeName) throws SQLException
695      {
696        statement.registerOutParameter( parameterName, sqlType, typeName );
697      }
698    
699      /**
700       * Retrieves the value of the designated JDBC <code>DATALINK</code> parameter as a
701       * <code>java.net.URL</code> object.
702       * 
703       * @param parameterIndex the first parameter is 1, the second is 2,...
704       * @return a <code>java.net.URL</code> object that represents the 
705       *         JDBC <code>DATALINK</code> value used as the designated
706       *         parameter
707       * @exception SQLException if a database access error occurs,
708       *            or if the URL being returned is
709       *            not a valid URL on the Java platform
710       * @see #setURL
711       * @since 1.4
712       */
713      public java.net.URL getURL(int parameterIndex) throws SQLException
714      {
715        return statement.getURL( parameterIndex );
716      }
717    
718      /**
719       * Sets the designated parameter to the given <code>java.net.URL</code> object.
720       * The driver converts this to an SQL <code>DATALINK</code> value when
721       * it sends it to the database.
722       *
723       * @param parameterName the name of the parameter
724       * @param val the parameter value
725       * @exception SQLException if a database access error occurs,
726       *            or if a URL is malformed
727       * @see #getURL
728       * @since 1.4
729       */
730      public void setURL(String parameterName, java.net.URL val) 
731        throws SQLException
732      {
733        statement.setURL( parameterName, val );
734      }
735      
736      /**
737       * Sets the designated parameter to SQL <code>NULL</code>.
738       *
739       * <P><B>Note:</B> You must specify the parameter's SQL type.
740       *
741       * @param parameterName the name of the parameter
742       * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
743       * @exception SQLException if a database access error occurs
744       * @since 1.4
745       */
746      public void setNull(String parameterName, int sqlType) 
747        throws SQLException
748      {
749        statement.setNull( parameterName, sqlType );
750      }
751    
752      /**
753       * Sets the designated parameter to the given Java <code>boolean</code> value.
754       * The driver converts this
755       * to an SQL <code>BIT</code> value when it sends it to the database.
756       *
757       * @param parameterName the name of the parameter
758       * @param x the parameter value
759       * @exception SQLException if a database access error occurs
760       * @see #getBoolean
761       * @since 1.4
762       */
763      public void setBoolean(String parameterName, boolean x) 
764        throws SQLException
765      {
766        statement.setBoolean( parameterName, x );
767      }
768    
769      /**
770       * Sets the designated parameter to the given Java <code>byte</code> value.  
771       * The driver converts this
772       * to an SQL <code>TINYINT</code> value when it sends it to the database.
773       *
774       * @param parameterName the name of the parameter
775       * @param x the parameter value
776       * @exception SQLException if a database access error occurs
777       * @see #getByte
778       * @since 1.4
779       */
780      public void setByte(String parameterName, byte x) throws SQLException
781      {
782        statement.setByte( parameterName, x );
783      }
784    
785      /**
786       * Sets the designated parameter to the given Java <code>short</code> value. 
787       * The driver converts this
788       * to an SQL <code>SMALLINT</code> value when it sends it to the database.
789       *
790       * @param parameterName the name of the parameter
791       * @param x the parameter value
792       * @exception SQLException if a database access error occurs
793       * @see #getShort
794       * @since 1.4
795       */
796      public void setShort(String parameterName, short x) 
797        throws SQLException
798      {
799        statement.setShort( parameterName, x );
800      }
801    
802      /**
803       * Sets the designated parameter to the given Java <code>int</code> value.  
804       * The driver converts this
805       * to an SQL <code>INTEGER</code> value when it sends it to the database.
806       *
807       * @param parameterName the name of the parameter
808       * @param x the parameter value
809       * @exception SQLException if a database access error occurs
810       * @see #getInt
811       * @since 1.4
812       */
813      public void setInt(String parameterName, int x) throws SQLException
814      {
815        statement.setInt( parameterName, x );
816      }
817    
818      /**
819       * Sets the designated parameter to the given Java <code>long</code> value. 
820       * The driver converts this
821       * to an SQL <code>BIGINT</code> value when it sends it to the database.
822       *
823       * @param parameterName the name of the parameter
824       * @param x the parameter value
825       * @exception SQLException if a database access error occurs
826       * @see #getLong
827       * @since 1.4
828       */
829      public void setLong(String parameterName, long x) throws SQLException
830      {
831        statement.setLong( parameterName, x );
832      }
833    
834      /**
835       * Sets the designated parameter to the given Java <code>float</code> value. 
836       * The driver converts this
837       * to an SQL <code>FLOAT</code> value when it sends it to the database.
838       *
839       * @param parameterName the name of the parameter
840       * @param x the parameter value
841       * @exception SQLException if a database access error occurs
842       * @see #getFloat
843       * @since 1.4
844       */
845      public void setFloat(String parameterName, float x) 
846        throws SQLException
847      {
848        statement.setFloat( parameterName, x );
849      }
850    
851      /**
852       * Sets the designated parameter to the given Java <code>double</code> value.  
853       * The driver converts this
854       * to an SQL <code>DOUBLE</code> value when it sends it to the database.
855       *
856       * @param parameterName the name of the parameter
857       * @param x the parameter value
858       * @exception SQLException if a database access error occurs
859       * @see #getDouble
860       * @since 1.4
861       */
862      public void setDouble(String parameterName, double x) 
863        throws SQLException
864      {
865        statement.setDouble( parameterName, x );
866      }
867    
868      /**
869       * Sets the designated parameter to the given
870       * <code>java.math.BigDecimal</code> value.  
871       * The driver converts this to an SQL <code>NUMERIC</code> value when
872       * it sends it to the database.
873       *
874       * @param parameterName the name of the parameter
875       * @param x the parameter value
876       * @exception SQLException if a database access error occurs
877       * @see #getBigDecimal
878       * @since 1.4
879       */
880      public void setBigDecimal(String parameterName, BigDecimal x) 
881        throws SQLException
882      {
883        statement.setBigDecimal( parameterName, x );
884      }
885    
886      /**
887       * Sets the designated parameter to the given Java <code>String</code> value. 
888       * The driver converts this
889       * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
890       * (depending on the argument's
891       * size relative to the driver's limits on <code>VARCHAR</code> values)
892       * when it sends it to the database.
893       *
894       * @param parameterName the name of the parameter
895       * @param x the parameter value
896       * @exception SQLException if a database access error occurs
897       * @see #getString
898       * @since 1.4
899       */
900      public void setString(String parameterName, String x) 
901        throws SQLException
902      {
903        statement.setString( parameterName, x );
904      }
905    
906      /**
907       * Sets the designated parameter to the given Java array of bytes.  
908       * The driver converts this to an SQL <code>VARBINARY</code> or 
909       * <code>LONGVARBINARY</code> (depending on the argument's size relative 
910       * to the driver's limits on <code>VARBINARY</code> values) when it sends 
911       * it to the database.
912       *
913       * @param parameterName the name of the parameter
914       * @param x the parameter value 
915       * @exception SQLException if a database access error occurs
916       * @see #getBytes
917       * @since 1.4
918       */
919      public void setBytes(String parameterName, byte x[]) 
920        throws SQLException
921      {
922        statement.setBytes( parameterName, x );
923      }
924    
925      /**
926       * Sets the designated parameter to the given <code>java.sql.Date</code> value.  
927       * The driver converts this
928       * to an SQL <code>DATE</code> value when it sends it to the database.
929       *
930       * @param parameterName the name of the parameter
931       * @param x the parameter value
932       * @exception SQLException if a database access error occurs
933       * @see #getDate
934       * @since 1.4
935       */
936      public void setDate(String parameterName, Date x) throws SQLException
937      {
938        statement.setDate( parameterName, x );
939      }
940    
941      /**
942       * Sets the designated parameter to the given <code>java.sql.Time</code> value.  
943       * The driver converts this
944       * to an SQL <code>TIME</code> value when it sends it to the database.
945       *
946       * @param parameterName the name of the parameter
947       * @param x the parameter value
948       * @exception SQLException if a database access error occurs
949       * @see #getTime
950       * @since 1.4
951       */
952      public void setTime(String parameterName, Time x) throws SQLException
953      {
954        statement.setTime( parameterName, x );
955      }
956    
957      /**
958       * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.  
959       * The driver
960       * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
961       * database.
962       *
963       * @param parameterName the name of the parameter
964       * @param x the parameter value 
965       * @exception SQLException if a database access error occurs
966       * @see #getTimestamp
967       * @since 1.4
968       */
969      public void setTimestamp(String parameterName, Timestamp x) 
970        throws SQLException
971      {
972        statement.setTimestamp( parameterName, x );
973      }
974    
975      /**
976       * Sets the designated parameter to the given input stream, which will have 
977       * the specified number of bytes.
978       * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
979       * parameter, it may be more practical to send it via a
980       * <code>java.io.InputStream</code>. Data will be read from the stream
981       * as needed until end-of-file is reached.  The JDBC driver will
982       * do any necessary conversion from ASCII to the database char format.
983       * 
984       * <P><B>Note:</B> This stream object can either be a standard
985       * Java stream object or your own subclass that implements the
986       * standard interface.
987       *
988       * @param parameterName the name of the parameter
989       * @param x the Java input stream that contains the ASCII parameter value
990       * @param length the number of bytes in the stream 
991       * @exception SQLException if a database access error occurs
992       * @since 1.4
993       */
994      public void setAsciiStream(String parameterName, 
995          java.io.InputStream x, int length) throws SQLException
996      {
997        statement.setAsciiStream( parameterName, x, length );
998      }
999    
1000      /**
1001       * Sets the designated parameter to the given input stream, which will have 
1002       * the specified number of bytes.
1003       * When a very large binary value is input to a <code>LONGVARBINARY</code>
1004       * parameter, it may be more practical to send it via a
1005       * <code>java.io.InputStream</code> object. The data will be read from the stream
1006       * as needed until end-of-file is reached.
1007       * 
1008       * <P><B>Note:</B> This stream object can either be a standard
1009       * Java stream object or your own subclass that implements the
1010       * standard interface.
1011       *
1012       * @param parameterName the name of the parameter
1013       * @param x the java input stream which contains the binary parameter value
1014       * @param length the number of bytes in the stream 
1015       * @exception SQLException if a database access error occurs
1016       * @since 1.4
1017       */
1018      public void setBinaryStream(String parameterName, 
1019          java.io.InputStream x, int length) throws SQLException
1020      {
1021        statement.setBinaryStream( parameterName, x, length );
1022      }
1023    
1024      /**
1025       * Sets the value of the designated parameter with the given object. The second
1026       * argument must be an object type; for integral values, the
1027       * <code>java.lang</code> equivalent objects should be used.
1028       *
1029       * <p>The given Java object will be converted to the given targetSqlType
1030       * before being sent to the database.
1031       *
1032       * If the object has a custom mapping (is of a class implementing the 
1033       * interface <code>SQLData</code>),
1034       * the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it 
1035       * to the SQL data stream.
1036       * If, on the other hand, the object is of a class implementing
1037       * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>, 
1038       * or <code>Array</code>, the driver should pass it to the database as a 
1039       * value of the corresponding SQL type.
1040       * <P>
1041       * Note that this method may be used to pass datatabase-
1042       * specific abstract data types. 
1043       *
1044       * @param parameterName the name of the parameter
1045       * @param x the object containing the input parameter value
1046       * @param targetSqlType the SQL type (as defined in java.sql.Types) to be 
1047       * sent to the database. The scale argument may further qualify this type.
1048       * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
1049       *          this is the number of digits after the decimal point.  For all other
1050       *          types, this value will be ignored.
1051       * @exception SQLException if a database access error occurs
1052       * @see #getObject
1053       * @since 1.4 
1054       */
1055      public void setObject(String parameterName, Object x, 
1056          int targetSqlType, int scale) throws SQLException
1057      {
1058        statement.setObject( parameterName, x, scale );
1059      }
1060    
1061      /**
1062       * Sets the value of the designated parameter with the given object.
1063       * This method is like the method <code>setObject</code>
1064       * above, except that it assumes a scale of zero.
1065       *
1066       * @param parameterName the name of the parameter
1067       * @param x the object containing the input parameter value
1068       * @param targetSqlType the SQL type (as defined in java.sql.Types) to be 
1069       *                      sent to the database
1070       * @exception SQLException if a database access error occurs
1071       * @see #getObject
1072       * @since 1.4
1073       */
1074      public void setObject(String parameterName, Object x, 
1075          int targetSqlType) throws SQLException
1076      {
1077        statement.setObject( parameterName, x, targetSqlType );
1078      }
1079    
1080      /**
1081       * Sets the value of the designated parameter with the given object. 
1082       * The second parameter must be of type <code>Object</code>; therefore, the
1083       * <code>java.lang</code> equivalent objects should be used for built-in types.
1084       *
1085       * <p>The JDBC specification specifies a standard mapping from
1086       * Java <code>Object</code> types to SQL types.  The given argument 
1087       * will be converted to the corresponding SQL type before being
1088       * sent to the database.
1089       *
1090       * <p>Note that this method may be used to pass datatabase-
1091       * specific abstract data types, by using a driver-specific Java
1092       * type.
1093       *
1094       * If the object is of a class implementing the interface <code>SQLData</code>,
1095       * the JDBC driver should call the method <code>SQLData.writeSQL</code>
1096       * to write it to the SQL data stream.
1097       * If, on the other hand, the object is of a class implementing
1098       * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>, 
1099       * or <code>Array</code>, the driver should pass it to the database as a 
1100       * value of the corresponding SQL type.
1101       * <P>
1102       * This method throws an exception if there is an ambiguity, for example, if the
1103       * object is of a class implementing more than one of the interfaces named above.
1104       *
1105       * @param parameterName the name of the parameter
1106       * @param x the object containing the input parameter value 
1107       * @exception SQLException if a database access error occurs or if the given
1108       *            <code>Object</code> parameter is ambiguous
1109       * @see #getObject
1110       * @since 1.4
1111       */
1112      public void setObject(String parameterName, Object x) 
1113        throws SQLException
1114      {
1115        statement.setObject( parameterName, x );
1116      }
1117     
1118    
1119      /**
1120       * Sets the designated parameter to the given <code>Reader</code>
1121       * object, which is the given number of characters long.
1122       * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
1123       * parameter, it may be more practical to send it via a
1124       * <code>java.io.Reader</code> object. The data will be read from the stream
1125       * as needed until end-of-file is reached.  The JDBC driver will
1126       * do any necessary conversion from UNICODE to the database char format.
1127       * 
1128       * <P><B>Note:</B> This stream object can either be a standard
1129       * Java stream object or your own subclass that implements the
1130       * standard interface.
1131       *
1132       * @param parameterName the name of the parameter
1133       * @param reader the <code>java.io.Reader</code> object that
1134       *        contains the UNICODE data used as the designated parameter
1135       * @param length the number of characters in the stream 
1136       * @exception SQLException if a database access error occurs
1137       * @since 1.4
1138       */
1139      public void setCharacterStream(String parameterName, 
1140          java.io.Reader reader, int length) throws SQLException
1141      {
1142        statement.setCharacterStream( parameterName, reader, length );
1143      }
1144    
1145      /**
1146       * Sets the designated parameter to the given <code>java.sql.Date</code> value,
1147       * using the given <code>Calendar</code> object.  The driver uses
1148       * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
1149       * which the driver then sends to the database.  With a
1150       * a <code>Calendar</code> object, the driver can calculate the date
1151       * taking into account a custom timezone.  If no
1152       * <code>Calendar</code> object is specified, the driver uses the default
1153       * timezone, which is that of the virtual machine running the application.
1154       *
1155       * @param parameterName the name of the parameter
1156       * @param x the parameter value
1157       * @param cal the <code>Calendar</code> object the driver will use
1158       *            to construct the date
1159       * @exception SQLException if a database access error occurs
1160       * @see #getDate
1161       * @since 1.4
1162       */
1163      public void setDate(String parameterName, Date x, Calendar cal) 
1164        throws SQLException
1165      {
1166        statement.setDate( parameterName, x, cal );
1167      }
1168    
1169      /**
1170       * Sets the designated parameter to the given <code>java.sql.Time</code> value,
1171       * using the given <code>Calendar</code> object.  The driver uses
1172       * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
1173       * which the driver then sends to the database.  With a
1174       * a <code>Calendar</code> object, the driver can calculate the time
1175       * taking into account a custom timezone.  If no
1176       * <code>Calendar</code> object is specified, the driver uses the default
1177       * timezone, which is that of the virtual machine running the application.
1178       *
1179       * @param parameterName the name of the parameter
1180       * @param x the parameter value
1181       * @param cal the <code>Calendar</code> object the driver will use
1182       *            to construct the time
1183       * @exception SQLException if a database access error occurs
1184       * @see #getTime
1185       * @since 1.4
1186       */
1187      public void setTime(String parameterName, Time x, Calendar cal) 
1188        throws SQLException
1189      {
1190        statement.setTime( parameterName, x, cal );
1191      }
1192    
1193      /**
1194       * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
1195       * using the given <code>Calendar</code> object.  The driver uses
1196       * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
1197       * which the driver then sends to the database.  With a
1198       * a <code>Calendar</code> object, the driver can calculate the timestamp
1199       * taking into account a custom timezone.  If no
1200       * <code>Calendar</code> object is specified, the driver uses the default
1201       * timezone, which is that of the virtual machine running the application.
1202       *
1203       * @param parameterName the name of the parameter
1204       * @param x the parameter value 
1205       * @param cal the <code>Calendar</code> object the driver will use
1206       *            to construct the timestamp
1207       * @exception SQLException if a database access error occurs
1208       * @see #getTimestamp
1209       * @since 1.4
1210       */
1211      public void setTimestamp(String parameterName, Timestamp x, 
1212          Calendar cal) throws SQLException
1213      {
1214        statement.setTimestamp( parameterName, x, cal );
1215      }
1216    
1217      /**
1218       * Sets the designated parameter to SQL <code>NULL</code>.
1219       * This version of the method <code>setNull</code> should
1220       * be used for user-defined types and REF type parameters.  Examples
1221       * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and 
1222       * named array types.
1223       *
1224       * <P><B>Note:</B> To be portable, applications must give the
1225       * SQL type code and the fully-qualified SQL type name when specifying
1226       * a NULL user-defined or REF parameter.  In the case of a user-defined type 
1227       * the name is the type name of the parameter itself.  For a REF 
1228       * parameter, the name is the type name of the referenced type.  If 
1229       * a JDBC driver does not need the type code or type name information, 
1230       * it may ignore it.     
1231       *
1232       * Although it is intended for user-defined and Ref parameters,
1233       * this method may be used to set a null parameter of any JDBC type.
1234       * If the parameter does not have a user-defined or REF type, the given
1235       * typeName is ignored.
1236       *
1237       *
1238       * @param parameterName the name of the parameter
1239       * @param sqlType a value from <code>java.sql.Types</code>
1240       * @param typeName the fully-qualified name of an SQL user-defined type;
1241       *        ignored if the parameter is not a user-defined type or 
1242       *        SQL <code>REF</code> value
1243       * @exception SQLException if a database access error occurs
1244       * @since 1.4
1245       */
1246      public void setNull (String parameterName, int sqlType, 
1247          String typeName) throws SQLException
1248      {
1249        statement.setNull( parameterName, sqlType, typeName );
1250      }
1251    
1252      /**
1253       * Retrieves the value of a JDBC <code>CHAR</code>, <code>VARCHAR</code>, 
1254       * or <code>LONGVARCHAR</code> parameter as a <code>String</code> in 
1255       * the Java programming language.
1256       * <p>
1257       * For the fixed-length type JDBC <code>CHAR</code>,
1258       * the <code>String</code> object
1259       * returned has exactly the same value the JDBC
1260       * <code>CHAR</code> value had in the
1261       * database, including any padding added by the database.
1262       * @param parameterName the name of the parameter
1263       * @return the parameter value. If the value is SQL <code>NULL</code>, the result 
1264       * is <code>null</code>.
1265       * @exception SQLException if a database access error occurs
1266       * @see #setString
1267       * @since 1.4
1268       */
1269      public String getString(String parameterName) throws SQLException
1270      {
1271        return statement.getString( parameterName );
1272      }
1273    
1274      /**
1275       * Retrieves the value of a JDBC <code>BIT</code> parameter as a
1276       * <code>boolean</code> in the Java programming language.
1277       * @param parameterName the name of the parameter
1278       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
1279       * is <code>false</code>.
1280       * @exception SQLException if a database access error occurs
1281       * @see #setBoolean
1282       * @since 1.4
1283       */
1284      public boolean getBoolean(String parameterName) throws SQLException
1285      {
1286        return statement.getBoolean( parameterName );
1287      }
1288    
1289      /**
1290       * Retrieves the value of a JDBC <code>TINYINT</code> parameter as a <code>byte</code> 
1291       * in the Java programming language.
1292       * @param parameterName the name of the parameter
1293       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
1294       * is <code>0</code>.
1295       * @exception SQLException if a database access error occurs
1296       * @see #setByte
1297       * @since 1.4
1298       */
1299      public byte getByte(String parameterName) throws SQLException
1300      {
1301        return statement.getByte( parameterName );
1302      }
1303    
1304      /**
1305       * Retrieves the value of a JDBC <code>SMALLINT</code> parameter as a <code>short</code>
1306       * in the Java programming language.
1307       * @param parameterName the name of the parameter
1308       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
1309       * is <code>0</code>.
1310       * @exception SQLException if a database access error occurs
1311       * @see #setShort
1312       * @since 1.4
1313       */
1314      public short getShort(String parameterName) throws SQLException
1315      {
1316        return statement.getShort( parameterName );
1317      }
1318    
1319      /**
1320       * Retrieves the value of a JDBC <code>INTEGER</code> parameter as an <code>int</code>
1321       * in the Java programming language.
1322       *
1323       * @param parameterName the name of the parameter
1324       * @return the parameter value.  If the value is SQL <code>NULL</code>, 
1325       *         the result is <code>0</code>.
1326       * @exception SQLException if a database access error occurs
1327       * @see #setInt
1328       * @since 1.4
1329       */
1330      public int getInt(String parameterName) throws SQLException
1331      {
1332        return statement.getInt( parameterName );
1333      }
1334    
1335      /**
1336       * Retrieves the value of a JDBC <code>BIGINT</code> parameter as a <code>long</code>
1337       * in the Java programming language.
1338       *
1339       * @param parameterName the name of the parameter
1340       * @return the parameter value.  If the value is SQL <code>NULL</code>, 
1341       *         the result is <code>0</code>.
1342       * @exception SQLException if a database access error occurs
1343       * @see #setLong
1344       * @since 1.4
1345       */
1346      public long getLong(String parameterName) throws SQLException
1347      {
1348        return statement.getLong( parameterName );
1349      }
1350    
1351      /**
1352       * Retrieves the value of a JDBC <code>FLOAT</code> parameter as a <code>float</code>
1353       * in the Java programming language.
1354       * @param parameterName the name of the parameter
1355       * @return the parameter value.  If the value is SQL <code>NULL</code>, 
1356       *         the result is <code>0</code>.
1357       * @exception SQLException if a database access error occurs
1358       * @see #setFloat
1359       * @since 1.4
1360       */
1361      public float getFloat(String parameterName) throws SQLException
1362      {
1363        return statement.getFloat( parameterName );
1364      }
1365    
1366      /**
1367       * Retrieves the value of a JDBC <code>DOUBLE</code> parameter as a <code>double</code>
1368       * in the Java programming language.
1369       * @param parameterName the name of the parameter
1370       * @return the parameter value.  If the value is SQL <code>NULL</code>, 
1371       *         the result is <code>0</code>.
1372       * @exception SQLException if a database access error occurs
1373       * @see #setDouble
1374       * @since 1.4
1375       */
1376      public double getDouble(String parameterName) throws SQLException
1377      {
1378        return statement.getDouble( parameterName );
1379      }
1380    
1381      /**
1382       * Retrieves the value of a JDBC <code>BINARY</code> or <code>VARBINARY</code> 
1383       * parameter as an array of <code>byte</code> values in the Java
1384       * programming language.
1385       * @param parameterName the name of the parameter
1386       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result is 
1387       *  <code>null</code>.
1388       * @exception SQLException if a database access error occurs
1389       * @see #setBytes
1390       * @since 1.4
1391       */
1392      public byte[] getBytes(String parameterName) throws SQLException
1393      {
1394        return statement.getBytes( parameterName );
1395      }
1396    
1397      /**
1398       * Retrieves the value of a JDBC <code>DATE</code> parameter as a 
1399       * <code>java.sql.Date</code> object.
1400       * @param parameterName the name of the parameter
1401       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
1402       * is <code>null</code>.
1403       * @exception SQLException if a database access error occurs
1404       * @see #setDate
1405       * @since 1.4
1406       */
1407      public Date getDate(String parameterName) throws SQLException
1408      {
1409        return statement.getDate( parameterName );
1410      }
1411    
1412      /**
1413       * Retrieves the value of a JDBC <code>TIME</code> parameter as a 
1414       * <code>java.sql.Time</code> object.
1415       * @param parameterName the name of the parameter
1416       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
1417       * is <code>null</code>.
1418       * @exception SQLException if a database access error occurs
1419       * @see #setTime
1420       * @since 1.4
1421       */
1422      public Time getTime(String parameterName) throws SQLException
1423      {
1424        return statement.getTime( parameterName );
1425      }
1426    
1427      /**
1428       * Retrieves the value of a JDBC <code>TIMESTAMP</code> parameter as a 
1429       * <code>java.sql.Timestamp</code> object.
1430       * @param parameterName the name of the parameter
1431       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result 
1432       * is <code>null</code>.
1433       * @exception SQLException if a database access error occurs
1434       * @see #setTimestamp
1435       * @since 1.4
1436       */
1437      public Timestamp getTimestamp(String parameterName) 
1438        throws SQLException
1439      {
1440        return statement.getTimestamp( parameterName );
1441      }
1442    
1443      /**
1444       * Retrieves the value of a parameter as an <code>Object</code> in the Java 
1445       * programming language. If the value is an SQL <code>NULL</code>, the 
1446       * driver returns a Java <code>null</code>.
1447       * <p>
1448       * This method returns a Java object whose type corresponds to the JDBC
1449       * type that was registered for this parameter using the method
1450       * <code>registerOutParameter</code>.  By registering the target JDBC
1451       * type as <code>java.sql.Types.OTHER</code>, this method can be used
1452       * to read database-specific abstract data types.
1453       * @param parameterName the name of the parameter
1454       * @return A <code>java.lang.Object</code> holding the OUT parameter value.
1455       * @exception SQLException if a database access error occurs
1456       * @see #setObject
1457       * @since 1.4
1458       */
1459      public Object getObject(String parameterName) throws SQLException
1460      {
1461        return statement.getObject( parameterName );
1462      }
1463    
1464      /**
1465       * Retrieves the value of a JDBC <code>NUMERIC</code> parameter as a 
1466       * <code>java.math.BigDecimal</code> object with as many digits to the
1467       * right of the decimal point as the value contains.
1468       * @param parameterName the name of the parameter
1469       * @return the parameter value in full precision.  If the value is 
1470       * SQL <code>NULL</code>, the result is <code>null</code>. 
1471       * @exception SQLException if a database access error occurs
1472       * @see #setBigDecimal
1473       * @since 1.4
1474       */
1475      public BigDecimal getBigDecimal(String parameterName) 
1476        throws SQLException
1477      {
1478        return statement.getBigDecimal( parameterName );
1479      }
1480    
1481      /**
1482       * Returns an object representing the value of OUT parameter 
1483       * <code>i</code> and uses <code>map</code> for the custom
1484       * mapping of the parameter value.
1485       * <p>
1486       * This method returns a Java object whose type corresponds to the
1487       * JDBC type that was registered for this parameter using the method
1488       * <code>registerOutParameter</code>.  By registering the target
1489       * JDBC type as <code>java.sql.Types.OTHER</code>, this method can
1490       * be used to read database-specific abstract data types.  
1491       * @param parameterName the name of the parameter
1492       * @param map the mapping from SQL type names to Java classes
1493       * @return a <code>java.lang.Object</code> holding the OUT parameter value
1494       * @exception SQLException if a database access error occurs
1495       * @see #setObject
1496       * @since 1.4
1497       */
1498      public Object getObject(String parameterName, 
1499          java.util.Map<String,Class<?>> map) throws SQLException
1500      {
1501        return statement.getObject( parameterName, map );
1502      }
1503    
1504      /**
1505       * Retrieves the value of a JDBC <code>REF(&lt;structured-type&gt;)</code>
1506       * parameter as a {@link Ref} object in the Java programming language.
1507       *
1508       * @param parameterName the name of the parameter
1509       * @return the parameter value as a <code>Ref</code> object in the
1510       *         Java programming language.  If the value was SQL <code>NULL</code>, 
1511       *         the value <code>null</code> is returned.
1512       * @exception SQLException if a database access error occurs
1513       * @since 1.4
1514       */
1515      public Ref getRef (String parameterName) throws SQLException
1516      {
1517        return statement.getRef( parameterName );
1518      }
1519    
1520      /**
1521       * Retrieves the value of a JDBC <code>BLOB</code> parameter as a
1522       * {@link Blob} object in the Java programming language.
1523       *
1524       * @param parameterName the name of the parameter
1525       * @return the parameter value as a <code>Blob</code> object in the
1526       *         Java programming language.  If the value was SQL <code>NULL</code>, 
1527       *         the value <code>null</code> is returned.
1528       * @exception SQLException if a database access error occurs
1529       * @since 1.4
1530       */
1531      public Blob getBlob (String parameterName) throws SQLException
1532      {
1533        return statement.getBlob( parameterName );
1534      }
1535    
1536      /**
1537       * Retrieves the value of a JDBC <code>CLOB</code> parameter as a
1538       * <code>Clob</code> object in the Java programming language.
1539       * @param parameterName the name of the parameter
1540       * @return the parameter value as a <code>Clob</code> object in the
1541       *         Java programming language.  If the value was SQL <code>NULL</code>, 
1542       *         the value <code>null</code> is returned.
1543       * @exception SQLException if a database access error occurs
1544       * @since 1.4
1545       */
1546      public Clob getClob (String parameterName) throws SQLException
1547      {
1548        return statement.getClob( parameterName );
1549      }
1550    
1551      /**
1552       * Retrieves the value of a JDBC <code>ARRAY</code> parameter as an
1553       * {@link Array} object in the Java programming language.
1554       *
1555       * @param parameterName the name of the parameter
1556       * @return the parameter value as an <code>Array</code> object in
1557       *         Java programming language.  If the value was SQL <code>NULL</code>, 
1558       *         the value <code>null</code> is returned.
1559       * @exception SQLException if a database access error occurs
1560       * @since 1.4
1561       */
1562      public Array getArray (String parameterName) throws SQLException
1563      {
1564        return statement.getArray( parameterName );
1565      }
1566    
1567      /**
1568       * Retrieves the value of a JDBC <code>DATE</code> parameter as a 
1569       * <code>java.sql.Date</code> object, using
1570       * the given <code>Calendar</code> object
1571       * to construct the date.
1572       * With a <code>Calendar</code> object, the driver
1573       * can calculate the date taking into account a custom timezone and locale.
1574       * If no <code>Calendar</code> object is specified, the driver uses the
1575       * default timezone and locale.
1576       *
1577       * @param parameterName the name of the parameter
1578       * @param cal the <code>Calendar</code> object the driver will use
1579       *            to construct the date
1580       * @return the parameter value.  If the value is SQL <code>NULL</code>, 
1581       * the result is <code>null</code>.
1582       * @exception SQLException if a database access error occurs
1583       * @see #setDate
1584       * @since 1.4
1585       */
1586      public Date getDate(String parameterName, Calendar cal) 
1587        throws SQLException
1588      {
1589        return statement.getDate( parameterName, cal );
1590      }
1591    
1592      /**
1593       * Retrieves the value of a JDBC <code>TIME</code> parameter as a 
1594       * <code>java.sql.Time</code> object, using
1595       * the given <code>Calendar</code> object
1596       * to construct the time.
1597       * With a <code>Calendar</code> object, the driver
1598       * can calculate the time taking into account a custom timezone and locale.
1599       * If no <code>Calendar</code> object is specified, the driver uses the
1600       * default timezone and locale.
1601       *
1602       * @param parameterName the name of the parameter
1603       * @param cal the <code>Calendar</code> object the driver will use
1604       *            to construct the time
1605       * @return the parameter value; if the value is SQL <code>NULL</code>, the result is 
1606       * <code>null</code>.
1607       * @exception SQLException if a database access error occurs
1608       * @see #setTime
1609       * @since 1.4
1610       */
1611      public Time getTime(String parameterName, Calendar cal) 
1612        throws SQLException
1613      {
1614        return statement.getTime( parameterName, cal );
1615      }
1616    
1617      /**
1618       * Retrieves the value of a JDBC <code>TIMESTAMP</code> parameter as a
1619       * <code>java.sql.Timestamp</code> object, using
1620       * the given <code>Calendar</code> object to construct
1621       * the <code>Timestamp</code> object.
1622       * With a <code>Calendar</code> object, the driver
1623       * can calculate the timestamp taking into account a custom timezone and locale.
1624       * If no <code>Calendar</code> object is specified, the driver uses the
1625       * default timezone and locale.
1626       *
1627       *
1628       * @param parameterName the name of the parameter
1629       * @param cal the <code>Calendar</code> object the driver will use
1630       *            to construct the timestamp
1631       * @return the parameter value.  If the value is SQL <code>NULL</code>, the result is 
1632       * <code>null</code>.
1633       * @exception SQLException if a database access error occurs
1634       * @see #setTimestamp
1635       * @since 1.4
1636       */
1637      public Timestamp getTimestamp(String parameterName, Calendar cal) 
1638        throws SQLException
1639      {
1640        return statement.getTimestamp( parameterName, cal );
1641      }
1642    
1643      /**
1644       * Retrieves the value of a JDBC <code>DATALINK</code> parameter as a
1645       * <code>java.net.URL</code> object.
1646       *
1647       * @param parameterName the name of the parameter
1648       * @return the parameter value as a <code>java.net.URL</code> object in the
1649       * Java programming language.  If the value was SQL <code>NULL</code>, the
1650       * value <code>null</code> is returned.
1651       * @exception SQLException if a database access error occurs,
1652       *            or if there is a problem with the URL
1653       * @see #setURL
1654       * @since 1.4
1655       */
1656      public java.net.URL getURL(String parameterName) throws SQLException
1657      {
1658        return statement.getURL( parameterName );
1659      }
1660      
1661      /**
1662       * Returns {@link #statement}.
1663       *
1664       * @return CallableStatement The value/reference of/to statement.
1665       */
1666      public CallableStatement getStatement()
1667      {
1668        return statement;
1669      }
1670    }