001: //** Copyright Statement ***************************************************
002: //The Salmon Open Framework for Internet Applications (SOFIA)
003: // Copyright (C) 1999 - 2002, Salmon LLC
004: //
005: // This program is free software; you can redistribute it and/or
006: // modify it under the terms of the GNU General Public License version 2
007: // as published by the Free Software Foundation;
008: //
009: // This program is distributed in the hope that it will be useful,
010: // but WITHOUT ANY WARRANTY; without even the implied warranty of
011: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
012: // GNU General Public License for more details.
013: //
014: // You should have received a copy of the GNU General Public License
015: // along with this program; if not, write to the Free Software
016: // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
017: //
018: // For more information please visit http://www.salmonllc.com
019: //** End Copyright Statement ***************************************************
020: package com.salmonllc.sql;
021:
022: /////////////////////////
023: //$Archive: /SOFIA/SourceCode/com/salmonllc/sql/DBStatement.java $
024: //$Author: Ross $
025: //$Revision: 12 $
026: //$Modtime: 8/05/04 6:10p $
027: /////////////////////////
028:
029: import java.sql.*;
030: import java.lang.reflect.Method;
031: import java.lang.reflect.InvocationTargetException;
032:
033: import com.salmonllc.util.*;
034:
035: /**
036: * This class serves as a wrapper around the standard java.sql.Statement. It behaves in the same way, except SQL Statements are written to the framework log file.
037: */
038: public class DBStatement implements Statement {
039: Statement _st;
040: DBConnection _conn;
041:
042: /**
043: * Creates a new DBStatement.
044: */
045: DBStatement(Statement st, DBConnection conn) {
046: super ();
047: _st = st;
048: _conn = conn;
049: }
050:
051: /**
052: * JDBC 2.0
053: *
054: * Adds a SQL command to the current batch of commmands for the statement.
055: * This method is optional.
056: *
057: * @param sql typically this is a static SQL INSERT or UPDATE statement
058: * @exception SQLException if a database access error occurs, or the
059: * driver does not support batch statements
060: */
061: public void addBatch(String sql) throws SQLException {
062: _st.addBatch(sql);
063: }
064:
065: /**
066: * JDBC 2.0
067: *
068: * Makes the set of commands in the current batch empty.
069: * This method is optional.
070: *
071: * @exception SQLException if a database access error occurs or the
072: * driver does not support batch statements
073: */
074: /**
075: * Cancels this Statement object if both the DBMS and driver support aborting an SQL statement.
076: */
077: public void cancel() throws SQLException {
078: _st.cancel();
079: }
080:
081: /**
082: * JDBC 2.0 Makes the set of commands in the current batch empty.
083: */
084: public void clearBatch() throws SQLException {
085: _st.clearBatch();
086: }
087:
088: /**
089: * Clears all the warnings reported on this Statement object.
090: */
091: public void clearWarnings() throws SQLException {
092: _st.clearWarnings();
093: }
094:
095: /**
096: * Releases this Statement object's database and JDBC resources immediately instead of waiting for this to happen when it is automatically closed.
097: */
098: public void close() throws SQLException {
099: _st.close();
100: }
101:
102: /**
103: * Executes a SQL statement that may return multiple results.
104: */
105: public boolean execute(String sql) throws SQLException {
106: MessageLog.writeSQLMessage("execute()", sql, this );
107: _conn.setLastSQL(sql);
108: return _st.execute(sql);
109: }
110:
111: /**
112: * JDBC 2.0Submits a batch of commands to the database for execution. This method is optional.
113: *@return an array of update counts containing one element for each command in the batch. The array is ordered according to the order in which commands were inserted into the batch.
114: */
115: public int[] executeBatch() throws SQLException {
116: return _st.executeBatch();
117: }
118:
119: /**
120: * Executes a SQL statement that returns a single ResultSet.
121: */
122: public ResultSet executeQuery(String sql) throws SQLException {
123: MessageLog.writeSQLMessage("executeQuery()", sql, this );
124: _conn.setLastSQL(sql);
125: return _st.executeQuery(sql);
126: }
127:
128: /**
129: *Executes an SQL INSERT, UPDATE or DELETE statement. In addition, SQL statements that return nothing, such as SQL DDL statements, can be executed.
130: */
131: public int executeUpdate(String sql) throws SQLException {
132: MessageLog.writeSQLMessage("executeUpdate()", sql, this );
133: _conn.setLastSQL(sql);
134: return _st.executeUpdate(sql);
135: }
136:
137: /**
138: * Returns the database connection this is statement is using
139: */
140: public Connection getConnection() throws SQLException {
141: return _st.getConnection();
142: }
143:
144: /**
145: * JDBC 2.0
146: *
147: * Retrieves the direction for fetching rows from
148: * database tables that is the default for result sets
149: * generated from this <code>Statement</code> object.
150: * If this <code>Statement</code> object has not set
151: * a fetch direction by calling the method <code>setFetchDirection</code>,
152: * the return value is implementation-specific.
153: *
154: * @return the default fetch direction for result sets generated
155: * from this <code>Statement</code> object
156: * @exception SQLException if a database access error occurs
157: */
158: public int getFetchDirection() throws SQLException {
159: return _st.getFetchDirection();
160: }
161:
162: /**
163: * JDBC 2.0
164: *
165: * Retrieves the number of result set rows that is the default
166: * fetch size for result sets
167: * generated from this <code>Statement</code> object.
168: * If this <code>Statement</code> object has not set
169: * a fetch size by calling the method <code>setFetchSize</code>,
170: * the return value is implementation-specific.
171: * @return the default fetch size for result sets generated
172: * from this <code>Statement</code> object
173: * @exception SQLException if a database access error occurs
174: */
175: public int getFetchSize() throws SQLException {
176: return _st.getFetchSize();
177: }
178:
179: /**
180: * Returns the maximum number of bytes allowed for any column value. This limit is the maximum number of bytes that can be returned for any column value. The limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.
181: */
182: public int getMaxFieldSize() throws SQLException {
183: return _st.getMaxFieldSize();
184: }
185:
186: /**
187: * Returns the maximum number of bytes allowed for any column value. This limit is the maximum number of bytes that can be returned for any column value. The limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR columns. If the limit is exceeded, the excess data is silently discarded.
188: */
189: public int getMaxRows() throws SQLException {
190: return _st.getMaxRows();
191: }
192:
193: /**
194: * Moves to a Statement's next result. It returns true if this result is a ResultSet. This method also implicitly closes any current ResultSet obtained with getResultSet. There are no more results when (!getMoreResults() && (getUpdateCount() == -1)
195: */
196: public boolean getMoreResults() throws SQLException {
197: return _st.getMoreResults();
198: }
199:
200: /**
201: * Retrieves the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.
202: */
203: public int getQueryTimeout() throws SQLException {
204: return _st.getQueryTimeout();
205: }
206:
207: /**
208: * Returns the current result as a ResultSet object. This method should be called only once per result.
209: */
210: public ResultSet getResultSet() throws SQLException {
211: return _st.getResultSet();
212: }
213:
214: /**
215: * JDBC 2.0 Retrieves the result set concurrency.
216: */
217: public int getResultSetConcurrency() throws java.sql.SQLException {
218: return _st.getResultSetConcurrency();
219: }
220:
221: /**
222: * JDBC 2.0
223: *
224: * Determine the result set type.
225: */
226: public int getResultSetType() throws SQLException {
227: return _st.getResultSetType();
228: }
229:
230: /**
231: * Returns the current result as an update count; if the result is a ResultSet or there are no more results, -1 is returned. This method should be called only once per result.
232: */
233: public int getUpdateCount() throws SQLException {
234: return _st.getUpdateCount();
235: }
236:
237: /**
238: * Retrieves the first warning reported by calls on this Statement. Subsequent Statement warnings will be chained to this SQLWarning.<BR><BR>
239: * The warning chain is automatically cleared each time a statement is (re)executed.<BR>
240: * Note: If you are processing a ResultSet, any warnings associated with ResultSet reads will be chained on the ResultSet object.
241: */
242: public SQLWarning getWarnings() throws SQLException {
243: return _st.getWarnings();
244: }
245:
246: /**
247: * Defines the SQL cursor name that will be used by subsequent Statement execute methods.
248: */
249: public void setCursorName(String name) throws SQLException {
250: _st.setCursorName(name);
251: }
252:
253: /**
254: * Sets escape processing on or off. If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. Note: Since prepared statements have usually been parsed prior to making this call, disabling escape processing for prepared statements will have no effect.
255: */
256: public void setEscapeProcessing(boolean enable) throws SQLException {
257: _st.setEscapeProcessing(enable);
258: }
259:
260: /**
261: * JDBC 2.0 Gives the driver a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this Statement object. The default value is ResultSet.FETCH_FORWARD.
262: * Note that this method sets the default fetch direction for result sets generated by this Statement object. Each result set has its own methods for getting and setting its own fetch direction.
263: */
264: public void setFetchDirection(int direction) throws SQLException {
265: _st.setFetchDirection(direction);
266: }
267:
268: /**
269: * JDBC 2.0
270: *
271: * Gives the JDBC driver a hint as to the number of rows that should
272: * be fetched from the database when more rows are needed. The number
273: * of rows specified affects only result sets created using this
274: * statement. If the value specified is zero, then the hint is ignored.
275: * The default value is zero.
276: *
277: * @param rows the number of rows to fetch
278: * @exception SQLException if a database access error occurs, or the
279: * condition 0 <= rows <= this.getMaxRows() is not satisfied.
280: */
281: public void setFetchSize(int rows) throws SQLException {
282: _st.setFetchSize(rows);
283: }
284:
285: /**
286: * Sets the limit for the maximum number of bytes in a column to the given number of bytes. This is the maximum number of bytes that can be returned for any column value. This limit applies only to BINARY, VARBINARY, LONGVARBINARY, CHAR, VARCHAR, and LONGVARCHAR fields. If the limit is exceeded, the excess data is silently discarded. For maximum portability, use values greater than 256.
287: */
288: public void setMaxFieldSize(int max) throws SQLException {
289: _st.setMaxFieldSize(max);
290: }
291:
292: /**
293: * Retrieves the maximum number of rows that a ResultSet can contain. If the limit is exceeded, the excess rows are silently dropped.
294: */
295: public void setMaxRows(int max) throws SQLException {
296: _st.setMaxFieldSize(max);
297: }
298:
299: /**
300: * Retrieves the number of seconds the driver will wait for a Statement to execute. If the limit is exceeded, a SQLException is thrown.
301: */
302: public void setQueryTimeout(int seconds) throws SQLException {
303: _st.setQueryTimeout(seconds);
304: }
305:
306: private Object findAndInvokeMethod(String method, Object[] args)
307: throws SQLException {
308: //Used to invoke methods in the underlying Statement Object dynamically.
309: //This is there so the class will be able to execute methods added in JDK 1.4, but still compile
310: //in JDK 1.2 and JDK 1.3
311: try {
312: Class[] c = new Class[args.length];
313: for (int i = 0; i < args.length; i++) {
314: if (args[i] instanceof Integer)
315: c[i] = Integer.TYPE;
316: else
317: c[i] = args[i].getClass();
318: }
319: Method m = _st.getClass().getMethod(method, c);
320: return m.invoke(_st, args);
321: } catch (InvocationTargetException e) {
322: if (e.getTargetException() instanceof SQLException)
323: throw (SQLException) e.getTargetException();
324: else
325: return null;
326: } catch (Exception e) {
327: return null;
328: }
329: }
330:
331: /**
332: * Executes the given SQL statement, which may return multiple results,
333: * and signals the driver that any
334: * auto-generated keys should be made available
335: * for retrieval. The driver will ignore this signal if the SQL statement
336: * is not an <code>INSERT</code> statement.
337: * <P>
338: * In some (uncommon) situations, a single SQL statement may return
339: * multiple result sets and/or update counts. Normally you can ignore
340: * this unless you are (1) executing a stored procedure that you know may
341: * return multiple results or (2) you are dynamically executing an
342: * unknown SQL string.
343: * <P>
344: * The <code>execute</code> method executes an SQL statement and indicates the
345: * form of the first result. You must then use the methods
346: * <code>getResultSet</code> or <code>getUpdateCount</code>
347: * to retrieve the result, and <code>getMoreResults</code> to
348: * move to any subsequent result(s).
349: *
350: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
351: *
352: *
353: * @param sql any SQL statement
354: * @param autoGeneratedKeys a constant indicating whether auto-generated
355: * keys should be made available for retrieval using the method
356: * <code>getGeneratedKeys</code>; one of the following constants:
357: * <code>Statement.RETURN_GENERATED_KEYS</code> or
358: * <code>Statement.NO_GENERATED_KEYS</code>
359: * @return <code>true</code> if the first result is a <code>ResultSet</code>
360: * object; <code>false</code> if it is an update count or there are
361: * no results
362: * @exception SQLException if a database access error occurs
363: * @see #getResultSet
364: * @see #getUpdateCount
365: * @see #getMoreResults
366: * @see #getGeneratedKeys
367: *
368: * @since 1.4
369: */
370: public boolean execute(String sql, int autoGeneratedKeys)
371: throws SQLException {
372: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
373: MessageLog.writeSQLMessage("execute()", sql, this );
374: _conn.setLastSQL(sql);
375: Object args[] = { sql, new Integer(autoGeneratedKeys) };
376: Object ret = findAndInvokeMethod("execute", args);
377: if (ret != null)
378: return ((Boolean) ret).booleanValue();
379: else
380: return false;
381: }
382:
383: /**
384: * Executes the given SQL statement, which may return multiple results,
385: * and signals the driver that the
386: * auto-generated keys indicated in the given array should be made available
387: * for retrieval. This array contains the indexes of the columns in the
388: * target table that contain the auto-generated keys that should be made
389: * available. The driver will ignore the array if the given SQL statement
390: * is not an <code>INSERT</code> statement.
391: * <P>
392: * Under some (uncommon) situations, a single SQL statement may return
393: * multiple result sets and/or update counts. Normally you can ignore
394: * this unless you are (1) executing a stored procedure that you know may
395: * return multiple results or (2) you are dynamically executing an
396: * unknown SQL string.
397: * <P>
398: * The <code>execute</code> method executes an SQL statement and indicates the
399: * form of the first result. You must then use the methods
400: * <code>getResultSet</code> or <code>getUpdateCount</code>
401: * to retrieve the result, and <code>getMoreResults</code> to
402: * move to any subsequent result(s).
403: *
404: *
405: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
406: *
407: * @param sql any SQL statement
408: * @param columnIndexes an array of the indexes of the columns in the
409: * inserted row that should be made available for retrieval by a
410: * call to the method <code>getGeneratedKeys</code>
411: * @return <code>true</code> if the first result is a <code>ResultSet</code>
412: * object; <code>false</code> if it is an update count or there
413: * are no results
414: * @exception SQLException if a database access error occurs
415: * @see #getResultSet
416: * @see #getUpdateCount
417: * @see #getMoreResults
418: *
419: * @since 1.4
420: */
421: public boolean execute(String sql, int[] columnIndexes)
422: throws SQLException {
423: //This calls the findAndInvokeSQL so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
424: MessageLog.writeSQLMessage("execute()", sql, this );
425: _conn.setLastSQL(sql);
426: Object args[] = { sql, columnIndexes };
427: Object ret = findAndInvokeMethod("execute", args);
428: if (ret != null)
429: return ((Boolean) ret).booleanValue();
430: else
431: return false;
432: }
433:
434: /**
435: * Executes the given SQL statement, which may return multiple results,
436: * and signals the driver that the
437: * auto-generated keys indicated in the given array should be made available
438: * for retrieval. This array contains the names of the columns in the
439: * target table that contain the auto-generated keys that should be made
440: * available. The driver will ignore the array if the given SQL statement
441: * is not an <code>INSERT</code> statement.
442: * <P>
443: * In some (uncommon) situations, a single SQL statement may return
444: * multiple result sets and/or update counts. Normally you can ignore
445: * this unless you are (1) executing a stored procedure that you know may
446: * return multiple results or (2) you are dynamically executing an
447: * unknown SQL string.
448: * <P>
449: * The <code>execute</code> method executes an SQL statement and indicates the
450: * form of the first result. You must then use the methods
451: * <code>getResultSet</code> or <code>getUpdateCount</code>
452: * to retrieve the result, and <code>getMoreResults</code> to
453: * move to any subsequent result(s).
454: *
455: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
456: *
457: * @param sql any SQL statement
458: * @param columnNames an array of the names of the columns in the inserted
459: * row that should be made available for retrieval by a call to the
460: * method <code>getGeneratedKeys</code>
461: * @return <code>true</code> if the next result is a <code>ResultSet</code>
462: * object; <code>false</code> if it is an update count or there
463: * are no more results
464: * @exception SQLException if a database access error occurs
465: * @see #getResultSet
466: * @see #getUpdateCount
467: * @see #getMoreResults
468: * @see #getGeneratedKeys
469: *
470: * @since 1.4
471: */
472: public boolean execute(String sql, String[] columnNames)
473: throws SQLException {
474: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
475: MessageLog.writeSQLMessage("execute()", sql, this );
476: _conn.setLastSQL(sql);
477: Object args[] = { sql, columnNames };
478: Object ret = findAndInvokeMethod("execute", args);
479: if (ret != null)
480: return ((Boolean) ret).booleanValue();
481: else
482: return false;
483: }
484:
485: /**
486: * Executes the given SQL statement and signals the driver with the
487: * given flag about whether the
488: * auto-generated keys produced by this <code>Statement</code> object
489: * should be made available for retrieval.
490: *
491: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
492: *
493: * @param sql must be an SQL <code>INSERT</code>, <code>UPDATE</code> or
494: * <code>DELETE</code> statement or an SQL statement that
495: * returns nothing
496: * @param autoGeneratedKeys a flag indicating whether auto-generated keys
497: * should be made available for retrieval;
498: * one of the following constants:
499: * <code>Statement.RETURN_GENERATED_KEYS</code>
500: * <code>Statement.NO_GENERATED_KEYS</code>
501: * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>
502: * or <code>DELETE</code> statements, or <code>0</code> for SQL
503: * statements that return nothing
504: * @exception SQLException if a database access error occurs, the given
505: * SQL statement returns a <code>ResultSet</code> object, or
506: * the given constant is not one of those allowed
507: * @since 1.4
508: */
509: public int executeUpdate(String sql, int autoGeneratedKeys)
510: throws SQLException {
511: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
512: MessageLog.writeSQLMessage("executeUpdate()", sql, this );
513: _conn.setLastSQL(sql);
514: Object args[] = { sql, new Integer(autoGeneratedKeys) };
515: Object ret = findAndInvokeMethod("executeUpdate", args);
516: if (ret != null)
517: return ((Integer) ret).intValue();
518: else
519: return 0;
520: }
521:
522: /**
523: * Executes the given SQL statement and signals the driver that the
524: * auto-generated keys indicated in the given array should be made available
525: * for retrieval. The driver will ignore the array if the SQL statement
526: * is not an <code>INSERT</code> statement.
527: *
528: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
529: *
530: * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
531: * <code>DELETE</code> statement or an SQL statement that returns nothing,
532: * such as an SQL DDL statement
533: * @param columnIndexes an array of column indexes indicating the columns
534: * that should be returned from the inserted row
535: * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
536: * or <code>DELETE</code> statements, or 0 for SQL statements
537: * that return nothing
538: * @exception SQLException if a database access error occurs or the SQL
539: * statement returns a <code>ResultSet</code> object
540: * @since 1.4
541: */
542: public int executeUpdate(String sql, int[] columnIndexes)
543: throws SQLException {
544: MessageLog.writeSQLMessage("executeUpdate()", sql, this );
545: _conn.setLastSQL(sql);
546: Object args[] = { sql, columnIndexes };
547: Object ret = findAndInvokeMethod("executeUpdate", args);
548: if (ret != null)
549: return ((Integer) ret).intValue();
550: else
551: return 0;
552: }
553:
554: /**
555: * Executes the given SQL statement and signals the driver that the
556: * auto-generated keys indicated in the given array should be made available
557: * for retrieval. The driver will ignore the array if the SQL statement
558: * is not an <code>INSERT</code> statement.
559: *
560: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
561: *
562: * @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
563: * <code>DELETE</code> statement or an SQL statement that returns nothing
564: * @param columnNames an array of the names of the columns that should be
565: * returned from the inserted row
566: * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
567: * or <code>DELETE</code> statements, or 0 for SQL statements
568: * that return nothing
569: * @exception SQLException if a database access error occurs
570: *
571: * @since 1.4
572: */
573: public int executeUpdate(String sql, String[] columnNames)
574: throws SQLException {
575: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
576:
577: MessageLog.writeSQLMessage("executeUpdate()", sql, this );
578: _conn.setLastSQL(sql);
579: Object args[] = { sql, columnNames };
580: Object ret = findAndInvokeMethod("executeUpdate", args);
581: if (ret != null)
582: return ((Integer) ret).intValue();
583: else
584: return 0;
585: }
586:
587: /**
588: * Retrieves any auto-generated keys created as a result of executing this
589: * <code>Statement</code> object. If this <code>Statement</code> object did
590: * not generate any keys, an empty <code>ResultSet</code>
591: * object is returned.
592: *
593: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
594: *
595: *
596: * @return a <code>ResultSet</code> object containing the auto-generated key(s)
597: * generated by the execution of this <code>Statement</code> object
598: * @exception SQLException if a database access error occurs
599: * @since 1.4
600: */
601: public ResultSet getGeneratedKeys() throws SQLException {
602: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
603:
604: Object args[] = {};
605: return (ResultSet) findAndInvokeMethod("getGeneratedKeys", args);
606: }
607:
608: /**
609: * Moves to this <code>Statement</code> object's next result, returns
610: * <code>true</code> if it is a <code>ResultSet</code> object, and
611: * implicitly closes any current <code>ResultSet</code>
612: * object(s) obtained with the method <code>getResultSet</code>.
613: *
614: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
615: *
616: * <P>There are no more results when the following is true:
617: * <PRE>
618: * <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
619: * </PRE>
620: *
621: * @return <code>true</code> if the next result is a <code>ResultSet</code>
622: * object; <code>false</code> if it is an update count or there are
623: * no more results
624: * @exception SQLException if a database access error occurs
625: * @see #execute
626: */
627: public boolean getMoreResults(int current) throws SQLException {
628: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
629:
630: Object args[] = { new Integer(current) };
631: Object ret = findAndInvokeMethod("getMoreResults", args);
632: if (ret != null)
633: return ((Boolean) ret).booleanValue();
634: else
635: return false;
636: }
637:
638: /**
639: * Retrieves the result set holdability for <code>ResultSet</code> objects
640: * generated by this <code>Statement</code> object.
641: *
642: * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
643: * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
644: * @exception SQLException if a database access error occurs
645: *
646: * This will compile in JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
647: *
648: * @since 1.4
649: */
650: public int getResultSetHoldability() throws SQLException {
651: //This calls the findAndInvokeMethod so it will compile from JDK 1.3 and 1.4. It should only be called from a 1.4 JVM.
652:
653: Object args[] = {};
654: Object ret = findAndInvokeMethod("getResultSetHoldability",
655: args);
656: if (ret != null)
657: return ((Integer) ret).intValue();
658: else
659: return 0;
660: }
661:
662: }
|