Source code: com/rohanclan/ashpool/jdbc/Statement.java
1 /*
2 * Ashpool - XML Database
3 * Copyright (C) 2003 Rob Rohan
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 675 Mass Ave, Cambridge, MA 02139, USA.
17 *
18 * Statement.java
19 *
20 * Created on January 30, 2003, 7:20 PM
21 */
22
23 package com.rohanclan.ashpool.jdbc;
24
25 import java.sql.*;
26 import com.rohanclan.ashpool.core.*;
27 import java.util.*;
28
29 /**
30 *
31 * @author rob
32 */
33 public class Statement implements java.sql.Statement {
34
35 private ConnectionManager connMan;
36 private Vector resultSets;
37 private int currentresultset = 0;
38
39 /** Creates a new instance of Statement */
40 public Statement() {;}
41
42 public void setConnectionManager(ConnectionManager cm){
43 resultSets = new Vector();
44 this.connMan = cm;
45 }
46
47 /** Adds the given SQL command to the current list of commmands for this
48 * <code>Statement</code> object. The commands in this list can be
49 * executed as a batch by calling the method <code>executeBatch</code>.
50 * <P>
51 * <B>NOTE:</B> This method is optional.
52 *
53 * @param sql typically this is a static SQL <code>INSERT</code> or
54 * <code>UPDATE</code> statement
55 * @exception SQLException if a database access error occurs, or the
56 * driver does not support batch updates
57 * @see #executeBatch
58 * @since 1.2
59 *
60 */
61 public void addBatch(String sql) throws SQLException {;}
62
63 /** Cancels this <code>Statement</code> object if both the DBMS and
64 * driver support aborting an SQL statement.
65 * This method can be used by one thread to cancel a statement that
66 * is being executed by another thread.
67 *
68 * @exception SQLException if a database access error occurs
69 *
70 */
71 public void cancel() throws SQLException {;}
72
73 /** Empties this <code>Statement</code> object's current list of
74 * SQL commands.
75 * <P>
76 * <B>NOTE:</B> This method is optional.
77 *
78 * @exception SQLException if a database access error occurs or the
79 * driver does not support batch updates
80 * @see #addBatch
81 * @since 1.2
82 *
83 */
84 public void clearBatch() throws SQLException {;}
85
86 /** Clears all the warnings reported on this <code>Statement</code>
87 * object. After a call to this method,
88 * the method <code>getWarnings</code> will return
89 * <code>null</code> until a new warning is reported for this
90 * <code>Statement</code> object.
91 *
92 * @exception SQLException if a database access error occurs
93 *
94 */
95 public void clearWarnings() throws SQLException {;}
96
97 /** Releases this <code>Statement</code> object's database
98 * and JDBC resources immediately instead of waiting for
99 * this to happen when it is automatically closed.
100 * It is generally good practice to release resources as soon as
101 * you are finished with them to avoid tying up database
102 * resources.
103 * <P>
104 * Calling the method <code>close</code> on a <code>Statement</code>
105 * object that is already closed has no effect.
106 * <P>
107 * <B>Note:</B> A <code>Statement</code> object is automatically closed
108 * when it is garbage collected. When a <code>Statement</code> object is
109 * closed, its current <code>ResultSet</code> object, if one exists, is
110 * also closed.
111 *
112 * @exception SQLException if a database access error occurs
113 *
114 */
115 public void close() throws SQLException {;}
116
117 /** Executes the given SQL statement, which may return multiple results.
118 * In some (uncommon) situations, a single SQL statement may return
119 * multiple result sets and/or update counts. Normally you can ignore
120 * this unless you are (1) executing a stored procedure that you know may
121 * return multiple results or (2) you are dynamically executing an
122 * unknown SQL string.
123 * <P>
124 * The <code>execute</code> method executes an SQL statement and indicates the
125 * form of the first result. You must then use the methods
126 * <code>getResultSet</code> or <code>getUpdateCount</code>
127 * to retrieve the result, and <code>getMoreResults</code> to
128 * move to any subsequent result(s).
129 *
130 * @param sql any SQL statement
131 * @return <code>true</code> if the first result is a <code>ResultSet</code>
132 * object; <code>false</code> if it is an update count or there are
133 * no results
134 * @exception SQLException if a database access error occurs
135 * @see #getResultSet
136 * @see #getUpdateCount
137 * @see #getMoreResults
138 *
139 */
140 public boolean execute(String sql) throws SQLException {
141 ResultSet rs = executeQuery(sql);
142
143 resultSets.add(rs);
144
145 return true;
146 }
147
148 /** Executes the given SQL statement, which may return multiple results,
149 * and signals the driver that the
150 * auto-generated keys indicated in the given array should be made available
151 * for retrieval. This array contains the names of the columns in the
152 * target table that contain the auto-generated keys that should be made
153 * available. The driver will ignore the array if the given SQL statement
154 * is not an <code>INSERT</code> statement.
155 * <P>
156 * In some (uncommon) situations, a single SQL statement may return
157 * multiple result sets and/or update counts. Normally you can ignore
158 * this unless you are (1) executing a stored procedure that you know may
159 * return multiple results or (2) you are dynamically executing an
160 * unknown SQL string.
161 * <P>
162 * The <code>execute</code> method executes an SQL statement and indicates the
163 * form of the first result. You must then use the methods
164 * <code>getResultSet</code> or <code>getUpdateCount</code>
165 * to retrieve the result, and <code>getMoreResults</code> to
166 * move to any subsequent result(s).
167 *
168 * @param sql any SQL statement
169 * @param columnNames an array of the names of the columns in the inserted
170 * row that should be made available for retrieval by a call to the
171 * method <code>getGeneratedKeys</code>
172 * @return <code>true</code> if the next result is a <code>ResultSet</code>
173 * object; <code>false</code> if it is an update count or there
174 * are no more results
175 * @exception SQLException if a database access error occurs
176 * @see #getResultSet
177 * @see #getUpdateCount
178 * @see #getMoreResults
179 * @see #getGeneratedKeys
180 *
181 * @since 1.4
182 *
183 */
184 public boolean execute(String sql, String[] columnNames) throws SQLException {
185 ResultSet rs = executeQuery(sql);
186
187 resultSets.add(rs);
188
189 return true;
190 }
191
192 /** Executes the given SQL statement, which may return multiple results,
193 * and signals the driver that the
194 * auto-generated keys indicated in the given array should be made available
195 * for retrieval. This array contains the indexes of the columns in the
196 * target table that contain the auto-generated keys that should be made
197 * available. The driver will ignore the array if the given SQL statement
198 * is not an <code>INSERT</code> statement.
199 * <P>
200 * Under some (uncommon) situations, a single SQL statement may return
201 * multiple result sets and/or update counts. Normally you can ignore
202 * this unless you are (1) executing a stored procedure that you know may
203 * return multiple results or (2) you are dynamically executing an
204 * unknown SQL string.
205 * <P>
206 * The <code>execute</code> method executes an SQL statement and indicates the
207 * form of the first result. You must then use the methods
208 * <code>getResultSet</code> or <code>getUpdateCount</code>
209 * to retrieve the result, and <code>getMoreResults</code> to
210 * move to any subsequent result(s).
211 *
212 * @param sql any SQL statement
213 * @param columnIndexes an array of the indexes of the columns in the
214 * inserted row that should be made available for retrieval by a
215 * call to the method <code>getGeneratedKeys</code>
216 * @return <code>true</code> if the first result is a <code>ResultSet</code>
217 * object; <code>false</code> if it is an update count or there
218 * are no results
219 * @exception SQLException if a database access error occurs
220 * @see #getResultSet
221 * @see #getUpdateCount
222 * @see #getMoreResults
223 *
224 * @since 1.4
225 *
226 */
227 public boolean execute(String sql, int[] columnIndexes) throws SQLException {
228 ResultSet rs = executeQuery(sql);
229
230 resultSets.add(rs);
231
232 return true;
233 }
234
235 /** Executes the given SQL statement, which may return multiple results,
236 * and signals the driver that any
237 * auto-generated keys should be made available
238 * for retrieval. The driver will ignore this signal if the SQL statement
239 * is not an <code>INSERT</code> statement.
240 * <P>
241 * In some (uncommon) situations, a single SQL statement may return
242 * multiple result sets and/or update counts. Normally you can ignore
243 * this unless you are (1) executing a stored procedure that you know may
244 * return multiple results or (2) you are dynamically executing an
245 * unknown SQL string.
246 * <P>
247 * The <code>execute</code> method executes an SQL statement and indicates the
248 * form of the first result. You must then use the methods
249 * <code>getResultSet</code> or <code>getUpdateCount</code>
250 * to retrieve the result, and <code>getMoreResults</code> to
251 * move to any subsequent result(s).
252 *
253 * @param sql any SQL statement
254 * @param autoGeneratedKeys a constant indicating whether auto-generated
255 * keys should be made available for retrieval using the method
256 * <code>getGeneratedKeys</code>; one of the following constants:
257 * <code>Statement.RETURN_GENERATED_KEYS</code> or
258 * <code>Statement.NO_GENERATED_KEYS</code>
259 * @return <code>true</code> if the first result is a <code>ResultSet</code>
260 * object; <code>false</code> if it is an update count or there are
261 * no results
262 * @exception SQLException if a database access error occurs
263 * @see #getResultSet
264 * @see #getUpdateCount
265 * @see #getMoreResults
266 * @see #getGeneratedKeys
267 *
268 * @since 1.4
269 *
270 */
271 public boolean execute(String sql, int autoGeneratedKeys) throws SQLException {
272 ResultSet rs = executeQuery(sql);
273
274 resultSets.add(rs);
275
276 return true;
277 }
278
279 /** Submits a batch of commands to the database for execution and
280 * if all commands execute successfully, returns an array of update counts.
281 * The <code>int</code> elements of the array that is returned are ordered
282 * to correspond to the commands in the batch, which are ordered
283 * according to the order in which they were added to the batch.
284 * The elements in the array returned by the method <code>executeBatch</code>
285 * may be one of the following:
286 * <OL>
287 * <LI>A number greater than or equal to zero -- indicates that the
288 * command was processed successfully and is an update count giving the
289 * number of rows in the database that were affected by the command's
290 * execution
291 * <LI>A value of <code>SUCCESS_NO_INFO</code> -- indicates that the command was
292 * processed successfully but that the number of rows affected is
293 * unknown
294 * <P>
295 * If one of the commands in a batch update fails to execute properly,
296 * this method throws a <code>BatchUpdateException</code>, and a JDBC
297 * driver may or may not continue to process the remaining commands in
298 * the batch. However, the driver's behavior must be consistent with a
299 * particular DBMS, either always continuing to process commands or never
300 * continuing to process commands. If the driver continues processing
301 * after a failure, the array returned by the method
302 * <code>BatchUpdateException.getUpdateCounts</code>
303 * will contain as many elements as there are commands in the batch, and
304 * at least one of the elements will be the following:
305 * <P>
306 * <LI>A value of <code>EXECUTE_FAILED</code> -- indicates that the command failed
307 * to execute successfully and occurs only if a driver continues to
308 * process commands after a command fails
309 * </OL>
310 * <P>
311 * A driver is not required to implement this method.
312 * The possible implementations and return values have been modified in
313 * the Java 2 SDK, Standard Edition, version 1.3 to
314 * accommodate the option of continuing to proccess commands in a batch
315 * update after a <code>BatchUpdateException</code> obejct has been thrown.
316 *
317 * @return an array of update counts containing one element for each
318 * command in the batch. The elements of the array are ordered according
319 * to the order in which commands were added to the batch.
320 * @exception SQLException if a database access error occurs or the
321 * driver does not support batch statements. Throws {@link BatchUpdateException}
322 * (a subclass of <code>SQLException</code>) if one of the commands sent to the
323 * database fails to execute properly or attempts to return a result set.
324 * @since 1.3
325 *
326 */
327 public int[] executeBatch() throws SQLException {
328 return null;
329 }
330
331 /** Executes the given SQL statement, which returns a single
332 * <code>ResultSet</code> object.
333 *
334 * @param sql an SQL statement to be sent to the database, typically a
335 * static SQL <code>SELECT</code> statement
336 * @return a <code>ResultSet</code> object that contains the data produced
337 * by the given query; never <code>null</code>
338 * @exception SQLException if a database access error occurs or the given
339 * SQL statement produces anything other than a single
340 * <code>ResultSet</code> object
341 *
342 */
343 public java.sql.ResultSet executeQuery(String sql) throws SQLException {
344 try{
345 return connMan.executeStatement(sql);
346 }catch(Exception e){
347 e.printStackTrace(System.err);
348 }
349
350 return null;
351 }
352
353 /** Executes the given SQL statement, which may be an <code>INSERT</code>,
354 * <code>UPDATE</code>, or <code>DELETE</code> statement or an
355 * SQL statement that returns nothing, such as an SQL DDL statement.
356 *
357 * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
358 * <code>DELETE</code> statement or an SQL statement that returns nothing
359 * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>
360 * or <code>DELETE</code> statements, or <code>0</code> for SQL statements
361 * that return nothing
362 * @exception SQLException if a database access error occurs or the given
363 * SQL statement produces a <code>ResultSet</code> object
364 *
365 */
366 public int executeUpdate(String sql) throws SQLException {
367 ResultSet rs = executeQuery(sql);
368
369 return 1;
370 }
371
372 /** Executes the given SQL statement and signals the driver that the
373 * auto-generated keys indicated in the given array should be made available
374 * for retrieval. The driver will ignore the array if the SQL statement
375 * is not an <code>INSERT</code> statement.
376 *
377 * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
378 * <code>DELETE</code> statement or an SQL statement that returns nothing
379 * @param columnNames an array of the names of the columns that should be
380 * returned from the inserted row
381 * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
382 * or <code>DELETE</code> statements, or 0 for SQL statements
383 * that return nothing
384 * @exception SQLException if a database access error occurs
385 *
386 * @since 1.4
387 *
388 */
389 public int executeUpdate(String sql, String[] columnNames) throws SQLException {
390 ResultSet rs = executeQuery(sql);
391 return 0;
392 }
393
394 /** Executes the given SQL statement and signals the driver with the
395 * given flag about whether the
396 * auto-generated keys produced by this <code>Statement</code> object
397 * should be made available for retrieval.
398 *
399 * @param sql must be an SQL <code>INSERT</code>, <code>UPDATE</code> or
400 * <code>DELETE</code> statement or an SQL statement that
401 * returns nothing
402 * @param autoGeneratedKeys a flag indicating whether auto-generated keys
403 * should be made available for retrieval;
404 * one of the following constants:
405 * <code>Statement.RETURN_GENERATED_KEYS</code>
406 * <code>Statement.NO_GENERATED_KEYS</code>
407 * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>
408 * or <code>DELETE</code> statements, or <code>0</code> for SQL
409 * statements that return nothing
410 * @exception SQLException if a database access error occurs, the given
411 * SQL statement returns a <code>ResultSet</code> object, or
412 * the given constant is not one of those allowed
413 * @since 1.4
414 *
415 */
416 public int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException {
417 ResultSet rs = executeQuery(sql);
418 return 0;
419 }
420
421 /** Executes the given SQL statement and signals the driver that the
422 * auto-generated keys indicated in the given array should be made available
423 * for retrieval. The driver will ignore the array if the SQL statement
424 * is not an <code>INSERT</code> statement.
425 *
426 * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
427 * <code>DELETE</code> statement or an SQL statement that returns nothing,
428 * such as an SQL DDL statement
429 * @param columnIndexes an array of column indexes indicating the columns
430 * that should be returned from the inserted row
431 * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
432 * or <code>DELETE</code> statements, or 0 for SQL statements
433 * that return nothing
434 * @exception SQLException if a database access error occurs or the SQL
435 * statement returns a <code>ResultSet</code> object
436 * @since 1.4
437 *
438 */
439 public int executeUpdate(String sql, int[] columnIndexes) throws SQLException {
440 ResultSet rs = executeQuery(sql);
441 return 0;
442 }
443
444 /** Retrieves the <code>Connection</code> object
445 * that produced this <code>Statement</code> object.
446 * @return the connection that produced this statement
447 * @exception SQLException if a database access error occurs
448 * @since 1.2
449 *
450 */
451 public java.sql.Connection getConnection() throws SQLException {
452 return null;
453 }
454
455 /** Retrieves the direction for fetching rows from
456 * database tables that is the default for result sets
457 * generated from this <code>Statement</code> object.
458 * If this <code>Statement</code> object has not set
459 * a fetch direction by calling the method <code>setFetchDirection</code>,
460 * the return value is implementation-specific.
461 *
462 * @return the default fetch direction for result sets generated
463 * from this <code>Statement</code> object
464 * @exception SQLException if a database access error occurs
465 * @since 1.2
466 * @see #setFetchDirection
467 *
468 */
469 public int getFetchDirection() throws SQLException {
470 return 0;
471 }
472
473 /** Retrieves the number of result set rows that is the default
474 * fetch size for <code>ResultSet</code> objects
475 * generated from this <code>Statement</code> object.
476 * If this <code>Statement</code> object has not set
477 * a fetch size by calling the method <code>setFetchSize</code>,
478 * the return value is implementation-specific.
479 *
480 * @return the default fetch size for result sets generated
481 * from this <code>Statement</code> object
482 * @exception SQLException if a database access error occurs
483 * @since 1.2
484 * @see #setFetchSize
485 *
486 */
487 public int getFetchSize() throws SQLException {
488 return 0;
489 }
490
491 /** Retrieves any auto-generated keys created as a result of executing this
492 * <code>Statement</code> object. If this <code>Statement</code> object did
493 * not generate any keys, an empty <code>ResultSet</code>
494 * object is returned.
495 *
496 * @return a <code>ResultSet</code> object containing the auto-generated key(s)
497 * generated by the execution of this <code>Statement</code> object
498 * @exception SQLException if a database access error occurs
499 * @since 1.4
500 *
501 */
502 public java.sql.ResultSet getGeneratedKeys() throws SQLException {
503 return null;
504 }
505
506 /** Retrieves the maximum number of bytes that can be
507 * returned for character and binary column values in a <code>ResultSet</code>
508 * object produced by this <code>Statement</code> object.
509 * This limit applies only to <code>BINARY</code>,
510 * <code>VARBINARY</code>, <code>LONGVARBINARY</code>, <code>CHAR</code>,
511 * <code>VARCHAR</code>, and <code>LONGVARCHAR</code>
512 * columns. If the limit is exceeded, the excess data is silently
513 * discarded.
514 *
515 * @return the current column size limit for columns storing character and
516 * binary values; zero means there is no limit
517 * @exception SQLException if a database access error occurs
518 * @see #setMaxFieldSize
519 *
520 */
521 public int getMaxFieldSize() throws SQLException {
522 return 0;
523 }
524
525 /** Retrieves the maximum number of rows that a
526 * <code>ResultSet</code> object produced by this
527 * <code>Statement</code> object can contain. If this limit is exceeded,
528 * the excess rows are silently dropped.
529 *
530 * @return the current maximum number of rows for a <code>ResultSet</code>
531 * object produced by this <code>Statement</code> object;
532 * zero means there is no limit
533 * @exception SQLException if a database access error occurs
534 * @see #setMaxRows
535 *
536 */
537 public int getMaxRows() throws SQLException {
538 return 0;
539 }
540
541 /** Moves to this <code>Statement</code> object's next result, returns
542 * <code>true</code> if it is a <code>ResultSet</code> object, and
543 * implicitly closes any current <code>ResultSet</code>
544 * object(s) obtained with the method <code>getResultSet</code>.
545 *
546 * <P>There are no more results when the following is true:
547 * <PRE>
548 * <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
549 * </PRE>
550 *
551 * @return <code>true</code> if the next result is a <code>ResultSet</code>
552 * object; <code>false</code> if it is an update count or there are
553 * no more results
554 * @exception SQLException if a database access error occurs
555 * @see #execute
556 *
557 */
558 public boolean getMoreResults() throws SQLException {
559 if(this.currentresultset >= resultSets.size()){
560 return false;
561 }else{
562 return true;
563 }
564 }
565
566 /** Moves to this <code>Statement</code> object's next result, deals with
567 * any current <code>ResultSet</code> object(s) according to the instructions
568 * specified by the given flag, and returns
569 * <code>true</code> if the next result is a <code>ResultSet</code> object.
570 *
571 * <P>There are no more results when the following is true:
572 * <PRE>
573 * <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
574 * </PRE>
575 *
576 * @param current one of the following <code>Statement</code>
577 * constants indicating what should happen to current
578 * <code>ResultSet</code> objects obtained using the method
579 * <code>getResultSet</code:
580 * <code>CLOSE_CURRENT_RESULT</code>,
581 * <code>KEEP_CURRENT_RESULT</code>, or
582 * <code>CLOSE_ALL_RESULTS</code>
583 * @return <code>true</code> if the next result is a <code>ResultSet</code>
584 * object; <code>false</code> if it is an update count or there are no
585 * more results
586 * @exception SQLException if a database access error occurs
587 * @since 1.4
588 * @see #execute
589 *
590 */
591 public boolean getMoreResults(int current) throws SQLException {
592 //they are 1 based we are 0 based
593 currentresultset = current-1;
594 return getMoreResults();
595 }
596
597 /** Retrieves the number of seconds the driver will
598 * wait for a <code>Statement</code> object to execute. If the limit is exceeded, a
599 * <code>SQLException</code> is thrown.
600 *
601 * @return the current query timeout limit in seconds; zero means there is
602 * no limit
603 * @exception SQLException if a database access error occurs
604 * @see #setQueryTimeout
605 *
606 */
607 public int getQueryTimeout() throws SQLException {
608 return 0;
609 }
610
611 /** Retrieves the current result as a <code>ResultSet</code> object.
612 * This method should be called only once per result.
613 *
614 * @return the current result as a <code>ResultSet</code> object or
615 * <code>null</code> if the result is an update count or there are no more results
616 * @exception SQLException if a database access error occurs
617 * @see #execute
618 *
619 */
620 public java.sql.ResultSet getResultSet() throws SQLException {
621 return (AResultSet)resultSets.get(currentresultset);
622 }
623
624 /** Retrieves the result set concurrency for <code>ResultSet</code> objects
625 * generated by this <code>Statement</code> object.
626 *
627 * @return either <code>ResultSet.CONCUR_READ_ONLY</code> or
628 * <code>ResultSet.CONCUR_UPDATABLE</code>
629 * @exception SQLException if a database access error occurs
630 * @since 1.2
631 *
632 */
633 public int getResultSetConcurrency() throws SQLException {
634 return 0;
635 }
636
637 /** Retrieves the result set holdability for <code>ResultSet</code> objects
638 * generated by this <code>Statement</code> object.
639 *
640 * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
641 * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
642 * @exception SQLException if a database access error occurs
643 *
644 * @since 1.4
645 *
646 */
647 public int getResultSetHoldability() throws SQLException {
648 return 0;
649 }
650
651 /** Retrieves the result set type for <code>ResultSet</code> objects
652 * generated by this <code>Statement</code> object.
653 *
654 * @return one of <code>ResultSet.TYPE_FORWARD_ONLY</code>,
655 * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
656 * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
657 * @exception SQLException if a database access error occurs
658 * @since 1.2
659 *
660 */
661 public int getResultSetType() throws SQLException {
662 return 0;
663 }
664
665 /** Retrieves the current result as an update count;
666 * if the result is a <code>ResultSet</code> object or there are no more results, -1
667 * is returned. This method should be called only once per result.
668 *
669 * @return the current result as an update count; -1 if the current result is a
670 * <code>ResultSet</code> object or there are no more results
671 * @exception SQLException if a database access error occurs
672 * @see #execute
673 *
674 */
675 public int getUpdateCount() throws SQLException {
676 return 0;
677 }
678
679 /** Retrieves the first warning reported by calls on this <code>Statement</code> object.
680 * Subsequent <code>Statement</code> object warnings will be chained to this
681 * <code>SQLWarning</code> object.
682 *
683 * <p>The warning chain is automatically cleared each time
684 * a statement is (re)executed. This method may not be called on a closed
685 * <code>Statement</code> object; doing so will cause an <code>SQLException</code>
686 * to be thrown.
687 *
688 * <P><B>Note:</B> If you are processing a <code>ResultSet</code> object, any
689 * warnings associated with reads on that <code>ResultSet</code> object
690 * will be chained on it rather than on the <code>Statement</code>
691 * object that produced it.
692 *
693 * @return the first <code>SQLWarning</code> object or <code>null</code>
694 * if there are no warnings
695 * @exception SQLException if a database access error occurs or this
696 * method is called on a closed statement
697 *
698 */
699 public SQLWarning getWarnings() throws SQLException {
700 return null;
701 }
702
703 /** Sets the SQL cursor name to the given <code>String</code>, which
704 * will be used by subsequent <code>Statement</code> object
705 * <code>execute</code> methods. This name can then be
706 * used in SQL positioned update or delete statements to identify the
707 * current row in the <code>ResultSet</code> object generated by this
708 * statement. If the database does not support positioned update/delete,
709 * this method is a noop. To insure that a cursor has the proper isolation
710 * level to support updates, the cursor's <code>SELECT</code> statement
711 * should have the form <code>SELECT FOR UPDATE</code>. If
712 * <code>FOR UPDATE</code> is not present, positioned updates may fail.
713 *
714 * <P><B>Note:</B> By definition, the execution of positioned updates and
715 * deletes must be done by a different <code>Statement</code> object than
716 * the one that generated the <code>ResultSet</code> object being used for
717 * positioning. Also, cursor names must be unique within a connection.
718 *
719 * @param name the new cursor name, which must be unique within
720 * a connection
721 * @exception SQLException if a database access error occurs
722 *
723 */
724 public void setCursorName(String name) throws SQLException {
725
726 }
727
728 /** Sets escape processing on or off.
729 * If escape scanning is on (the default), the driver will do
730 * escape substitution before sending the SQL statement to the database.
731 *
732 * Note: Since prepared statements have usually been parsed prior
733 * to making this call, disabling escape processing for
734 * <code>PreparedStatements</code> objects will have no effect.
735 *
736 * @param enable <code>true</code> to enable escape processing;
737 * <code>false</code> to disable it
738 * @exception SQLException if a database access error occurs
739 *
740 */
741 public void setEscapeProcessing(boolean enable) throws SQLException {
742 }
743
744 /** Gives the driver a hint as to the direction in which
745 * rows will be processed in <code>ResultSet</code>
746 * objects created using this <code>Statement</code> object. The
747 * default value is <code>ResultSet.FETCH_FORWARD</code>.
748 * <P>
749 * Note that this method sets the default fetch direction for
750 * result sets generated by this <code>Statement</code> object.
751 * Each result set has its own methods for getting and setting
752 * its own fetch direction.
753 *
754 * @param direction the initial direction for processing rows
755 * @exception SQLException if a database access error occurs
756 * or the given direction
757 * is not one of <code>ResultSet.FETCH_FORWARD</code>,
758 * <code>ResultSet.FETCH_REVERSE</code>, or <code>ResultSet.FETCH_UNKNOWN</code>
759 * @since 1.2
760 * @see #getFetchDirection
761 *
762 */
763 public void setFetchDirection(int direction) throws SQLException {
764 }
765
766 /** Gives the JDBC driver a hint as to the number of rows that should
767 * be fetched from the database when more rows are needed. The number
768 * of rows specified affects only result sets created using this
769 * statement. If the value specified is zero, then the hint is ignored.
770 * The default value is zero.
771 *
772 * @param rows the number of rows to fetch
773 * @exception SQLException if a database access error occurs, or the
774 * condition 0 <= <code>rows</code> <= <code>this.getMaxRows()</code>
775 * is not satisfied.
776 * @since 1.2
777 * @see #getFetchSize
778 *
779 */
780 public void setFetchSize(int rows) throws SQLException {
781 }
782
783 /** Sets the limit for the maximum number of bytes in a <code>ResultSet</code>
784 * column storing character or binary values to
785 * the given number of bytes. This limit applies
786 * only to <code>BINARY</code>, <code>VARBINARY</code>,
787 * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, and
788 * <code>LONGVARCHAR</code> fields. If the limit is exceeded, the excess data
789 * is silently discarded. For maximum portability, use values
790 * greater than 256.
791 *
792 * @param max the new column size limit in bytes; zero means there is no limit
793 * @exception SQLException if a database access error occurs
794 * or the condition max >= 0 is not satisfied
795 * @see #getMaxFieldSize
796 *
797 */
798 public void setMaxFieldSize(int max) throws SQLException {
799 }
800
801 /** Sets the limit for the maximum number of rows that any
802 * <code>ResultSet</code> object can contain to the given number.
803 * If the limit is exceeded, the excess
804 * rows are silently dropped.
805 *
806 * @param max the new max rows limit; zero means there is no limit
807 * @exception SQLException if a database access error occurs
808 * or the condition max >= 0 is not satisfied
809 * @see #getMaxRows
810 *
811 */
812 public void setMaxRows(int max) throws SQLException {
813 }
814
815 /** Sets the number of seconds the driver will wait for a
816 * <code>Statement</code> object to execute to the given number of seconds.
817 * If the limit is exceeded, an <code>SQLException</code> is thrown.
818 *
819 * @param seconds the new query timeout limit in seconds; zero means
820 * there is no limit
821 * @exception SQLException if a database access error occurs
822 * or the condition seconds >= 0 is not satisfied
823 * @see #getQueryTimeout
824 *
825 */
826 public void setQueryTimeout(int seconds) throws SQLException {
827 }
828 }