KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > java > sql > PreparedStatement


1 /*
2  * @(#)PreparedStatement.java 1.44 04/05/18
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package java.sql;
9
10 import java.math.BigDecimal JavaDoc;
11 import java.util.Calendar JavaDoc;
12
13 /**
14  * An object that represents a precompiled SQL statement.
15  * <P>A SQL statement is precompiled and stored in a
16  * <code>PreparedStatement</code> object. This object can then be used to
17  * efficiently execute this statement multiple times.
18  *
19  * <P><B>Note:</B> The setter methods (<code>setShort</code>, <code>setString</code>,
20  * and so on) for setting IN parameter values
21  * must specify types that are compatible with the defined SQL type of
22  * the input parameter. For instance, if the IN parameter has SQL type
23  * <code>INTEGER</code>, then the method <code>setInt</code> should be used.
24  *
25  * <p>If arbitrary parameter type conversions are required, the method
26  * <code>setObject</code> should be used with a target SQL type.
27  * <P>
28  * In the following example of setting a parameter, <code>con</code> represents
29  * an active connection:
30  * <PRE>
31  * PreparedStatement pstmt = con.prepareStatement("UPDATE EMPLOYEES
32  * SET SALARY = ? WHERE ID = ?");
33  * pstmt.setBigDecimal(1, 153833.00)
34  * pstmt.setInt(2, 110592)
35  * </PRE>
36  *
37  * @see Connection#prepareStatement
38  * @see ResultSet
39  */

40
41 public interface PreparedStatement extends Statement JavaDoc {
42
43     /**
44      * Executes the SQL query in this <code>PreparedStatement</code> object
45      * and returns the <code>ResultSet</code> object generated by the query.
46      *
47      * @return a <code>ResultSet</code> object that contains the data produced by the
48      * query; never <code>null</code>
49      * @exception SQLException if a database access error occurs or the SQL
50      * statement does not return a <code>ResultSet</code> object
51      */

52     ResultSet JavaDoc executeQuery() throws SQLException JavaDoc;
53
54     /**
55      * Executes the SQL statement in this <code>PreparedStatement</code> object,
56      * which must be an SQL <code>INSERT</code>, <code>UPDATE</code> or
57      * <code>DELETE</code> statement; or an SQL statement that returns nothing,
58      * such as a DDL statement.
59      *
60      * @return either (1) the row count for <code>INSERT</code>, <code>UPDATE</code>,
61      * or <code>DELETE</code> statements
62      * or (2) 0 for SQL statements that return nothing
63      * @exception SQLException if a database access error occurs or the SQL
64      * statement returns a <code>ResultSet</code> object
65      */

66     int executeUpdate() throws SQLException JavaDoc;
67
68     /**
69      * Sets the designated parameter to SQL <code>NULL</code>.
70      *
71      * <P><B>Note:</B> You must specify the parameter's SQL type.
72      *
73      * @param parameterIndex the first parameter is 1, the second is 2, ...
74      * @param sqlType the SQL type code defined in <code>java.sql.Types</code>
75      * @exception SQLException if a database access error occurs
76      */

77     void setNull(int parameterIndex, int sqlType) throws SQLException JavaDoc;
78
79     /**
80      * Sets the designated parameter to the given Java <code>boolean</code> value.
81      * The driver converts this
82      * to an SQL <code>BIT</code> value when it sends it to the database.
83      *
84      * @param parameterIndex the first parameter is 1, the second is 2, ...
85      * @param x the parameter value
86      * @exception SQLException if a database access error occurs
87      */

88     void setBoolean(int parameterIndex, boolean x) throws SQLException JavaDoc;
89
90     /**
91      * Sets the designated parameter to the given Java <code>byte</code> value.
92      * The driver converts this
93      * to an SQL <code>TINYINT</code> value when it sends it to the database.
94      *
95      * @param parameterIndex the first parameter is 1, the second is 2, ...
96      * @param x the parameter value
97      * @exception SQLException if a database access error occurs
98      */

99     void setByte(int parameterIndex, byte x) throws SQLException JavaDoc;
100
101     /**
102      * Sets the designated parameter to the given Java <code>short</code> value.
103      * The driver converts this
104      * to an SQL <code>SMALLINT</code> value when it sends it to the database.
105      *
106      * @param parameterIndex the first parameter is 1, the second is 2, ...
107      * @param x the parameter value
108      * @exception SQLException if a database access error occurs
109      */

110     void setShort(int parameterIndex, short x) throws SQLException JavaDoc;
111
112     /**
113      * Sets the designated parameter to the given Java <code>int</code> value.
114      * The driver converts this
115      * to an SQL <code>INTEGER</code> value when it sends it to the database.
116      *
117      * @param parameterIndex the first parameter is 1, the second is 2, ...
118      * @param x the parameter value
119      * @exception SQLException if a database access error occurs
120      */

121     void setInt(int parameterIndex, int x) throws SQLException JavaDoc;
122
123     /**
124      * Sets the designated parameter to the given Java <code>long</code> value.
125      * The driver converts this
126      * to an SQL <code>BIGINT</code> value when it sends it to the database.
127      *
128      * @param parameterIndex the first parameter is 1, the second is 2, ...
129      * @param x the parameter value
130      * @exception SQLException if a database access error occurs
131      */

132     void setLong(int parameterIndex, long x) throws SQLException JavaDoc;
133
134     /**
135      * Sets the designated parameter to the given Java <code>float</code> value.
136      * The driver converts this
137      * to an SQL <code>FLOAT</code> value when it sends 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     void setFloat(int parameterIndex, float x) throws SQLException JavaDoc;
144
145     /**
146      * Sets the designated parameter to the given Java <code>double</code> value.
147      * The driver converts this
148      * to an SQL <code>DOUBLE</code> value when it sends it to the database.
149      *
150      * @param parameterIndex the first parameter is 1, the second is 2, ...
151      * @param x the parameter value
152      * @exception SQLException if a database access error occurs
153      */

154     void setDouble(int parameterIndex, double x) throws SQLException JavaDoc;
155
156     /**
157      * Sets the designated parameter to the given <code>java.math.BigDecimal</code> value.
158      * The driver converts this to an SQL <code>NUMERIC</code> value when
159      * it sends it to the database.
160      *
161      * @param parameterIndex the first parameter is 1, the second is 2, ...
162      * @param x the parameter value
163      * @exception SQLException if a database access error occurs
164      */

165     void setBigDecimal(int parameterIndex, BigDecimal JavaDoc x) throws SQLException JavaDoc;
166
167     /**
168      * Sets the designated parameter to the given Java <code>String</code> value.
169      * The driver converts this
170      * to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code> value
171      * (depending on the argument's
172      * size relative to the driver's limits on <code>VARCHAR</code> values)
173      * when it sends it to the database.
174      *
175      * @param parameterIndex the first parameter is 1, the second is 2, ...
176      * @param x the parameter value
177      * @exception SQLException if a database access error occurs
178      */

179     void setString(int parameterIndex, String JavaDoc x) throws SQLException JavaDoc;
180
181     /**
182      * Sets the designated parameter to the given Java array of bytes. The driver converts
183      * this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code>
184      * (depending on the argument's size relative to the driver's limits on
185      * <code>VARBINARY</code> values) when it sends it 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     void setBytes(int parameterIndex, byte x[]) throws SQLException JavaDoc;
192
193     /**
194      * Sets the designated parameter to the given <code>java.sql.Date</code> value.
195      * The driver converts this
196      * to an SQL <code>DATE</code> value when it sends it to the database.
197      *
198      * @param parameterIndex the first parameter is 1, the second is 2, ...
199      * @param x the parameter value
200      * @exception SQLException if a database access error occurs
201      */

202     void setDate(int parameterIndex, java.sql.Date JavaDoc x)
203         throws SQLException JavaDoc;
204
205     /**
206      * Sets the designated parameter to the given <code>java.sql.Time</code> value.
207      * The driver converts this
208      * to an SQL <code>TIME</code> value when it sends it to the database.
209      *
210      * @param parameterIndex the first parameter is 1, the second is 2, ...
211      * @param x the parameter value
212      * @exception SQLException if a database access error occurs
213      */

214     void setTime(int parameterIndex, java.sql.Time JavaDoc x)
215         throws SQLException JavaDoc;
216
217     /**
218      * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value.
219      * The driver
220      * converts this to an SQL <code>TIMESTAMP</code> value when it sends it to the
221      * database.
222      *
223      * @param parameterIndex the first parameter is 1, the second is 2, ...
224      * @param x the parameter value
225      * @exception SQLException if a database access error occurs
226      */

227     void setTimestamp(int parameterIndex, java.sql.Timestamp JavaDoc x)
228         throws SQLException JavaDoc;
229
230     /**
231      * Sets the designated parameter to the given input stream, which will have
232      * the specified number of bytes.
233      * When a very large ASCII value is input to a <code>LONGVARCHAR</code>
234      * parameter, it may be more practical to send it via a
235      * <code>java.io.InputStream</code>. Data will be read from the stream
236      * as needed until end-of-file is reached. The JDBC driver will
237      * do any necessary conversion from ASCII to the database char format.
238      *
239      * <P><B>Note:</B> This stream object can either be a standard
240      * Java stream object or your own subclass that implements the
241      * standard interface.
242      *
243      * @param parameterIndex the first parameter is 1, the second is 2, ...
244      * @param x the Java input stream that contains the ASCII parameter value
245      * @param length the number of bytes in the stream
246      * @exception SQLException if a database access error occurs
247      */

248     void setAsciiStream(int parameterIndex, java.io.InputStream JavaDoc x, int length)
249         throws SQLException JavaDoc;
250
251     /**
252      * Sets the designated parameter to the given input stream, which
253      * will have the specified number of bytes. A Unicode character has
254      * two bytes, with the first byte being the high byte, and the second
255      * being the low byte.
256      *
257      * When a very large Unicode value is input to a <code>LONGVARCHAR</code>
258      * parameter, it may be more practical to send it via a
259      * <code>java.io.InputStream</code> object. The data will be read from the
260      * stream as needed until end-of-file is reached. The JDBC driver will
261      * do any necessary conversion from Unicode to the database char format.
262      *
263      * <P><B>Note:</B> This stream object can either be a standard
264      * Java stream object or your own subclass that implements the
265      * standard interface.
266      *
267      * @param parameterIndex the first parameter is 1, the second is 2, ...
268      * @param x a <code>java.io.InputStream</code> object that contains the
269      * Unicode parameter value as two-byte Unicode characters
270      * @param length the number of bytes in the stream
271      * @exception SQLException if a database access error occurs
272      * @deprecated
273      */

274     @Deprecated JavaDoc
275     void setUnicodeStream(int parameterIndex, java.io.InputStream JavaDoc x,
276               int length) throws SQLException JavaDoc;
277
278     /**
279      * Sets the designated parameter to the given input stream, which will have
280      * the specified number of bytes.
281      * When a very large binary value is input to a <code>LONGVARBINARY</code>
282      * parameter, it may be more practical to send it via a
283      * <code>java.io.InputStream</code> object. The data will be read from the
284      * stream as needed until end-of-file is reached.
285      *
286      * <P><B>Note:</B> This stream object can either be a standard
287      * Java stream object or your own subclass that implements the
288      * standard interface.
289      *
290      * @param parameterIndex the first parameter is 1, the second is 2, ...
291      * @param x the java input stream which contains the binary parameter value
292      * @param length the number of bytes in the stream
293      * @exception SQLException if a database access error occurs
294      */

295     void setBinaryStream(int parameterIndex, java.io.InputStream JavaDoc x,
296              int length) throws SQLException JavaDoc;
297
298     /**
299      * Clears the current parameter values immediately.
300      * <P>In general, parameter values remain in force for repeated use of a
301      * statement. Setting a parameter value automatically clears its
302      * previous value. However, in some cases it is useful to immediately
303      * release the resources used by the current parameter values; this can
304      * be done by calling the method <code>clearParameters</code>.
305      *
306      * @exception SQLException if a database access error occurs
307      */

308     void clearParameters() throws SQLException JavaDoc;
309
310     //----------------------------------------------------------------------
311
// Advanced features:
312

313     /**
314      * <p>Sets the value of the designated parameter with the given object. The second
315      * argument must be an object type; for integral values, the
316      * <code>java.lang</code> equivalent objects should be used.
317      *
318      * <p>The given Java object will be converted to the given targetSqlType
319      * before being sent to the database.
320      *
321      * If the object has a custom mapping (is of a class implementing the
322      * interface <code>SQLData</code>),
323      * the JDBC driver should call the method <code>SQLData.writeSQL</code> to
324      * write it to the SQL data stream.
325      * If, on the other hand, the object is of a class implementing
326      * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
327      * or <code>Array</code>, the driver should pass it to the database as a
328      * value of the corresponding SQL type.
329      *
330      * <p>Note that this method may be used to pass database-specific
331      * abstract data types.
332      *
333      * @param parameterIndex the first parameter is 1, the second is 2, ...
334      * @param x the object containing the input parameter value
335      * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
336      * sent to the database. The scale argument may further qualify this type.
337      * @param scale for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
338      * this is the number of digits after the decimal point. For all other
339      * types, this value will be ignored.
340      * @exception SQLException if a database access error occurs
341      * @see Types
342      */

343     void setObject(int parameterIndex, Object JavaDoc x, int targetSqlType, int scale)
344             throws SQLException JavaDoc;
345
346    /**
347     * Sets the value of the designated parameter with the given object.
348     * This method is like the method <code>setObject</code>
349     * above, except that it assumes a scale of zero.
350     *
351     * @param parameterIndex the first parameter is 1, the second is 2, ...
352     * @param x the object containing the input parameter value
353     * @param targetSqlType the SQL type (as defined in java.sql.Types) to be
354     * sent to the database
355     * @exception SQLException if a database access error occurs
356     */

357     void setObject(int parameterIndex, Object JavaDoc x, int targetSqlType)
358       throws SQLException JavaDoc;
359
360     /**
361      * <p>Sets the value of the designated parameter using the given object.
362      * The second parameter must be of type <code>Object</code>; therefore, the
363      * <code>java.lang</code> equivalent objects should be used for built-in types.
364      *
365      * <p>The JDBC specification specifies a standard mapping from
366      * Java <code>Object</code> types to SQL types. The given argument
367      * will be converted to the corresponding SQL type before being
368      * sent to the database.
369      *
370      * <p>Note that this method may be used to pass datatabase-
371      * specific abstract data types, by using a driver-specific Java
372      * type.
373      *
374      * If the object is of a class implementing the interface <code>SQLData</code>,
375      * the JDBC driver should call the method <code>SQLData.writeSQL</code>
376      * to write it to the SQL data stream.
377      * If, on the other hand, the object is of a class implementing
378      * <code>Ref</code>, <code>Blob</code>, <code>Clob</code>, <code>Struct</code>,
379      * or <code>Array</code>, the driver should pass it to the database as a
380      * value of the corresponding SQL type.
381      * <P>
382      * This method throws an exception if there is an ambiguity, for example, if the
383      * object is of a class implementing more than one of the interfaces named above.
384      *
385      * @param parameterIndex the first parameter is 1, the second is 2, ...
386      * @param x the object containing the input parameter value
387      * @exception SQLException if a database access error occurs or the type
388      * of the given object is ambiguous
389      */

390     void setObject(int parameterIndex, Object JavaDoc x) throws SQLException JavaDoc;
391
392     /**
393      * Executes the SQL statement in this <code>PreparedStatement</code> object,
394      * which may be any kind of SQL statement.
395      * Some prepared statements return multiple results; the <code>execute</code>
396      * method handles these complex statements as well as the simpler
397      * form of statements handled by the methods <code>executeQuery</code>
398      * and <code>executeUpdate</code>.
399      * <P>
400      * The <code>execute</code> method returns a <code>boolean</code> to
401      * indicate the form of the first result. You must call either the method
402      * <code>getResultSet</code> or <code>getUpdateCount</code>
403      * to retrieve the result; you must call <code>getMoreResults</code> to
404      * move to any subsequent result(s).
405      *
406      * @return <code>true</code> if the first result is a <code>ResultSet</code>
407      * object; <code>false</code> if the first result is an update
408      * count or there is no result
409      * @exception SQLException if a database access error occurs or an argument
410      * is supplied to this method
411      * @see Statement#execute
412      * @see Statement#getResultSet
413      * @see Statement#getUpdateCount
414      * @see Statement#getMoreResults
415
416      */

417     boolean execute() throws SQLException JavaDoc;
418
419     //--------------------------JDBC 2.0-----------------------------
420

421     /**
422      * Adds a set of parameters to this <code>PreparedStatement</code>
423      * object's batch of commands.
424      *
425      * @exception SQLException if a database access error occurs
426      * @see Statement#addBatch
427      * @since 1.2
428      */

429     void addBatch() throws SQLException JavaDoc;
430
431     /**
432      * Sets the designated parameter to the given <code>Reader</code>
433      * object, which is the given number of characters long.
434      * When a very large UNICODE value is input to a <code>LONGVARCHAR</code>
435      * parameter, it may be more practical to send it via a
436      * <code>java.io.Reader</code> object. The data will be read from the stream
437      * as needed until end-of-file is reached. The JDBC driver will
438      * do any necessary conversion from UNICODE to the database char format.
439      *
440      * <P><B>Note:</B> This stream object can either be a standard
441      * Java stream object or your own subclass that implements the
442      * standard interface.
443      *
444      * @param parameterIndex the first parameter is 1, the second is 2, ...
445      * @param reader the <code>java.io.Reader</code> object that contains the
446      * Unicode data
447      * @param length the number of characters in the stream
448      * @exception SQLException if a database access error occurs
449      * @since 1.2
450      */

451     void setCharacterStream(int parameterIndex,
452                   java.io.Reader JavaDoc reader,
453               int length) throws SQLException JavaDoc;
454
455     /**
456      * Sets the designated parameter to the given
457      * <code>REF(&lt;structured-type&gt;)</code> value.
458      * The driver converts this to an SQL <code>REF</code> value when it
459      * sends it to the database.
460      *
461      * @param i the first parameter is 1, the second is 2, ...
462      * @param x an SQL <code>REF</code> value
463      * @exception SQLException if a database access error occurs
464      * @since 1.2
465      */

466     void setRef (int i, Ref JavaDoc x) throws SQLException JavaDoc;
467
468     /**
469      * Sets the designated parameter to the given <code>Blob</code> object.
470      * The driver converts this to an SQL <code>BLOB</code> value when it
471      * sends it to the database.
472      *
473      * @param i the first parameter is 1, the second is 2, ...
474      * @param x a <code>Blob</code> object that maps an SQL <code>BLOB</code> value
475      * @exception SQLException if a database access error occurs
476      * @since 1.2
477      */

478     void setBlob (int i, Blob JavaDoc x) throws SQLException JavaDoc;
479
480     /**
481      * Sets the designated parameter to the given <code>Clob</code> object.
482      * The driver converts this to an SQL <code>CLOB</code> value when it
483      * sends it to the database.
484      *
485      * @param i the first parameter is 1, the second is 2, ...
486      * @param x a <code>Clob</code> object that maps an SQL <code>CLOB</code> value
487      * @exception SQLException if a database access error occurs
488      * @since 1.2
489      */

490     void setClob (int i, Clob JavaDoc x) throws SQLException JavaDoc;
491
492     /**
493      * Sets the designated parameter to the given <code>Array</code> object.
494      * The driver converts this to an SQL <code>ARRAY</code> value when it
495      * sends it to the database.
496      *
497      * @param i the first parameter is 1, the second is 2, ...
498      * @param x an <code>Array</code> object that maps an SQL <code>ARRAY</code> value
499      * @exception SQLException if a database access error occurs
500      * @since 1.2
501      */

502     void setArray (int i, Array JavaDoc x) throws SQLException JavaDoc;
503
504     /**
505      * Retrieves a <code>ResultSetMetaData</code> object that contains
506      * information about the columns of the <code>ResultSet</code> object
507      * that will be returned when this <code>PreparedStatement</code> object
508      * is executed.
509      * <P>
510      * Because a <code>PreparedStatement</code> object is precompiled, it is
511      * possible to know about the <code>ResultSet</code> object that it will
512      * return without having to execute it. Consequently, it is possible
513      * to invoke the method <code>getMetaData</code> on a
514      * <code>PreparedStatement</code> object rather than waiting to execute
515      * it and then invoking the <code>ResultSet.getMetaData</code> method
516      * on the <code>ResultSet</code> object that is returned.
517      * <P>
518      * <B>NOTE:</B> Using this method may be expensive for some drivers due
519      * to the lack of underlying DBMS support.
520      *
521      * @return the description of a <code>ResultSet</code> object's columns or
522      * <code>null</code> if the driver cannot return a
523      * <code>ResultSetMetaData</code> object
524      * @exception SQLException if a database access error occurs
525      * @since 1.2
526      */

527     ResultSetMetaData JavaDoc getMetaData() throws SQLException JavaDoc;
528
529     /**
530      * Sets the designated parameter to the given <code>java.sql.Date</code> value,
531      * using the given <code>Calendar</code> object. The driver uses
532      * the <code>Calendar</code> object to construct an SQL <code>DATE</code> value,
533      * which the driver then sends to the database. With
534      * a <code>Calendar</code> object, the driver can calculate the date
535      * taking into account a custom timezone. If no
536      * <code>Calendar</code> object is specified, the driver uses the default
537      * timezone, which is that of the virtual machine running the application.
538      *
539      * @param parameterIndex the first parameter is 1, the second is 2, ...
540      * @param x the parameter value
541      * @param cal the <code>Calendar</code> object the driver will use
542      * to construct the date
543      * @exception SQLException if a database access error occurs
544      * @since 1.2
545      */

546     void setDate(int parameterIndex, java.sql.Date JavaDoc x, Calendar JavaDoc cal)
547         throws SQLException JavaDoc;
548
549     /**
550      * Sets the designated parameter to the given <code>java.sql.Time</code> value,
551      * using the given <code>Calendar</code> object. The driver uses
552      * the <code>Calendar</code> object to construct an SQL <code>TIME</code> value,
553      * which the driver then sends to the database. With
554      * a <code>Calendar</code> object, the driver can calculate the time
555      * taking into account a custom timezone. If no
556      * <code>Calendar</code> object is specified, the driver uses the default
557      * timezone, which is that of the virtual machine running the application.
558      *
559      * @param parameterIndex the first parameter is 1, the second is 2, ...
560      * @param x the parameter value
561      * @param cal the <code>Calendar</code> object the driver will use
562      * to construct the time
563      * @exception SQLException if a database access error occurs
564      * @since 1.2
565      */

566     void setTime(int parameterIndex, java.sql.Time JavaDoc x, Calendar JavaDoc cal)
567         throws SQLException JavaDoc;
568
569     /**
570      * Sets the designated parameter to the given <code>java.sql.Timestamp</code> value,
571      * using the given <code>Calendar</code> object. The driver uses
572      * the <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code> value,
573      * which the driver then sends to the database. With a
574      * <code>Calendar</code> object, the driver can calculate the timestamp
575      * taking into account a custom timezone. If no
576      * <code>Calendar</code> object is specified, the driver uses the default
577      * timezone, which is that of the virtual machine running the application.
578      *
579      * @param parameterIndex the first parameter is 1, the second is 2, ...
580      * @param x the parameter value
581      * @param cal the <code>Calendar</code> object the driver will use
582      * to construct the timestamp
583      * @exception SQLException if a database access error occurs
584      * @since 1.2
585      */

586     void setTimestamp(int parameterIndex, java.sql.Timestamp JavaDoc x, Calendar JavaDoc cal)
587         throws SQLException JavaDoc;
588
589     /**
590      * Sets the designated parameter to SQL <code>NULL</code>.
591      * This version of the method <code>setNull</code> should
592      * be used for user-defined types and REF type parameters. Examples
593      * of user-defined types include: STRUCT, DISTINCT, JAVA_OBJECT, and
594      * named array types.
595      *
596      * <P><B>Note:</B> To be portable, applications must give the
597      * SQL type code and the fully-qualified SQL type name when specifying
598      * a NULL user-defined or REF parameter. In the case of a user-defined type
599      * the name is the type name of the parameter itself. For a REF
600      * parameter, the name is the type name of the referenced type. If
601      * a JDBC driver does not need the type code or type name information,
602      * it may ignore it.
603      *
604      * Although it is intended for user-defined and Ref parameters,
605      * this method may be used to set a null parameter of any JDBC type.
606      * If the parameter does not have a user-defined or REF type, the given
607      * typeName is ignored.
608      *
609      *
610      * @param paramIndex the first parameter is 1, the second is 2, ...
611      * @param sqlType a value from <code>java.sql.Types</code>
612      * @param typeName the fully-qualified name of an SQL user-defined type;
613      * ignored if the parameter is not a user-defined type or REF
614      * @exception SQLException if a database access error occurs
615      * @since 1.2
616      */

617   void setNull (int paramIndex, int sqlType, String JavaDoc typeName)
618     throws SQLException JavaDoc;
619
620     //------------------------- JDBC 3.0 -----------------------------------
621

622     /**
623      * Sets the designated parameter to the given <code>java.net.URL</code> value.
624      * The driver converts this to an SQL <code>DATALINK</code> value
625      * when it sends it to the database.
626      *
627      * @param parameterIndex the first parameter is 1, the second is 2, ...
628      * @param x the <code>java.net.URL</code> object to be set
629      * @exception SQLException if a database access error occurs
630      * @since 1.4
631      */

632     void setURL(int parameterIndex, java.net.URL JavaDoc x) throws SQLException JavaDoc;
633
634     /**
635      * Retrieves the number, types and properties of this
636      * <code>PreparedStatement</code> object's parameters.
637      *
638      * @return a <code>ParameterMetaData</code> object that contains information
639      * about the number, types and properties of this
640      * <code>PreparedStatement</code> object's parameters
641      * @exception SQLException if a database access error occurs
642      * @see ParameterMetaData
643      * @since 1.4
644      */

645     ParameterMetaData JavaDoc getParameterMetaData() throws SQLException JavaDoc;
646
647 }
648
Popular Tags