KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > genimen > djeneric > jdbc > DjPreparedStatement


1 /*
2  * Copyright (c) 2001-2005 by Genimen BV (www.genimen.com) All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, is permitted provided that the following conditions are met: -
6  * Redistributions of source code must retain the above copyright notice, this
7  * list of conditions and the following disclaimer. - Redistributions in binary
8  * form must reproduce the above copyright notice, this list of conditions and
9  * the following disclaimer in the documentation and/or other materials
10  * provided with the distribution. - All advertising materials mentioning
11  * features or use of this software must display the following acknowledgment:
12  * "This product includes Djeneric." - Products derived from this software may
13  * not be called "Djeneric" nor may "Djeneric" appear in their names without
14  * prior written permission of Genimen BV. - Redistributions of any form
15  * whatsoever must retain the following acknowledgment: "This product includes
16  * Djeneric."
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS "AS IS"
19  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21  * ARE DISCLAIMED. IN NO EVENT SHALL GENIMEN BV, DJENERIC.ORG, OR CONTRIBUTORS
22  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
23  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28  * POSSIBILITY OF SUCH DAMAGE.
29  */

30
31 package com.genimen.djeneric.jdbc;
32
33 import java.math.BigDecimal JavaDoc;
34 import java.net.URL JavaDoc;
35 import java.sql.Array JavaDoc;
36 import java.sql.Blob JavaDoc;
37 import java.sql.Clob JavaDoc;
38 import java.sql.Connection JavaDoc;
39 import java.sql.DriverManager JavaDoc;
40 import java.sql.ParameterMetaData JavaDoc;
41 import java.sql.PreparedStatement JavaDoc;
42 import java.sql.Ref JavaDoc;
43 import java.sql.ResultSet JavaDoc;
44 import java.sql.ResultSetMetaData JavaDoc;
45 import java.sql.SQLException JavaDoc;
46 import java.sql.SQLWarning JavaDoc;
47 import java.util.Calendar JavaDoc;
48
49 import com.genimen.djeneric.repository.exceptions.DjenericException;
50 import com.genimen.djeneric.repository.rdbms.RdbmsSession;
51 import com.genimen.djeneric.repository.rdbms.SqlStatement;
52
53 /**
54  * @author Gert Rijs
55  * @version 1.0
56  */

57
58 public class DjPreparedStatement implements PreparedStatement JavaDoc
59 {
60   private static final String JavaDoc CLASSNAME = DjPreparedStatement.class.getName();
61   private DjConnection _connection = null;
62   private SqlStatement _underlyingSqlStatement = null;
63
64   private String JavaDoc _originalSqlStatement = null; // select * from supplyers
65
private String JavaDoc _polymorphStatement = null; // select * from polymorph where
66

67   // table_type = 'supp'
68

69   public DjPreparedStatement(DjConnection p_con, String JavaDoc p_sql) throws SQLException JavaDoc
70   {
71     this(p_con, p_sql, 0, ResultSet.CONCUR_READ_ONLY);
72   }
73
74   public DjPreparedStatement(DjConnection p_con, String JavaDoc p_sql, int resultSetType, int resultSetConcurrency)
75       throws SQLException JavaDoc
76   {
77     if (resultSetConcurrency != ResultSet.CONCUR_READ_ONLY) throw new SQLException JavaDoc(
78         "djeneric jdbc-driver can only handle SELECT statements");
79     _connection = p_con;
80     _originalSqlStatement = p_sql;
81     _polymorphStatement = _connection.translateSqlToPolymorph(p_sql);
82     DriverManager.println("original sql : " + _originalSqlStatement);
83     DriverManager.println("translated to sql: " + _polymorphStatement);
84     if (_polymorphStatement.toLowerCase().trim().startsWith("select ") == false) throw new SQLException JavaDoc(
85         "djeneric jdbc-driver can only handle SELECT statements");
86
87     try
88     {
89       RdbmsSession s = (RdbmsSession) _connection.getPersistenceManager().createSession();
90       _underlyingSqlStatement = s.getInternalSqlStatement(_polymorphStatement);
91     }
92     catch (DjenericException de)
93     {
94       throw new SQLException JavaDoc(de.toString());
95     }
96   }
97
98   /**
99    * Executes the SQL query in this <code>PreparedStatement</code> object and
100    * returns the result set generated by the query.
101    *
102    * @return a <code>ResultSet</code> object that contains the data produced
103    * by the query; never <code>null</code>
104    * @exception SQLException
105    * if a database access error occurs
106    */

107   public ResultSet JavaDoc executeQuery() throws SQLException JavaDoc
108   {
109     return _underlyingSqlStatement.executeQuery();
110   }
111
112   /**
113    * Executes the SQL INSERT, UPDATE or DELETE statement in this <code>PreparedStatement</code>
114    * object. In addition, SQL statements that return nothing, such as SQL DDL
115    * statements, can be executed.
116    *
117    * @return either the row count for INSERT, UPDATE or DELETE statements; or 0
118    * for SQL statements that return nothing
119    * @exception SQLException
120    * if a database access error occurs
121    */

122   public int executeUpdate() throws SQLException JavaDoc
123   {
124     throw new SQLException JavaDoc("djeneric jdbc-driver can only handle SELECT statements");
125   }
126
127   /**
128    * Sets the designated parameter to SQL <code>NULL</code>.
129    *
130    * <P>
131    * <B>Note:</B> You must specify the parameter's SQL type.
132    *
133    * @param parameterIndex
134    * the first parameter is 1, the second is 2, ...
135    * @param sqlType
136    * the SQL type code defined in <code>java.sql.Types</code>
137    * @exception SQLException
138    * if a database access error occurs
139    */

140   public void setNull(int parameterIndex, int sqlType) throws SQLException JavaDoc
141   {
142     _underlyingSqlStatement.getStmt().setNull(parameterIndex, sqlType);
143   }
144
145   /**
146    * Sets the designated parameter to a Java <code>boolean</code> value. The
147    * driver converts this to an SQL <code>BIT</code> value when it sends it
148    * to the database.
149    *
150    * @param parameterIndex
151    * the first parameter is 1, the second is 2, ...
152    * @param x
153    * the parameter value
154    * @exception SQLException
155    * if a database access error occurs
156    */

157   public void setBoolean(int parameterIndex, boolean x) throws SQLException JavaDoc
158   {
159     _underlyingSqlStatement.getStmt().setBoolean(parameterIndex, x);
160   }
161
162   /**
163    * Sets the designated parameter to a Java <code>byte</code> value. The
164    * driver converts this to an SQL <code>TINYINT</code> value when it sends
165    * it to the database.
166    *
167    * @param parameterIndex
168    * the first parameter is 1, the second is 2, ...
169    * @param x
170    * the parameter value
171    * @exception SQLException
172    * if a database access error occurs
173    */

174   public void setByte(int parameterIndex, byte x) throws SQLException JavaDoc
175   {
176     _underlyingSqlStatement.getStmt().setByte(parameterIndex, x);
177   }
178
179   /**
180    * Sets the designated parameter to a Java <code>short</code> value. The
181    * driver converts this to an SQL <code>SMALLINT</code> value when it sends
182    * it to the database.
183    *
184    * @param parameterIndex
185    * the first parameter is 1, the second is 2, ...
186    * @param x
187    * the parameter value
188    * @exception SQLException
189    * if a database access error occurs
190    */

191   public void setShort(int parameterIndex, short x) throws SQLException JavaDoc
192   {
193     _underlyingSqlStatement.getStmt().setShort(parameterIndex, x);
194   }
195
196   /**
197    * Sets the designated parameter to a Java <code>int</code> value. The
198    * driver converts this to an SQL <code>INTEGER</code> value when it sends
199    * it to the database.
200    *
201    * @param parameterIndex
202    * the first parameter is 1, the second is 2, ...
203    * @param x
204    * the parameter value
205    * @exception SQLException
206    * if a database access error occurs
207    */

208   public void setInt(int parameterIndex, int x) throws SQLException JavaDoc
209   {
210     _underlyingSqlStatement.getStmt().setInt(parameterIndex, x);
211   }
212
213   /**
214    * Sets the designated parameter to a Java <code>long</code> value. The
215    * driver converts this to an SQL <code>BIGINT</code> value when it sends
216    * it to the database.
217    *
218    * @param parameterIndex
219    * the first parameter is 1, the second is 2, ...
220    * @param x
221    * the parameter value
222    * @exception SQLException
223    * if a database access error occurs
224    */

225   public void setLong(int parameterIndex, long x) throws SQLException JavaDoc
226   {
227     _underlyingSqlStatement.getStmt().setLong(parameterIndex, x);
228   }
229
230   /**
231    * Sets the designated parameter to a Java <code>float</code> value. The
232    * driver converts this to an SQL <code>FLOAT</code> value when it sends it
233    * to the database.
234    *
235    * @param parameterIndex
236    * the first parameter is 1, the second is 2, ...
237    * @param x
238    * the parameter value
239    * @exception SQLException
240    * if a database access error occurs
241    */

242   public void setFloat(int parameterIndex, float x) throws SQLException JavaDoc
243   {
244     _underlyingSqlStatement.getStmt().setFloat(parameterIndex, x);
245   }
246
247   /**
248    * Sets the designated parameter to a Java <code>double</code> value. The
249    * driver converts this to an SQL <code>DOUBLE</code> value when it sends
250    * it to the database.
251    *
252    * @param parameterIndex
253    * the first parameter is 1, the second is 2, ...
254    * @param x
255    * the parameter value
256    * @exception SQLException
257    * if a database access error occurs
258    */

259   public void setDouble(int parameterIndex, double x) throws SQLException JavaDoc
260   {
261     _underlyingSqlStatement.getStmt().setDouble(parameterIndex, x);
262   }
263
264   /**
265    * Sets the designated parameter to a <code>java.math.BigDecimal</code>
266    * value. The driver converts this to an SQL <code>NUMERIC</code> value
267    * when it sends it to the database.
268    *
269    * @param parameterIndex
270    * the first parameter is 1, the second is 2, ...
271    * @param x
272    * the parameter value
273    * @exception SQLException
274    * if a database access error occurs
275    */

276   public void setBigDecimal(int parameterIndex, BigDecimal JavaDoc x) throws SQLException JavaDoc
277   {
278     _underlyingSqlStatement.getStmt().setBigDecimal(parameterIndex, x);
279   }
280
281   /**
282    * Sets the designated parameter to a Java <code>String</code> value. The
283    * driver converts this to an SQL <code>VARCHAR</code> or <code>LONGVARCHAR</code>
284    * value (depending on the argument's size relative to the driver's limits on
285    * <code>VARCHAR</code> values) when it sends it to the database.
286    *
287    * @param parameterIndex
288    * the first parameter is 1, the second is 2, ...
289    * @param x
290    * the parameter value
291    * @exception SQLException
292    * if a database access error occurs
293    */

294   public void setString(int parameterIndex, String JavaDoc x) throws SQLException JavaDoc
295   {
296     _underlyingSqlStatement.getStmt().setString(parameterIndex, x);
297   }
298
299   /**
300    * Sets the designated parameter to a Java array of bytes. The driver
301    * converts this to an SQL <code>VARBINARY</code> or <code>LONGVARBINARY</code>
302    * (depending on the argument's size relative to the driver's limits on
303    * <code>VARBINARY</code> values) when it sends it to the database.
304    *
305    * @param parameterIndex
306    * the first parameter is 1, the second is 2, ...
307    * @param x
308    * the parameter value
309    * @exception SQLException
310    * if a database access error occurs
311    */

312   public void setBytes(int parameterIndex, byte x[]) throws SQLException JavaDoc
313   {
314     _underlyingSqlStatement.getStmt().setBytes(parameterIndex, x);
315   }
316
317   /**
318    * Sets the designated parameter to a <code<java.sql.Date</code> value.
319    * * The driver converts this
320    * to an SQL <code>DATE</code> value when it sends it to the database.
321    * *
322    * @param parameterIndex the first parameter is 1, the second is 2, ...
323    * @param x the parameter value
324    * @exception SQLException if a database access error occurs
325    */

326   public void setDate(int parameterIndex, java.sql.Date JavaDoc x) throws SQLException JavaDoc
327   {
328     _underlyingSqlStatement.getStmt().setDate(parameterIndex, x);
329   }
330
331   /**
332    * Sets the designated parameter to a <code>java.sql.Time</code> value. The
333    * driver converts this to an SQL <code>TIME</code> value when it sends it
334    * to the database.
335    *
336    * @param parameterIndex
337    * the first parameter is 1, the second is 2, ...
338    * @param x
339    * the parameter value
340    * @exception SQLException
341    * if a database access error occurs
342    */

343   public void setTime(int parameterIndex, java.sql.Time JavaDoc x) throws SQLException JavaDoc
344   {
345     _underlyingSqlStatement.getStmt().setTime(parameterIndex, x);
346   }
347
348   /**
349    * Sets the designated parameter to a <code>java.sql.Timestamp</code>
350    * value. The driver converts this to an SQL <code>TIMESTAMP</code> value
351    * when it sends it to the database.
352    *
353    * @param parameterIndex
354    * the first parameter is 1, the second is 2, ...
355    * @param x
356    * the parameter value
357    * @exception SQLException
358    * if a database access error occurs
359    */

360   public void setTimestamp(int parameterIndex, java.sql.Timestamp JavaDoc x) throws SQLException JavaDoc
361   {
362     _underlyingSqlStatement.getStmt().setTimestamp(parameterIndex, x);
363   }
364
365   /**
366    * Sets the designated parameter to the given input stream, which will have
367    * the specified number of bytes. When a very large ASCII value is input to a
368    * <code>LONGVARCHAR</code> parameter, it may be more practical to send it
369    * via a <code>java.io.InputStream</code>. Data will be read from the
370    * stream as needed until end-of-file is reached. The JDBC driver will do any
371    * necessary conversion from ASCII to the database char format.
372    *
373    * <P>
374    * <B>Note:</B> This stream object can either be a standard Java stream
375    * object or your own subclass that implements the standard interface.
376    *
377    * @param parameterIndex
378    * the first parameter is 1, the second is 2, ...
379    * @param x
380    * the Java input stream that contains the ASCII parameter value
381    * @param length
382    * the number of bytes in the stream
383    * @exception SQLException
384    * if a database access error occurs
385    */

386   public void setAsciiStream(int parameterIndex, java.io.InputStream JavaDoc x, int length) throws SQLException JavaDoc
387   {
388     _underlyingSqlStatement.getStmt().setAsciiStream(parameterIndex, x, length);
389   }
390
391   /**
392    * Sets the designated parameter to the given input stream, which will have
393    * the specified number of bytes. When a very large UNICODE value is input to
394    * a <code>LONGVARCHAR</code> parameter, it may be more practical to send
395    * it via a <code>java.io.InputStream</code> object. The data will be read
396    * from the stream as needed until end-of-file is reached. The JDBC driver
397    * will do any necessary conversion from UNICODE to the database char format.
398    * The byte format of the Unicode stream must be Java UTF-8, as defined in
399    * the Java Virtual Machine Specification.
400    *
401    * <P>
402    * <B>Note:</B> This stream object can either be a standard Java stream
403    * object or your own subclass that implements the standard interface.
404    *
405    * @param parameterIndex
406    * the first parameter is 1, the second is 2, ...
407    * @param x
408    * the java input stream which contains the UNICODE parameter
409    * value
410    * @param length
411    * the number of bytes in the stream
412    * @exception SQLException
413    * if a database access error occurs
414    * @deprecated
415    */

416   public void setUnicodeStream(int parameterIndex, java.io.InputStream JavaDoc x, int length) throws SQLException JavaDoc
417   {
418     _underlyingSqlStatement.getStmt().setUnicodeStream(parameterIndex, x, length);
419   }
420
421   /**
422    * Sets the designated parameter to the given input stream, which will have
423    * the specified number of bytes. When a very large binary value is input to
424    * a <code>LONGVARBINARY</code> parameter, it may be more practical to send
425    * it via a <code>java.io.InputStream</code> object. The data will be read
426    * from the stream as needed until end-of-file is reached.
427    *
428    * <P>
429    * <B>Note:</B> This stream object can either be a standard Java stream
430    * object or your own subclass that implements the standard interface.
431    *
432    * @param parameterIndex
433    * the first parameter is 1, the second is 2, ...
434    * @param x
435    * the java input stream which contains the binary parameter value
436    * @param length
437    * the number of bytes in the stream
438    * @exception SQLException
439    * if a database access error occurs
440    */

441   public void setBinaryStream(int parameterIndex, java.io.InputStream JavaDoc x, int length) throws SQLException JavaDoc
442   {
443     _underlyingSqlStatement.getStmt().setBinaryStream(parameterIndex, x, length);
444   }
445
446   /**
447    * Clears the current parameter values immediately.
448    * <P>
449    * In general, parameter values remain in force for repeated use of a
450    * statement. Setting a parameter value automatically clears its previous
451    * value. However, in some cases it is useful to immediately release the
452    * resources used by the current parameter values; this can be done by
453    * calling the method <code>clearParameters</code>.
454    *
455    * @exception SQLException
456    * if a database access error occurs
457    */

458   public void clearParameters() throws SQLException JavaDoc
459   {
460     _underlyingSqlStatement.getStmt().clearParameters();
461   }
462
463   //----------------------------------------------------------------------
464
// Advanced features:
465

466   /**
467    * <p>
468    * Sets the value of the designated parameter with the given object. The
469    * second argument must be an object type; for integral values, the <code>java.lang</code>
470    * equivalent objects should be used.
471    *
472    * <p>
473    * The given Java object will be converted to the given targetSqlType before
474    * being sent to the database.
475    *
476    * If the object has a custom mapping (is of a class implementing the
477    * interface <code>SQLData</code>), the JDBC driver should call the method
478    * <code>SQLData.writeSQL</code> to write it to the SQL data stream. If, on
479    * the other hand, the object is of a class implementing Ref, Blob, Clob,
480    * Struct, or Array, the driver should pass it to the database as a value of
481    * the corresponding SQL type.
482    *
483    * <p>
484    * Note that this method may be used to pass datatabase- specific abstract
485    * data types.
486    *
487    * @param parameterIndex
488    * the first parameter is 1, the second is 2, ...
489    * @param x
490    * the object containing the input parameter value
491    * @param targetSqlType
492    * the SQL type (as defined in java.sql.Types) to be sent to the
493    * database. The scale argument may further qualify this type.
494    * @param scale
495    * for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,
496    * this is the number of digits after the decimal point. For all
497    * other types, this value will be ignored.
498    * @exception SQLException
499    * if a database access error occurs
500    * @see Types
501    */

502   public void setObject(int parameterIndex, Object JavaDoc x, int targetSqlType, int scale) throws SQLException JavaDoc
503   {
504     _underlyingSqlStatement.getStmt().setObject(parameterIndex, x, targetSqlType, scale);
505   }
506
507   /**
508    * Sets the value of the designated parameter with the given object. This
509    * method is like the method <code>setObject</code> above, except that it
510    * assumes a scale of zero.
511    *
512    * @param parameterIndex
513    * the first parameter is 1, the second is 2, ...
514    * @param x
515    * the object containing the input parameter value
516    * @param targetSqlType
517    * the SQL type (as defined in java.sql.Types) to be sent to the
518    * database
519    * @exception SQLException
520    * if a database access error occurs
521    */

522   public void setObject(int parameterIndex, Object JavaDoc x, int targetSqlType) throws SQLException JavaDoc
523   {
524     _underlyingSqlStatement.getStmt().setObject(parameterIndex, x, targetSqlType);
525   }
526
527   /**
528    * <p>
529    * Sets the value of the designated parameter using the given object. The
530    * second parameter must be of type <code>Object</code>; therefore, the
531    * <code>java.lang</code> equivalent objects should be used for built-in
532    * types.
533    *
534    * <p>
535    * The JDBC specification specifies a standard mapping from Java <code>Object</code>
536    * types to SQL types. The given argument will be converted to the
537    * corresponding SQL type before being sent to the database.
538    *
539    * <p>
540    * Note that this method may be used to pass datatabase- specific abstract
541    * data types, by using a driver-specific Java type.
542    *
543    * If the object is of a class implementing the interface <code>SQLData</code>,
544    * the JDBC driver should call the method <code>SQLData.writeSQL</code> to
545    * write it to the SQL data stream. If, on the other hand, the object is of a
546    * class implementing Ref, Blob, Clob, Struct, or Array, then the driver
547    * should pass it to the database as a value of the corresponding SQL type.
548    *
549    * This method throws an exception if there is an ambiguity, for example, if
550    * the object is of a class implementing more than one of the interfaces
551    * named above.
552    *
553    * @param parameterIndex
554    * the first parameter is 1, the second is 2, ...
555    * @param x
556    * the object containing the input parameter value
557    * @exception SQLException
558    * if a database access error occurs
559    */

560   public void setObject(int parameterIndex, Object JavaDoc x) throws SQLException JavaDoc
561   {
562     _underlyingSqlStatement.getStmt().setObject(parameterIndex, x);
563   }
564
565   /**
566    * Executes any kind of SQL statement. Some prepared statements return
567    * multiple results; the <code>execute</code> method handles these complex
568    * statements as well as the simpler form of statements handled by the
569    * methods <code>executeQuery</code> and <code>executeUpdate</code>.
570    *
571    * @exception SQLException
572    * if a database access error occurs
573    * @see Statement#execute
574    */

575   public boolean execute() throws SQLException JavaDoc
576   {
577     throw new SQLException JavaDoc("ps.execute: this method is not implemented by the djeneric driver");
578   }
579
580   //--------------------------JDBC 2.0-----------------------------
581

582   /**
583    * Adds a set of parameters to this <code>PreparedStatement</code> object's
584    * batch of commands.
585    *
586    * @exception SQLException
587    * if a database access error occurs
588    * @see Statement#addBatch
589    * @since 1.2
590    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
591    * </a>
592    */

593   public void addBatch() throws SQLException JavaDoc
594   {
595     throw new SQLException JavaDoc("ps.addBatch: this method is not implemented by the djeneric driver");
596   }
597
598   /**
599    * Sets the designated parameter to the given <code>Reader</code> object,
600    * which is the given number of characters long. When a very large UNICODE
601    * value is input to a <code>LONGVARCHAR</code> parameter, it may be more
602    * practical to send it via a <code>java.io.Reader</code> object. The data
603    * will be read from the stream as needed until end-of-file is reached. The
604    * JDBC driver will do any necessary conversion from UNICODE to the database
605    * char format.
606    *
607    * <P>
608    * <B>Note:</B> This stream object can either be a standard Java stream
609    * object or your own subclass that implements the standard interface.
610    *
611    * @param parameterIndex
612    * the first parameter is 1, the second is 2, ...
613    * @param x
614    * the java reader which contains the UNICODE data
615    * @param length
616    * the number of characters in the stream
617    * @exception SQLException
618    * if a database access error occurs
619    * @since 1.2
620    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
621    * </a>
622    */

623   public void setCharacterStream(int parameterIndex, java.io.Reader JavaDoc reader, int length) throws SQLException JavaDoc
624   {
625     _underlyingSqlStatement.getStmt().setCharacterStream(parameterIndex, reader, length);
626   }
627
628   /**
629    * Sets the designated parameter to the given <code>REF(&lt;structured-type&gt;)</code>
630    * value.
631    *
632    * @param i
633    * the first parameter is 1, the second is 2, ...
634    * @param x
635    * an SQL <code>REF</code> value
636    * @exception SQLException
637    * if a database access error occurs
638    * @since 1.2
639    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
640    * </a>
641    */

642   public void setRef(int i, Ref JavaDoc x) throws SQLException JavaDoc
643   {
644     _underlyingSqlStatement.getStmt().setRef(i, x);
645   }
646
647   /**
648    * Sets the designated parameter to the given <code>Blob</code> object.
649    *
650    * @param i
651    * the first parameter is 1, the second is 2, ...
652    * @param x
653    * a <code>Blob</code> object that maps an SQL <code>BLOB</code>
654    * value
655    * @exception SQLException
656    * if a database access error occurs
657    * @since 1.2
658    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
659    * </a>
660    */

661   public void setBlob(int i, Blob JavaDoc x) throws SQLException JavaDoc
662   {
663     _underlyingSqlStatement.getStmt().setBlob(i, x);
664   }
665
666   /**
667    * Sets the designated parameter to the given <code>Clob</code> object.
668    *
669    * @param i
670    * the first parameter is 1, the second is 2, ...
671    * @param x
672    * a <code>Clob</code> object that maps an SQL <code>CLOB</code>
673    * value
674    * @exception SQLException
675    * if a database access error occurs
676    * @since 1.2
677    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
678    * </a>
679    */

680   public void setClob(int i, Clob JavaDoc x) throws SQLException JavaDoc
681   {
682     _underlyingSqlStatement.getStmt().setClob(i, x);
683   }
684
685   /**
686    * Sets the designated parameter to the given <code>Array</code> object.
687    * Sets an Array parameter.
688    *
689    * @param i
690    * the first parameter is 1, the second is 2, ...
691    * @param x
692    * an <code>Array</code> object that maps an SQL <code>ARRAY</code>
693    * value
694    * @exception SQLException
695    * if a database access error occurs
696    * @since 1.2
697    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
698    * </a>
699    */

700   public void setArray(int i, Array JavaDoc x) throws SQLException JavaDoc
701   {
702     _underlyingSqlStatement.getStmt().setArray(i, x);
703   }
704
705   /**
706    * Gets the number, types and properties of a <code>ResultSet</code>
707    * object's columns.
708    *
709    * @return the description of a <code>ResultSet</code> object's columns
710    * @exception SQLException
711    * if a database access error occurs
712    * @since 1.2
713    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
714    * </a>
715    */

716   public ResultSetMetaData JavaDoc getMetaData() throws SQLException JavaDoc
717   {
718     /** @todo: nog iomplementeren" */
719     return null;
720   }
721
722   /**
723    * Sets the designated parameter to the given <code>java.sql.Date</code>
724    * value, using the given <code>Calendar</code> object. The driver uses the
725    * <code>Calendar</code> object to construct an SQL <code>DATE</code>
726    * value, which the driver then sends to the database. With a a <code>Calendar</code>
727    * object, the driver can calculate the date taking into account a custom
728    * timezone. If no <code>Calendar</code> object is specified, the driver
729    * uses the default timezone, which is that of the virtual machine running
730    * the application.
731    *
732    * @param parameterIndex
733    * the first parameter is 1, the second is 2, ...
734    * @param x
735    * the parameter value
736    * @param cal
737    * the <code>Calendar</code> object the driver will use to
738    * construct the date
739    * @exception SQLException
740    * if a database access error occurs
741    * @since 1.2
742    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
743    * </a>
744    */

745   public void setDate(int parameterIndex, java.sql.Date JavaDoc x, Calendar JavaDoc cal) throws SQLException JavaDoc
746   {
747     _underlyingSqlStatement.getStmt().setDate(parameterIndex, x, cal);
748   }
749
750   /**
751    * Sets the designated parameter to the given <code>java.sql.Time</code>
752    * value, using the given <code>Calendar</code> object. The driver uses the
753    * <code>Calendar</code> object to construct an SQL <code>TIME</code>
754    * value, which the driver then sends to the database. With a a <code>Calendar</code>
755    * object, the driver can calculate the time taking into account a custom
756    * timezone. If no <code>Calendar</code> object is specified, the driver
757    * uses the default timezone, which is that of the virtual machine running
758    * the application.
759    *
760    * @param parameterIndex
761    * the first parameter is 1, the second is 2, ...
762    * @param x
763    * the parameter value
764    * @param cal
765    * the <code>Calendar</code> object the driver will use to
766    * construct the time
767    * @exception SQLException
768    * if a database access error occurs
769    * @since 1.2
770    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
771    * </a>
772    */

773   public void setTime(int parameterIndex, java.sql.Time JavaDoc x, Calendar JavaDoc cal) throws SQLException JavaDoc
774   {
775     _underlyingSqlStatement.getStmt().setTime(parameterIndex, x, cal);
776   }
777
778   /**
779    * Sets the designated parameter to the given <code>java.sql.Timestamp</code>
780    * value, using the given <code>Calendar</code> object. The driver uses the
781    * <code>Calendar</code> object to construct an SQL <code>TIMESTAMP</code>
782    * value, which the driver then sends to the database. With a a <code>Calendar</code>
783    * object, the driver can calculate the timestamp taking into account a
784    * custom timezone. If no <code>Calendar</code> object is specified, the
785    * driver uses the default timezone, which is that of the virtual machine
786    * running the application.
787    *
788    * @param parameterIndex
789    * the first parameter is 1, the second is 2, ...
790    * @param x
791    * the parameter value
792    * @param cal
793    * the <code>Calendar</code> object the driver will use to
794    * construct the timestamp
795    * @exception SQLException
796    * if a database access error occurs
797    * @since 1.2
798    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
799    * </a>
800    */

801   public void setTimestamp(int parameterIndex, java.sql.Timestamp JavaDoc x, Calendar JavaDoc cal) throws SQLException JavaDoc
802   {
803     _underlyingSqlStatement.getStmt().setTimestamp(parameterIndex, x, cal);
804   }
805
806   /**
807    * Sets the designated parameter to SQL <code>NULL</code>. This version of
808    * the method <code>setNull</code> should be used for user-defined types
809    * and REF type parameters. Examples of user-defined types include: STRUCT,
810    * DISTINCT, JAVA_OBJECT, and named array types.
811    *
812    * <P>
813    * <B>Note:</B> To be portable, applications must give the SQL type code
814    * and the fully-qualified SQL type name when specifying a NULL user-defined
815    * or REF parameter. In the case of a user-defined type the name is the type
816    * name of the parameter itself. For a REF parameter, the name is the type
817    * name of the referenced type. If a JDBC driver does not need the type code
818    * or type name information, it may ignore it.
819    *
820    * Although it is intended for user-defined and Ref parameters, this method
821    * may be used to set a null parameter of any JDBC type. If the parameter
822    * does not have a user-defined or REF type, the given typeName is ignored.
823    *
824    * @param parameterIndex
825    * the first parameter is 1, the second is 2, ...
826    * @param sqlType
827    * a value from <code>java.sql.Types</code>
828    * @param typeName
829    * the fully-qualified name of an SQL user-defined type; ignored
830    * if the parameter is not a user-defined type or REF
831    * @exception SQLException
832    * if a database access error occurs
833    * @since 1.2
834    * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
835    * </a>
836    */

837   public void setNull(int paramIndex, int sqlType, String JavaDoc typeName) throws SQLException JavaDoc
838   {
839     _underlyingSqlStatement.getStmt().setNull(paramIndex, sqlType, typeName);
840   }
841
842   //////////////////////////Statement////////////////////////////
843
/**
844    * Executes an SQL statement that returns a single <code>ResultSet</code>
845    * object.
846    *
847    * @param sql
848    * typically this is a static SQL <code>SELECT</code> statement
849    * @return a <code>ResultSet</code> object that contains the data produced
850    * by the given query; never <code>null</code>
851    * @exception SQLException
852    * if a database access error occurs
853    */

854   public ResultSet JavaDoc executeQuery(String JavaDoc sql) throws SQLException JavaDoc
855   {
856     throw new SQLException JavaDoc("ps.executeQuery: this method is not implemented by the djeneric driver");
857   }
858
859   /**
860    * Executes an SQL <code>INSERT</code>,<code>UPDATE</code> or <code>DELETE</code>
861    * statement. In addition, SQL statements that return nothing, such as SQL
862    * DDL statements, can be executed.
863    *
864    * @param sql
865    * an SQL <code>INSERT</code>,<code>UPDATE</code> or <code>DELETE</code>
866    * statement or an SQL statement that returns nothing
867    * @return either the row count for <code>INSERT</code>,<code>UPDATE</code>
868    * or <code>DELETE</code> statements, or 0 for SQL statements that
869    * return nothing
870    * @exception SQLException
871    * if a database access error occurs
872    */

873   public int executeUpdate(String JavaDoc sql) throws SQLException JavaDoc
874   {
875     throw new SQLException JavaDoc("ps.executeUpdate: this method is not implemented by the djeneric driver");
876   }
877
878   /**
879    * Releases this <code>Statement</code> object's database and JDBC
880    * resources immediately instead of waiting for this to happen when it is
881    * automatically closed. It is generally good practice to release resources
882    * as soon as you are finished with them to avoid tying up database
883    * resources.
884    * <P>
885    * <B>Note:</B> A <code>Statement</code> object is automatically closed
886    * when it is garbage collected. When a <code>Statement</code> object is
887    * closed, its current <code>ResultSet</code> object, if one exists, is
888    * also closed.
889    *
890    * @exception SQLException
891    * if a database access error occurs
892    */

893   public void close() throws SQLException JavaDoc
894   {
895     _underlyingSqlStatement.close();
896     _connection.close(this);
897   }
898
899   protected void finalize()
900   {
901     try
902     {
903       super.finalize();
904       close();
905     }
906     catch (Throwable JavaDoc e)
907     {
908     }
909   }
910
911   //----------------------------------------------------------------------
912

913   /**
914    * Returns the maximum number of bytes allowed for any column value. This
915    * limit is the maximum number of bytes that can be returned for any column
916    * value. The limit applies only to <code>BINARY</code>,<code>VARBINARY</code>,
917    * <code>LONGVARBINARY</code>,<code>CHAR</code>,<code>VARCHAR</code>,
918    * and <code>LONGVARCHAR</code> columns. If the limit is exceeded, the
919    * excess data is silently discarded.
920    *
921    * @return the current max column size limit; zero means unlimited
922    * @exception SQLException
923    * if a database access error occurs
924    */

925   public int getMaxFieldSize() throws SQLException JavaDoc
926   {
927     return _underlyingSqlStatement.getStmt().getMaxFieldSize();
928   }
929
930   /**
931    * Sets the limit for the maximum number of bytes in a column to the given
932    * number of bytes. This is the maximum number of bytes that can be returned
933    * for any column value. This limit applies only to <code>BINARY</code>,
934    * <code>VARBINARY</code>,<code>LONGVARBINARY</code>,<code>CHAR</code>,
935    * <code>VARCHAR</code>, and <code>LONGVARCHAR</code> fields. If the
936    * limit is exceeded, the excess data is silently discarded. For maximum
937    * portability, use values greater than 256.
938    *
939    * @param max
940    * the new max column size limit; zero means unlimited
941    * @exception SQLException
942    * if a database access error occurs
943    */

944   public void setMaxFieldSize(int max) throws SQLException JavaDoc
945   {
946     _underlyingSqlStatement.getStmt().setMaxFieldSize(max);
947   }
948
949   /**
950    * Retrieves the maximum number of rows that a <code>ResultSet</code>
951    * object can contain. If the limit is exceeded, the excess rows are silently
952    * dropped.
953    *
954    * @return the current max row limit; zero means unlimited
955    * @exception SQLException
956    * if a database access error occurs
957    */

958   public int getMaxRows() throws SQLException JavaDoc
959   {
960     return _underlyingSqlStatement.getStmt().getMaxRows();
961   }
962
963   /**
964    * Sets the limit for the maximum number of rows that any <code>ResultSet</code>
965    * object can contain to the given number. If the limit is exceeded, the
966    * excess rows are silently dropped.
967    *
968    * @param max
969    * the new max rows limit; zero means unlimited
970    * @exception SQLException
971    * if a database access error occurs
972    */

973   public void setMaxRows(int max) throws SQLException JavaDoc
974   {
975     _underlyingSqlStatement.getStmt().setMaxRows(max);
976   }
977
978   /**
979    * Sets escape processing on or off. If escape scanning is on (the default),
980    * the driver will do escape substitution before sending the SQL to the
981    * database.
982    *
983    * Note: Since prepared statements have usually been parsed prior to making
984    * this call, disabling escape processing for prepared statements will have
985    * no effect.
986    *
987    * @param enable
988    * <code>true</code> to enable; <code>false</code> to disable
989    * @exception SQLException
990    * if a database access error occurs
991    */

992   public void setEscapeProcessing(boolean enable) throws SQLException JavaDoc
993   {
994     _underlyingSqlStatement.getStmt().setEscapeProcessing(enable);
995   }
996
997   /**
998    * Retrieves the number of seconds the driver will wait for a <code>Statement</code>
999    * object to execute. If the limit is exceeded, a <code>SQLException</code>
1000   * is thrown.
1001   *
1002   * @return the current query timeout limit in seconds; zero means unlimited
1003   * @exception SQLException
1004   * if a database access error occurs
1005   */

1006  public int getQueryTimeout() throws SQLException JavaDoc
1007  {
1008    return _underlyingSqlStatement.getStmt().getQueryTimeout();
1009  }
1010
1011  /**
1012   * Sets the number of seconds the driver will wait for a <code>Statement</code>
1013   * object to execute to the given number of seconds. If the limit is
1014   * exceeded, an <code>SQLException</code> is thrown.
1015   *
1016   * @param seconds
1017   * the new query timeout limit in seconds; zero means unlimited
1018   * @exception SQLException
1019   * if a database access error occurs
1020   */

1021  public void setQueryTimeout(int seconds) throws SQLException JavaDoc
1022  {
1023    _underlyingSqlStatement.getStmt().setQueryTimeout(seconds);
1024  }
1025
1026  /**
1027   * Cancels this <code>Statement</code> object if both the DBMS and driver
1028   * support aborting an SQL statement. This method can be used by one thread
1029   * to cancel a statement that is being executed by another thread.
1030   *
1031   * @exception SQLException
1032   * if a database access error occurs
1033   */

1034  public void cancel() throws SQLException JavaDoc
1035  {
1036    _underlyingSqlStatement.getStmt().cancel();
1037  }
1038
1039  /**
1040   * Retrieves the first warning reported by calls on this <code>Statement</code>
1041   * object. Subsequent <code>Statement</code> object warnings will be
1042   * chained to this <code>SQLWarning</code> object.
1043   *
1044   * <p>
1045   * The warning chain is automatically cleared each time a statement is
1046   * (re)executed.
1047   *
1048   * <P>
1049   * <B>Note:</B> If you are processing a <code>ResultSet</code> object,
1050   * any warnings associated with reads on that <code>ResultSet</code> object
1051   * will be chained on it.
1052   *
1053   * @return the first <code>SQLWarning</code> object or <code>null</code>
1054   * @exception SQLException
1055   * if a database access error occurs
1056   */

1057  public SQLWarning JavaDoc getWarnings() throws SQLException JavaDoc
1058  {
1059    return _underlyingSqlStatement.getStmt().getWarnings();
1060  }
1061
1062  /**
1063   * Clears all the warnings reported on this <code>Statement</code> object.
1064   * After a call to this method, the method <code>getWarnings</code> will
1065   * return <code>null</code> until a new warning is reported for this <code>Statement</code>
1066   * object.
1067   *
1068   * @exception SQLException
1069   * if a database access error occurs
1070   */

1071  public void clearWarnings() throws SQLException JavaDoc
1072  {
1073    _underlyingSqlStatement.getStmt().clearWarnings();
1074  }
1075
1076  /**
1077   * Defines the SQL cursor name that will be used by subsequent <code>Statement</code>
1078   * object <code>execute</code> methods. This name can then be used in SQL
1079   * positioned update/delete statements to identify the current row in the
1080   * <code>ResultSet</code> object generated by this statement. If the
1081   * database doesn't support positioned update/delete, this method is a noop.
1082   * To insure that a cursor has the proper isolation level to support updates,
1083   * the cursor's <code>SELECT</code> statement should be of the form 'select
1084   * for update ...'. If the 'for update' phrase is omitted, positioned updates
1085   * may fail.
1086   *
1087   * <P>
1088   * <B>Note:</B> By definition, positioned update/delete execution must be
1089   * done by a different <code>Statement</code> object than the one which
1090   * generated the <code>ResultSet</code> object being used for positioning.
1091   * Also, cursor names must be unique within a connection.
1092   *
1093   * @param name
1094   * the new cursor name, which must be unique within a connection
1095   * @exception SQLException
1096   * if a database access error occurs
1097   */

1098  public void setCursorName(String JavaDoc name) throws SQLException JavaDoc
1099  {
1100    _underlyingSqlStatement.getStmt().setCursorName(name);
1101  }
1102
1103  //----------------------- Multiple Results --------------------------
1104

1105  /**
1106   * Executes an SQL statement that may return multiple results. Under some
1107   * (uncommon) situations a single SQL statement may return multiple result
1108   * sets and/or update counts. Normally you can ignore this unless you are (1)
1109   * executing a stored procedure that you know may return multiple results or
1110   * (2) you are dynamically executing an unknown SQL string. The methods
1111   * <code>execute</code>,<code>getMoreResults</code>,<code>getResultSet</code>,
1112   * and <code>getUpdateCount</code> let you navigate through multiple
1113   * results.
1114   *
1115   * The <code>execute</code> method executes an SQL statement and indicates
1116   * the form of the first result. You can then use the methods <code>getResultSet</code>
1117   * or <code>getUpdateCount</code> to retrieve the result, and <code>getMoreResults</code>
1118   * to move to any subsequent result(s).
1119   *
1120   * @param sql
1121   * any SQL statement
1122   * @return <code>true</code> if the next result is a <code>ResultSet</code>
1123   * object; <code>false</code> if it is an update count or there are
1124   * no more results
1125   * @exception SQLException
1126   * if a database access error occurs
1127   * @see #getResultSet
1128   * @see #getUpdateCount
1129   * @see #getMoreResults
1130   */

1131  public boolean execute(String JavaDoc sql) throws SQLException JavaDoc
1132  {
1133    throw new SQLException JavaDoc("ps.execute(sql): this method is not implemented by the djeneric driver");
1134  }
1135
1136  /**
1137   * Returns the current result as a <code>ResultSet</code> object. This
1138   * method should be called only once per result.
1139   *
1140   * @return the current result as a <code>ResultSet</code> object; <code>null</code>
1141   * if the result is an update count or there are no more results
1142   * @exception SQLException
1143   * if a database access error occurs
1144   * @see #execute
1145   */

1146  public ResultSet JavaDoc getResultSet() throws SQLException JavaDoc
1147  {
1148    return _underlyingSqlStatement.getStmt().getResultSet();
1149  }
1150
1151  /**
1152   * Returns the current result as an update count; if the result is a <code>ResultSet</code>
1153   * object or there are no more results, -1 is returned. This method should be
1154   * called only once per result.
1155   *
1156   * @return the current result as an update count; -1 if the current result is
1157   * a <code>ResultSet</code> object or there are no more results
1158   * @exception SQLException
1159   * if a database access error occurs
1160   * @see #execute
1161   */

1162  public int getUpdateCount() throws SQLException JavaDoc
1163  {
1164    throw new SQLException JavaDoc("ps.getUpdateCount: this method is not implemented by the djeneric driver");
1165  }
1166
1167  /**
1168   * Moves to a <code>Statement</code> object's next result. It returns
1169   * <code>true</code> if this result is a <code>ResultSet</code> object.
1170   * This method also implicitly closes any current <code>ResultSet</code>
1171   * object obtained with the method <code>getResultSet</code>.
1172   *
1173   * <P>
1174   * There are no more results when the following is true:
1175   *
1176   * <PRE>
1177   * * <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
1178   * * </PRE>
1179   *
1180   * @return <code>true</code> if the next result is a <code>ResultSet</code>
1181   * object; <code>false</code> if it is an update count or there are
1182   * no more results
1183   * @exception SQLException
1184   * if a database access error occurs
1185   * @see #execute
1186   */

1187  public boolean getMoreResults() throws SQLException JavaDoc
1188  {
1189    return _underlyingSqlStatement.getStmt().getMoreResults();
1190  }
1191
1192  //--------------------------JDBC 2.0-----------------------------
1193

1194  /**
1195   * Gives the driver a hint as to the direction in which the rows in a result
1196   * set will be processed. The hint applies only to result sets created using
1197   * this <code>Statement</code> object. The default value is <code>ResultSet.FETCH_FORWARD</code>.
1198   * <p>
1199   * Note that this method sets the default fetch direction for result sets
1200   * generated by this <code>Statement</code> object. Each result set has its
1201   * own methods for getting and setting its own fetch direction.
1202   *
1203   * @param direction
1204   * the initial direction for processing rows
1205   * @exception SQLException
1206   * if a database access error occurs or the given direction is
1207   * not one of <code>ResultSet.FETCH_FORWARD</code>,<code>ResultSet.FETCH_REVERSE</code>,
1208   * or <code>ResultSet.FETCH_UNKNOWN</code>
1209   * @since 1.2
1210   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1211   * </a>
1212   */

1213  public void setFetchDirection(int direction) throws SQLException JavaDoc
1214  {
1215    _underlyingSqlStatement.getStmt().setFetchDirection(direction);
1216  }
1217
1218  /**
1219   * Retrieves the direction for fetching rows from database tables that is the
1220   * default for result sets generated from this <code>Statement</code>
1221   * object. If this <code>Statement</code> object has not set a fetch
1222   * direction by calling the method <code>setFetchDirection</code>, the
1223   * return value is implementation-specific.
1224   *
1225   * @return the default fetch direction for result sets generated from this
1226   * <code>Statement</code> object
1227   * @exception SQLException
1228   * if a database access error occurs
1229   * @since 1.2
1230   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1231   * </a>
1232   */

1233  public int getFetchDirection() throws SQLException JavaDoc
1234  {
1235    return _underlyingSqlStatement.getStmt().getFetchDirection();
1236  }
1237
1238  /**
1239   * Gives the JDBC driver a hint as to the number of rows that should be
1240   * fetched from the database when more rows are needed. The number of rows
1241   * specified affects only result sets created using this statement. If the
1242   * value specified is zero, then the hint is ignored. The default value is
1243   * zero.
1244   *
1245   * @param rows
1246   * the number of rows to fetch
1247   * @exception SQLException
1248   * if a database access error occurs, or the condition 0
1249   * <= rows <= this.getMaxRows() is not satisfied.
1250   * @since 1.2
1251   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1252   * </a>
1253   */

1254  public void setFetchSize(int rows) throws SQLException JavaDoc
1255  {
1256    _underlyingSqlStatement.getStmt().setFetchSize(rows);
1257  }
1258
1259  /**
1260   * Retrieves the number of result set rows that is the default fetch size for
1261   * result sets generated from this <code>Statement</code> object. If this
1262   * <code>Statement</code> object has not set a fetch size by calling the
1263   * method <code>setFetchSize</code>, the return value is
1264   * implementation-specific.
1265   *
1266   * @return the default fetch size for result sets generated from this <code>Statement</code>
1267   * object
1268   * @exception SQLException
1269   * if a database access error occurs
1270   * @since 1.2
1271   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1272   * </a>
1273   */

1274  public int getFetchSize() throws SQLException JavaDoc
1275  {
1276    return _underlyingSqlStatement.getStmt().getFetchSize();
1277  }
1278
1279  /**
1280   * Retrieves the result set concurrency for <code>ResultSet</code> objects
1281   * generated by this <code>Statement</code> object.
1282   *
1283   * @return either <code>ResultSet.CONCUR_READ_ONLY</code> or <code>ResultSet.CONCUR_UPDATABLE</code>
1284   * @since 1.2
1285   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1286   * </a>
1287   */

1288  public int getResultSetConcurrency() throws SQLException JavaDoc
1289  {
1290    return _underlyingSqlStatement.getStmt().getResultSetConcurrency();
1291  }
1292
1293  /**
1294   * Retrieves the result set type for <code>ResultSet</code> objects
1295   * generated by this <code>Statement</code> object.
1296   *
1297   * @return one of <code>ResultSet.TYPE_FORWARD_ONLY</code>,<code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>,
1298   * or <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
1299   * @since 1.2
1300   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1301   * </a>
1302   */

1303  public int getResultSetType() throws SQLException JavaDoc
1304  {
1305    return _underlyingSqlStatement.getStmt().getResultSetType();
1306  }
1307
1308  /**
1309   * Adds an SQL command to the current batch of commmands for this <code>Statement</code>
1310   * object. This method is optional.
1311   *
1312   * @param sql
1313   * typically this is a static SQL <code>INSERT</code> or <code>UPDATE</code>
1314   * statement
1315   * @exception SQLException
1316   * if a database access error occurs, or the driver does not
1317   * support batch statements
1318   * @since 1.2
1319   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1320   * </a>
1321   */

1322  public void addBatch(String JavaDoc sql) throws SQLException JavaDoc
1323  {
1324    throw new SQLException JavaDoc("ps.addBatch(sql): this method is not implemented by the djeneric driver");
1325  }
1326
1327  /**
1328   * Makes the set of commands in the current batch empty. This method is
1329   * optional.
1330   *
1331   * @exception SQLException
1332   * if a database access error occurs or the driver does not
1333   * support batch statements
1334   * @since 1.2
1335   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1336   * </a>
1337   */

1338  public void clearBatch() throws SQLException JavaDoc
1339  {
1340    throw new SQLException JavaDoc("ps.clearBatch: this method is not implemented by the djeneric driver");
1341  }
1342
1343  /**
1344   * Submits a batch of commands to the database for execution and if all
1345   * commands execute successfully, returns an array of update counts. The
1346   * <code>int</code> elements of the array that is returned are ordered to
1347   * correspond to the commands in the batch, which are ordered according to
1348   * the order in which they were added to the batch. The elements in the array
1349   * returned by the method <code>executeBatch</code> may be one of the
1350   * following:
1351   * <OL>
1352   * <LI>A number greater than or equal to zero -- indicates that the command
1353   * was processed successfully and is an update count giving the number of
1354   * rows in the database that were affected by the command's execution
1355   * <LI>A value of <code>-2</code>-- indicates that the command was
1356   * processed successfully but that the number of rows affected is unknown
1357   * <P>
1358   * If one of the commands in a batch update fails to execute properly, this
1359   * method throws a <code>BatchUpdateException</code>, and a JDBC driver
1360   * may or may not continue to process the remaining commands in the batch.
1361   * However, the driver's behavior must be consistent with a particular DBMS,
1362   * either always continuing to process commands or never continuing to
1363   * process commands. If the driver continues processing after a failure, the
1364   * array returned by the method <code>BatchUpdateException.getUpdateCounts</code>
1365   * will contain as many elements as there are commands in the batch, and at
1366   * least one of the elements will be the following:
1367   * <P>
1368   * <LI>A value of <code>-3</code>-- indicates that the command failed to
1369   * execute successfully and occurs only if a driver continues to process
1370   * commands after a command fails
1371   * </OL>
1372   * <P>
1373   * A driver is not required to implement this method. The possible
1374   * implementations and return values have been modified in the Java 2 SDK,
1375   * Standard Edition, version 1.3 to accommodate the option of continuing to
1376   * proccess commands in a batch update after a <code>BatchUpdateException</code>
1377   * obejct has been thrown.
1378   *
1379   * @return an array of update counts containing one element for each command
1380   * in the batch. The elements of the array are ordered according to
1381   * the order in which commands were added to the batch.
1382   * @exception SQLException
1383   * if a database access error occurs or the driver does not
1384   * support batch statements. Throws
1385   * {@link BatchUpdateException}(a subclass of <code>SQLException</code>)
1386   * if one of the commands sent to the database fails to
1387   * execute properly or attempts to return a result set.
1388   * @since 1.3
1389   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1390   * </a>
1391   */

1392  public int[] executeBatch() throws SQLException JavaDoc
1393  {
1394    throw new SQLException JavaDoc("ps.executeBatch: this method is not implemented by the djeneric driver");
1395  }
1396
1397  /**
1398   * Returns the <code>Connection</code> object that produced this <code>Statement</code>
1399   * object.
1400   *
1401   * @return the connection that produced this statement
1402   * @exception SQLException
1403   * if a database access error occurs
1404   * @since 1.2
1405   * @see <a HREF="package-summary.html#2.0 API">What Is in the JDBC 2.0 API
1406   * </a>
1407   */

1408  public Connection JavaDoc getConnection() throws SQLException JavaDoc
1409  {
1410    return _connection;
1411  }
1412
1413  /*
1414   * (non-Javadoc)
1415   *
1416   * @see java.sql.PreparedStatement#getParameterMetaData()
1417   */

1418  public ParameterMetaData JavaDoc getParameterMetaData() throws SQLException JavaDoc
1419  {
1420    throw new SQLException JavaDoc("ps.getParameterMetaData: this method is not implemented by the djeneric driver");
1421  }
1422
1423  /*
1424   * (non-Javadoc)
1425   *
1426   * @see java.sql.PreparedStatement#setURL(int, java.net.URL)
1427   */

1428  public void setURL(int arg0, URL JavaDoc arg1) throws SQLException JavaDoc
1429  {
1430    throw new SQLException JavaDoc("ps.setURL: this method is not implemented by the djeneric driver");
1431  }
1432
1433  /*
1434   * (non-Javadoc)
1435   *
1436   * @see java.sql.Statement#executeUpdate(java.lang.String, int[])
1437   */

1438  public int executeUpdate(String JavaDoc arg0, int[] arg1) throws SQLException JavaDoc
1439  {
1440    throw new SQLException JavaDoc("ps.executeUpdate: this method is not implemented by the djeneric driver");
1441  }
1442
1443  /*
1444   * (non-Javadoc)
1445   *
1446   * @see java.sql.Statement#execute(java.lang.String, int)
1447   */

1448  public boolean execute(String JavaDoc arg0, int arg1) throws SQLException JavaDoc
1449  {
1450    throw new SQLException JavaDoc("ps.execute: this method is not implemented by the djeneric driver");
1451  }
1452
1453  /*
1454   * (non-Javadoc)
1455   *
1456   * @see java.sql.Statement#execute(java.lang.String, int[])
1457   */

1458  public boolean execute(String JavaDoc arg0, int[] arg1) throws SQLException JavaDoc
1459  {
1460    throw new SQLException JavaDoc("ps.execute: this method is not implemented by the djeneric driver");
1461  }
1462
1463  /*
1464   * (non-Javadoc)
1465   *
1466   * @see java.sql.Statement#execute(java.lang.String, java.lang.String[])
1467   */

1468  public boolean execute(String JavaDoc arg0, String JavaDoc[] arg1) throws SQLException JavaDoc
1469  {
1470    throw new SQLException JavaDoc("ps.execute: this method is not implemented by the djeneric driver");
1471  }
1472
1473  /*
1474   * (non-Javadoc)
1475   *
1476   * @see java.sql.Statement#executeUpdate(java.lang.String, int)
1477   */

1478  public int executeUpdate(String JavaDoc arg0, int arg1) throws SQLException JavaDoc
1479  {
1480    throw new SQLException JavaDoc("ps.executeUpdate: this method is not implemented by the djeneric driver");
1481  }
1482
1483  /*
1484   * (non-Javadoc)
1485   *
1486   * @see java.sql.Statement#executeUpdate(java.lang.String,
1487   * java.lang.String[])
1488   */

1489  public int executeUpdate(String JavaDoc arg0, String JavaDoc[] arg1) throws SQLException JavaDoc
1490  {
1491    throw new SQLException JavaDoc("ps.executeUpdate: this method is not implemented by the djeneric driver");
1492  }
1493
1494  /*
1495   * (non-Javadoc)
1496   *
1497   * @see java.sql.Statement#getGeneratedKeys()
1498   */

1499  public ResultSet JavaDoc getGeneratedKeys() throws SQLException JavaDoc
1500  {
1501    throw new SQLException JavaDoc("ps.getGeneratedKeys: this method is not implemented by the djeneric driver");
1502  }
1503
1504  /*
1505   * (non-Javadoc)
1506   *
1507   * @see java.sql.Statement#getMoreResults(int)
1508   */

1509  public boolean getMoreResults(int arg0) throws SQLException JavaDoc
1510  {
1511    throw new SQLException JavaDoc("ps.getMoreResults: this method is not implemented by the djeneric driver");
1512  }
1513
1514  /*
1515   * (non-Javadoc)
1516   *
1517   * @see java.sql.Statement#getResultSetHoldability()
1518   */

1519  public int getResultSetHoldability() throws SQLException JavaDoc
1520  {
1521    return 0;
1522  }
1523
1524}
Popular Tags