View Javadoc

1   /*
2    * Copyright (c) 1998, 2005 Gargoyle Software Inc. All rights reserved.
3    *
4    * Redistribution and use in source and binary forms, with or without
5    * modification, are permitted provided that the following conditions are met:
6    *
7    * 1. Redistributions of source code must retain the above copyright notice,
8    *    this list of conditions and the following disclaimer.
9    * 2. Redistributions in binary form must reproduce the above copyright notice,
10   *    this list of conditions and the following disclaimer in the documentation
11   *    and/or other materials provided with the distribution.
12   * 3. The end-user documentation included with the redistribution, if any, must
13   *    include the following acknowledgment:
14   *
15   *       "This product includes software developed by Gargoyle Software Inc.
16   *        (http://www.GargoyleSoftware.com/)."
17   *
18   *    Alternately, this acknowledgment may appear in the software itself, if
19   *    and wherever such third-party acknowledgments normally appear.
20   * 4. The name "Gargoyle Software" must not be used to endorse or promote
21   *    products derived from this software without prior written permission.
22   *    For written permission, please contact info@GargoyleSoftware.com.
23   * 5. Products derived from this software may not be called "GSBase", nor may
24   *    "GSBase" appear in their name, without prior written permission of
25   *    Gargoyle Software Inc.
26   *
27   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
28   * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
29   * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GARGOYLE
30   * SOFTWARE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
31   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
32   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
33   * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
34   * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
35   * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
36   * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37   */
38  package com.gargoylesoftware.base.resource.jdbc;
39  
40  import java.io.InputStream;
41  import java.io.Reader;
42  import java.math.BigDecimal;
43  import java.sql.Array;
44  import java.sql.Blob;
45  import java.sql.Clob;
46  import java.sql.Date;
47  import java.sql.PreparedStatement;
48  import java.sql.Ref;
49  import java.sql.ResultSet;
50  import java.sql.ResultSetMetaData;
51  import java.sql.ParameterMetaData;
52  import java.sql.SQLException;
53  import java.sql.Time;
54  import java.sql.Timestamp;
55  import java.util.Calendar;
56  
57  /***
58   *  A wrapper for a PreparedStatement
59   *
60   * @version  $Revision: 1.4 $
61   * @author <a href="mailto:mbowler@GargoyleSoftware.com">Mike Bowler</a>
62   */
63  
64  public class PreparedStatementWrapper
65           extends
66          StatementWrapper
67           implements
68          PreparedStatement {
69  
70      /***
71       */
72      private final PreparedStatement delegate_;
73  
74  
75      /***
76       *  Create a PreparedStatementWrapper
77       *
78       * @param  statement The PreparedStatement that we are wrapping
79       */
80      public PreparedStatementWrapper( final PreparedStatement statement ) {
81          super( statement );
82          delegate_ = statement;
83      }
84  
85  
86      /***
87       *  Sets the designated parameter to SQL <code>NULL</code>. <P>
88       *
89       *  <B>Note:</B> You must specify the parameter's SQL type.
90       *
91       * @param  parameterIndex the first parameter is 1, the second is 2, ...
92       * @param  sqlType the SQL type code defined in <code>java.sql.Types</code>
93       * @exception  SQLException if a database access error occurs
94       */
95      public final void setNull( int parameterIndex, int sqlType )
96          throws SQLException {
97          checkIsOpen();
98          delegate_.setNull( parameterIndex, sqlType );
99      }
100 
101 
102     /***
103      *  Sets the designated parameter to a Java <code>boolean</code> value. The
104      *  driver converts this to an SQL <code>BIT</code> value when it sends it
105      *  to the database.
106      *
107      * @param  parameterIndex the first parameter is 1, the second is 2, ...
108      * @param  x the parameter value
109      * @exception  SQLException if a database access error occurs
110      */
111     public final void setBoolean( int parameterIndex, boolean x )
112         throws SQLException {
113         checkIsOpen();
114         delegate_.setBoolean( parameterIndex, x );
115     }
116 
117 
118     /***
119      *  Sets the designated parameter to a Java <code>byte</code> value. The
120      *  driver converts this to an SQL <code>TINYINT</code> value when it sends
121      *  it to the database.
122      *
123      * @param  parameterIndex the first parameter is 1, the second is 2, ...
124      * @param  x the parameter value
125      * @exception  SQLException if a database access error occurs
126      */
127     public final void setByte( int parameterIndex, byte x )
128         throws SQLException {
129         checkIsOpen();
130         delegate_.setByte( parameterIndex, x );
131     }
132 
133 
134     /***
135      *  Sets the designated parameter to a Java <code>short</code> value. The
136      *  driver converts this to an SQL <code>SMALLINT</code> value when it sends
137      *  it to the database.
138      *
139      * @param  parameterIndex the first parameter is 1, the second is 2, ...
140      * @param  x the parameter value
141      * @exception  SQLException if a database access error occurs
142      */
143     public final void setShort( int parameterIndex, short x )
144         throws SQLException {
145         checkIsOpen();
146         delegate_.setShort( parameterIndex, x );
147     }
148 
149 
150     /***
151      *  Sets the designated parameter to a Java <code>int</code> value. The
152      *  driver converts this to an SQL <code>INTEGER</code> value when it sends
153      *  it to the database.
154      *
155      * @param  parameterIndex the first parameter is 1, the second is 2, ...
156      * @param  x the parameter value
157      * @exception  SQLException if a database access error occurs
158      */
159     public final void setInt( int parameterIndex, int x )
160         throws SQLException {
161         checkIsOpen();
162         delegate_.setInt( parameterIndex, x );
163     }
164 
165 
166     /***
167      *  Sets the designated parameter to a Java <code>long</code> value. The
168      *  driver converts this to an SQL <code>BIGINT</code> value when it sends
169      *  it to the database.
170      *
171      * @param  parameterIndex the first parameter is 1, the second is 2, ...
172      * @param  x the parameter value
173      * @exception  SQLException if a database access error occurs
174      */
175     public final void setLong( int parameterIndex, long x )
176         throws SQLException {
177         checkIsOpen();
178         delegate_.setLong( parameterIndex, x );
179     }
180 
181 
182     /***
183      *  Sets the designated parameter to a Java <code>float</code> value. The
184      *  driver converts this to an SQL <code>FLOAT</code> value when it sends it
185      *  to the database.
186      *
187      * @param  parameterIndex the first parameter is 1, the second is 2, ...
188      * @param  x the parameter value
189      * @exception  SQLException if a database access error occurs
190      */
191     public final void setFloat( int parameterIndex, float x )
192         throws SQLException {
193         checkIsOpen();
194         delegate_.setFloat( parameterIndex, x );
195     }
196 
197 
198     /***
199      *  Sets the designated parameter to a Java <code>double</code> value. The
200      *  driver converts this to an SQL <code>DOUBLE</code> value when it sends
201      *  it to the database.
202      *
203      * @param  parameterIndex the first parameter is 1, the second is 2, ...
204      * @param  x the parameter value
205      * @exception  SQLException if a database access error occurs
206      */
207     public final void setDouble( int parameterIndex, double x )
208         throws SQLException {
209         checkIsOpen();
210         delegate_.setDouble( parameterIndex, x );
211     }
212 
213 
214     /***
215      *  Sets the designated parameter to a <code>java.math.BigDecimal</code>
216      *  value. The driver converts this to an SQL <code>NUMERIC</code> value
217      *  when it sends it to the database.
218      *
219      * @param  parameterIndex the first parameter is 1, the second is 2, ...
220      * @param  x the parameter value
221      * @exception  SQLException if a database access error occurs
222      */
223     public final void setBigDecimal( int parameterIndex, BigDecimal x )
224         throws SQLException {
225         checkIsOpen();
226         delegate_.setBigDecimal( parameterIndex, x );
227     }
228 
229 
230     /***
231      *  Sets the designated parameter to a Java <code>String</code> value. The
232      *  driver converts this to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code>
233      *  value (depending on the argument's size relative to the driver's limits
234      *  on <code>VARCHAR</code> values) when it sends it to the database.
235      *
236      * @param  parameterIndex the first parameter is 1, the second is 2, ...
237      * @param  x the parameter value
238      * @exception  SQLException if a database access error occurs
239      */
240     public final void setString( int parameterIndex, String x )
241         throws SQLException {
242         checkIsOpen();
243         delegate_.setString( parameterIndex, x );
244     }
245 
246 
247     /***
248      *  Sets the designated parameter to a Java array of bytes. The driver
249      *  converts this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code>
250      *  (depending on the argument's size relative to the driver's limits on
251      *  <code>VARBINARY</code> values) when it sends it to the database.
252      *
253      * @param  parameterIndex the first parameter is 1, the second is 2, ...
254      * @param  x the parameter value
255      * @exception  SQLException if a database access error occurs
256      */
257     public final void setBytes( int parameterIndex, byte x[] )
258         throws SQLException {
259         checkIsOpen();
260         delegate_.setBytes( parameterIndex, x );
261     }
262 
263 
264     /***
265      *  Sets the designated parameter to a <code<java.sql.Date</code> value. The
266      *  driver converts this to an SQL <code>DATE</code> value when it sends it
267      *  to the database.
268      *
269      * @param  parameterIndex the first parameter is 1, the second is 2, ...
270      * @param  x the parameter value
271      * @exception  SQLException if a database access error occurs
272      */
273     public final void setDate( int parameterIndex, Date x )
274         throws SQLException {
275         checkIsOpen();
276         delegate_.setDate( parameterIndex, x );
277     }
278 
279 
280     /***
281      *  Sets the designated parameter to a <code>java.sql.Time</code> value. The
282      *  driver converts this to an SQL <code>TIME</code> value when it sends it
283      *  to the database.
284      *
285      * @param  parameterIndex the first parameter is 1, the second is 2, ...
286      * @param  x the parameter value
287      * @exception  SQLException if a database access error occurs
288      */
289     public final void setTime( int parameterIndex, java.sql.Time x )
290         throws SQLException {
291         checkIsOpen();
292         delegate_.setTime( parameterIndex, x );
293     }
294 
295 
296     /***
297      *  Sets the designated parameter to a <code>java.sql.Timestamp</code>
298      *  value. The driver converts this to an SQL <code>TIMESTAMP</code> value
299      *  when it sends it to the database.
300      *
301      * @param  parameterIndex the first parameter is 1, the second is 2, ...
302      * @param  x the parameter value
303      * @exception  SQLException if a database access error occurs
304      */
305     public final void setTimestamp( int parameterIndex, Timestamp x )
306         throws SQLException {
307         checkIsOpen();
308         delegate_.setTimestamp( parameterIndex, x );
309     }
310 
311 
312     /***
313      *  Sets the designated parameter to the given input stream, which will have
314      *  the specified number of bytes. When a very large ASCII value is input to
315      *  a <code>LONGVARCHAR</code> parameter, it may be more practical to send
316      *  it via a <code>java.io.InputStream</code>. Data will be read from the
317      *  stream as needed until end-of-file is reached. The JDBC driver will do
318      *  any necessary conversion from ASCII to the database char format. <P>
319      *
320      *  <B>Note:</B> This stream object can either be a standard Java stream
321      *  object or your own subclass that implements the standard interface.
322      *
323      * @param  parameterIndex the first parameter is 1, the second is 2, ...
324      * @param  x the Java input stream that contains the ASCII parameter value
325      * @param  length the number of bytes in the stream
326      * @exception  SQLException if a database access error occurs
327      */
328     public final void setAsciiStream( int parameterIndex, InputStream x, int length )
329         throws SQLException {
330         checkIsOpen();
331         delegate_.setAsciiStream( parameterIndex, x, length );
332     }
333 
334 
335     /***
336      *  Sets the designated parameter to the given input stream, which will have
337      *  the specified number of bytes. When a very large UNICODE value is input
338      *  to a <code>LONGVARCHAR</code> parameter, it may be more practical to
339      *  send it via a <code>java.io.InputStream</code> object. The data will be
340      *  read from the stream as needed until end-of-file is reached. The JDBC
341      *  driver will do any necessary conversion from UNICODE to the database
342      *  char format. The byte format of the Unicode stream must be Java UTF-8,
343      *  as defined in the Java Virtual Machine Specification. <P>
344      *
345      *  <B>Note:</B> This stream object can either be a standard Java stream
346      *  object or your own subclass that implements the standard interface.
347      *
348      * @param  parameterIndex the first parameter is 1, the second is 2, ...
349      * @param  x the java input stream which contains the UNICODE parameter
350      *      value
351      * @param  length the number of bytes in the stream
352      * @exception  SQLException if a database access error occurs
353      * @deprecated
354      */
355     public final void setUnicodeStream( int parameterIndex, InputStream x,
356             int length )
357         throws SQLException {
358         checkIsOpen();
359         delegate_.setUnicodeStream( parameterIndex, x, length );
360     }
361 
362 
363     /***
364      *  Sets the designated parameter to the given input stream, which will have
365      *  the specified number of bytes. When a very large binary value is input
366      *  to a <code>LONGVARBINARY</code> parameter, it may be more practical to
367      *  send it via a <code>java.io.InputStream</code> object. The data will be
368      *  read from the stream as needed until end-of-file is reached. <P>
369      *
370      *  <B>Note:</B> This stream object can either be a standard Java stream
371      *  object or your own subclass that implements the standard interface.
372      *
373      * @param  parameterIndex the first parameter is 1, the second is 2, ...
374      * @param  x the java input stream which contains the binary parameter value
375      * @param  length the number of bytes in the stream
376      * @exception  SQLException if a database access error occurs
377      */
378     public final void setBinaryStream( int parameterIndex, InputStream x,
379             int length )
380         throws SQLException {
381         checkIsOpen();
382         delegate_.setBinaryStream( parameterIndex, x, length );
383     }
384 
385     //----------------------------------------------------------------------
386     // Advanced features:
387 
388     /***
389      *  <p>
390      *
391      *  Sets the value of the designated parameter with the given object. The
392      *  second argument must be an object type; for integral values, the <code>java.lang</code>
393      *  equivalent objects should be used. <p>
394      *
395      *  The given Java object will be converted to the given targetSqlType
396      *  before being sent to the database. If the object has a custom mapping
397      *  (is of a class implementing the interface <code>SQLData</code>), the
398      *  JDBC driver should call the method <code>SQLData.writeSQL</code> to
399      *  write it to the SQL data stream. If, on the other hand, the object is of
400      *  a class implementing Ref, Blob, Clob, Struct, or Array, the driver
401      *  should pass it to the database as a value of the corresponding SQL type.
402      *  <p>
403      *
404      *  Note that this method may be used to pass datatabase- specific abstract
405      *  data types.
406      *
407      * @param  parameterIndex the first parameter is 1, the second is 2, ...
408      * @param  x the object containing the input parameter value
409      * @param  targetSqlType the SQL type (as defined in java.sql.Types) to be
410      *      sent to the database. The scale argument may further qualify this
411      *      type.
412      * @param  scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
413      *      this is the number of digits after the decimal point. For all other
414      *      types, this value will be ignored.
415      * @exception  SQLException if a database access error occurs
416      */
417     public final void setObject( int parameterIndex, Object x, int targetSqlType, int scale )
418         throws SQLException {
419         checkIsOpen();
420         delegate_.setObject( parameterIndex, x, targetSqlType, scale );
421     }
422 
423 
424     /***
425      *  Sets the value of the designated parameter with the given object. This
426      *  method is like the method <code>setObject</code> above, except that it
427      *  assumes a scale of zero.
428      *
429      * @param  parameterIndex the first parameter is 1, the second is 2, ...
430      * @param  x the object containing the input parameter value
431      * @param  targetSqlType the SQL type (as defined in java.sql.Types) to be
432      *      sent to the database
433      * @exception  SQLException if a database access error occurs
434      */
435     public final void setObject( int parameterIndex, Object x, int targetSqlType )
436         throws SQLException {
437         checkIsOpen();
438         delegate_.setObject( parameterIndex, x, targetSqlType );
439     }
440 
441 
442     /***
443      *  <p>
444      *
445      *  Sets the value of the designated parameter using the given object. The
446      *  second parameter must be of type <code>Object</code>; therefore, the
447      *  <code>java.lang</code> equivalent objects should be used for built-in
448      *  types. <p>
449      *
450      *  The JDBC specification specifies a standard mapping from Java <code>Object</code>
451      *  types to SQL types. The given argument will be converted to the
452      *  corresponding SQL type before being sent to the database. <p>
453      *
454      *  Note that this method may be used to pass datatabase- specific abstract
455      *  data types, by using a driver-specific Java type. If the object is of a
456      *  class implementing the interface <code>SQLData</code>, the JDBC driver
457      *  should call the method <code>SQLData.writeSQL</code> to write it to the
458      *  SQL data stream. If, on the other hand, the object is of a class
459      *  implementing Ref, Blob, Clob, Struct, or Array, then the driver should
460      *  pass it to the database as a value of the corresponding SQL type. This
461      *  method throws an exception if there is an ambiguity, for example, if the
462      *  object is of a class implementing more than one of the interfaces named
463      *  above.
464      *
465      * @param  parameterIndex the first parameter is 1, the second is 2, ...
466      * @param  x the object containing the input parameter value
467      * @exception  SQLException if a database access error occurs
468      */
469     public final void setObject( int parameterIndex, Object x )
470         throws SQLException {
471         checkIsOpen();
472         delegate_.setObject( parameterIndex, x );
473     }
474 
475 
476     /***
477      *  Sets the designated parameter to the given <code>Reader</code> object,
478      *  which is the given number of characters long. When a very large UNICODE
479      *  value is input to a <code>LONGVARCHAR</code> parameter, it may be more
480      *  practical to send it via a <code>java.io.Reader</code> object. The data
481      *  will be read from the stream as needed until end-of-file is reached. The
482      *  JDBC driver will do any necessary conversion from UNICODE to the
483      *  database char format. <P>
484      *
485      *  <B>Note:</B> This stream object can either be a standard Java stream
486      *  object or your own subclass that implements the standard interface.
487      *
488      * @param  parameterIndex the first parameter is 1, the second is 2, ...
489      * @param  reader the java reader which contains the UNICODE data
490      * @param  length the number of characters in the stream
491      * @exception  SQLException if a database access error occurs
492      * @since  1.2
493      */
494     public final void setCharacterStream( int parameterIndex, Reader reader,
495             int length )
496         throws SQLException {
497         checkIsOpen();
498         delegate_.setCharacterStream( parameterIndex, reader, length );
499     }
500 
501 
502     /***
503      *  Sets the designated parameter to the given <code>REF(&lt;structured-type&gt;)</code>
504      *  value.
505      *
506      * @param  i the first parameter is 1, the second is 2, ...
507      * @param  x an SQL <code>REF</code> value
508      * @exception  SQLException if a database access error occurs
509      * @since  1.2
510      */
511     public final void setRef( int i, Ref x )
512         throws SQLException {
513         checkIsOpen();
514         delegate_.setRef( i, x );
515     }
516 
517 
518     /***
519      *  Sets the designated parameter to the given <code>Blob</code> object.
520      *
521      * @param  i the first parameter is 1, the second is 2, ...
522      * @param  x a <code>Blob</code> object that maps an SQL <code>BLOB</code>
523      *      value
524      * @exception  SQLException if a database access error occurs
525      * @since  1.2
526      */
527     public final void setBlob( int i, Blob x )
528         throws SQLException {
529         checkIsOpen();
530         delegate_.setBlob( i, x );
531     }
532 
533 
534     /***
535      *  Sets the designated parameter to the given <code>Clob</code> object.
536      *
537      * @param  i the first parameter is 1, the second is 2, ...
538      * @param  x a <code>Clob</code> object that maps an SQL <code>CLOB</code>
539      *      value
540      * @exception  SQLException if a database access error occurs
541      * @since  1.2
542      */
543     public final void setClob( int i, Clob x )
544         throws SQLException {
545         checkIsOpen();
546         delegate_.setClob( i, x );
547     }
548 
549 
550     /***
551      *  Sets the designated parameter to the given <code>Array</code> object.
552      *  Sets an Array parameter.
553      *
554      * @param  i the first parameter is 1, the second is 2, ...
555      * @param  x an <code>Array</code> object that maps an SQL <code>ARRAY</code>
556      *      value
557      * @exception  SQLException if a database access error occurs
558      * @since  1.2
559      */
560     public final void setArray( int i, Array x )
561         throws SQLException {
562         checkIsOpen();
563         delegate_.setArray( i, x );
564     }
565 
566 
567     /***
568      *  Sets the designated parameter to the given <code>java.sql.Date</code>
569      *  value, using the given <code>Calendar</code> object. The driver uses the
570      *  <code>Calendar</code> object to construct an SQL <code>DATE</code>
571      *  value, which the driver then sends to the database. With a a <code>Calendar</code>
572      *  object, the driver can calculate the date taking into account a custom
573      *  timezone. If no <code>Calendar</code> object is specified, the driver
574      *  uses the default timezone, which is that of the virtual machine running
575      *  the application.
576      *
577      * @param  parameterIndex the first parameter is 1, the second is 2, ...
578      * @param  x the parameter value
579      * @param  cal the <code>Calendar</code> object the driver will use to
580      *      construct the date
581      * @exception  SQLException if a database access error occurs
582      * @since  1.2
583      */
584     public final void setDate( int parameterIndex, Date x, Calendar cal )
585         throws SQLException {
586         checkIsOpen();
587         delegate_.setDate( parameterIndex, x, cal );
588     }
589 
590 
591     /***
592      *  Sets the designated parameter to the given <code>java.sql.Time</code>
593      *  value, using the given <code>Calendar</code> object. The driver uses the
594      *  <code>Calendar</code> object to construct an SQL <code>TIME</code>
595      *  value, which the driver then sends to the database. With a a <code>Calendar</code>
596      *  object, the driver can calculate the time taking into account a custom
597      *  timezone. If no <code>Calendar</code> object is specified, the driver
598      *  uses the default timezone, which is that of the virtual machine running
599      *  the application.
600      *
601      * @param  parameterIndex the first parameter is 1, the second is 2, ...
602      * @param  x the parameter value
603      * @param  cal the <code>Calendar</code> object the driver will use to
604      *      construct the time
605      * @exception  SQLException if a database access error occurs
606      * @since  1.2
607      */
608     public final void setTime( int parameterIndex, Time x, Calendar cal )
609         throws SQLException {
610         checkIsOpen();
611         delegate_.setTime( parameterIndex, x, cal );
612     }
613 
614 
615     /***
616      *  Sets the designated parameter to the given <code>java.sql.Timestamp</code>
617      *  value, using the given <code>Calendar</code> object. The driver uses the
618      *  <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code>
619      *  value, which the driver then sends to the database. With a a <code>Calendar</code>
620      *  object, the driver can calculate the timestamp taking into account a
621      *  custom timezone. If no <code>Calendar</code> object is specified, the
622      *  driver uses the default timezone, which is that of the virtual machine
623      *  running the application.
624      *
625      * @param  parameterIndex the first parameter is 1, the second is 2, ...
626      * @param  x the parameter value
627      * @param  cal the <code>Calendar</code> object the driver will use to
628      *      construct the timestamp
629      * @exception  SQLException if a database access error occurs
630      * @since  1.2
631      */
632     public final void setTimestamp( int parameterIndex, Timestamp x, Calendar cal )
633         throws SQLException {
634         checkIsOpen();
635         delegate_.setTimestamp( parameterIndex, x, cal );
636     }
637 
638 
639     /***
640      *  Sets the designated parameter to SQL <code>NULL</code>. This version of
641      *  the method <code>setNull</code> should be used for user-defined types
642      *  and REF type parameters. Examples of user-defined types include: STRUCT,
643      *  DISTINCT, JAVA_OBJECT, and named array types. <P>
644      *
645      *  <B>Note:</B> To be portable, applications must give the SQL type code
646      *  and the fully-qualified SQL type name when specifying a NULL
647      *  user-defined or REF parameter. In the case of a user-defined type the
648      *  name is the type name of the parameter itself. For a REF parameter, the
649      *  name is the type name of the referenced type. If a JDBC driver does not
650      *  need the type code or type name information, it may ignore it. Although
651      *  it is intended for user-defined and Ref parameters, this method may be
652      *  used to set a null parameter of any JDBC type. If the parameter does not
653      *  have a user-defined or REF type, the given typeName is ignored.
654      *
655      * @param  paramIndex the first parameter is 1, the second is 2, ...
656      * @param  sqlType a value from <code>java.sql.Types</code>
657      * @param  typeName the fully-qualified name of an SQL user-defined type;
658      *      ignored if the parameter is not a user-defined type or REF
659      * @exception  SQLException if a database access error occurs
660      * @since  1.2
661      */
662     public final void setNull( int paramIndex, int sqlType, String typeName )
663         throws SQLException {
664         checkIsOpen();
665         delegate_.setNull( paramIndex, sqlType, typeName );
666     }
667 
668 
669     /***
670      *  Gets the number, types and properties of a <code>ResultSet</code>
671      *  object's columns.
672      *
673      * @return  the description of a <code>ResultSet</code> object's columns
674      * @exception  SQLException if a database access error occurs
675      * @since  1.2
676      */
677     public final ResultSetMetaData getMetaData()
678         throws SQLException {
679         checkIsOpen();
680         return delegate_.getMetaData();
681     }
682 
683 
684     /***
685      *  Executes the SQL query in this <code>PreparedStatement</code> object and
686      *  returns the result set generated by the query.
687      *
688      * @return  a <code>ResultSet</code> object that contains the data produced
689      *      by the query; never <code>null</code>
690      * @exception  SQLException if a database access error occurs
691      */
692     public final ResultSet executeQuery()
693         throws SQLException {
694         checkIsOpen();
695         return wrapResultSet( delegate_.executeQuery() );
696     }
697 
698 
699     /***
700      *  Executes the SQL INSERT, UPDATE or DELETE statement in this <code>PreparedStatement</code>
701      *  object. In addition, SQL statements that return nothing, such as SQL DDL
702      *  statements, can be executed.
703      *
704      * @return  either the row count for INSERT, UPDATE or DELETE statements; or
705      *      0 for SQL statements that return nothing
706      * @exception  SQLException if a database access error occurs
707      */
708     public final int executeUpdate()
709         throws SQLException {
710         checkIsOpen();
711         return delegate_.executeUpdate();
712     }
713 
714 
715     /***
716      *  Clears the current parameter values immediately. <P>
717      *
718      *  In general, parameter values remain in force for repeated use of a
719      *  statement. Setting a parameter value automatically clears its previous
720      *  value. However, in some cases it is useful to immediately release the
721      *  resources used by the current parameter values; this can be done by
722      *  calling the method <code>clearParameters</code>.
723      *
724      * @exception  SQLException if a database access error occurs
725      */
726     public final void clearParameters()
727         throws SQLException {
728         checkIsOpen();
729         delegate_.clearParameters();
730     }
731 
732 
733     /***
734      *  Executes any kind of SQL statement. Some prepared statements return
735      *  multiple results; the <code>execute</code> method handles these complex
736      *  statements as well as the simpler form of statements handled by the
737      *  methods <code>executeQuery</code> and <code>executeUpdate</code>.
738      *
739      * @return  Unknown
740      * @exception  SQLException if a database access error occurs
741      */
742     public final boolean execute()
743         throws SQLException {
744         checkIsOpen();
745         return delegate_.execute();
746     }
747 
748     //--------------------------JDBC 2.0-----------------------------
749 
750     /***
751      *  Adds a set of parameters to this <code>PreparedStatement</code> object's
752      *  batch of commands.
753      *
754      * @exception  SQLException if a database access error occurs
755      */
756     public final void addBatch()
757         throws SQLException {
758         checkIsOpen();
759         delegate_.addBatch();
760     }
761 
762 
763     /***
764      * Sets the designated parameter to the given <code>java.net.URL</code> value.
765      * The driver converts this to an SQL <code>DATALINK</code> value
766      * when it sends it to the database.
767      *
768      * @param parameterIndex the first parameter is 1, the second is 2, ...
769      * @param x the <code>java.net.URL</code> object to be set
770      * @exception SQLException if a database access error occurs
771      * @since 1.4
772      */
773     public void setURL(int parameterIndex, java.net.URL x) throws SQLException {
774         checkIsOpen();
775         delegate_.setURL(parameterIndex, x);
776     }
777 
778     /***
779      * Retrieves the number, types and properties of this
780      * <code>PreparedStatement</code> object's parameters.
781      *
782      * @return a <code>ParameterMetaData</code> object that contains information
783      *         about the number, types and properties of this
784      *         <code>PreparedStatement</code> object's parameters
785      * @exception SQLException if a database access error occurs
786      * @see ParameterMetaData
787      * @since 1.4
788      */
789     public ParameterMetaData getParameterMetaData() throws SQLException {
790         checkIsOpen();
791         return delegate_.getParameterMetaData();
792     }
793 }
794 
795 
796 
797