Main Page | Packages | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

jdk1.3/java/sql/Statement.java

00001 /**
00002  * C-JDBC: Clustered JDBC.
00003  * Copyright (C) 2002-2004 French National Institute For Research In Computer
00004  * Science And Control (INRIA).
00005  * Contact: c-jdbc@objectweb.org
00006  * 
00007  * This library is free software; you can redistribute it and/or modify it
00008  * under the terms of the GNU Lesser General Public License as published by the
00009  * Free Software Foundation; either version 2.1 of the License, or any later
00010  * version.
00011  * 
00012  * This library is distributed in the hope that it will be useful, but WITHOUT
00013  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00014  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
00015  * for more details.
00016  * 
00017  * You should have received a copy of the GNU Lesser General Public License
00018  * along with this library; if not, write to the Free Software Foundation,
00019  * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
00020  *
00021  * Initial developer(s): Emmanuel Cecchet.
00022  * Contributor(s): ______________________________________.
00023  */
00024 
00025 package java.sql;
00026 
00027 /**
00028  * This class provides JDBC 3.0 extensions to compile with JDK 1.3.
00029  */
00030 public interface Statement
00031 {
00032   /**
00033    * Executes the given SQL statement, which returns a single
00034    * <code>ResultSet</code> object.
00035    * 
00036    * @param sql an SQL statement to be sent to the database, typically a static
00037    *          SQL <code>SELECT</code> statement
00038    * @return a <code>ResultSet</code> object that contains the data produced
00039    *         by the given query; never <code>null</code>
00040    * @exception SQLException if a database access error occurs or the given SQL
00041    *              statement produces anything other than a single
00042    *              <code>ResultSet</code> object
00043    */
00044   ResultSet executeQuery(String sql) throws SQLException;
00045 
00046   /**
00047    * Executes the given SQL statement, which may be an <code>INSERT</code>,
00048    * <code>UPDATE</code>, or <code>DELETE</code> statement or an SQL
00049    * statement that returns nothing, such as an SQL DDL statement.
00050    * 
00051    * @param sql an SQL <code>INSERT</code>,<code>UPDATE</code> or
00052    *          <code>DELETE</code> statement or an SQL statement that returns
00053    *          nothing
00054    * @return either the row count for <code>INSERT</code>,
00055    *         <code>UPDATE</code> or <code>DELETE</code> statements, or
00056    *         <code>0</code> for SQL statements that return nothing
00057    * @exception SQLException if a database access error occurs or the given SQL
00058    *              statement produces a <code>ResultSet</code> object
00059    */
00060   int executeUpdate(String sql) throws SQLException;
00061 
00062   /**
00063    * Releases this <code>Statement</code> object's database and JDBC resources
00064    * immediately instead of waiting for this to happen when it is automatically
00065    * closed. It is generally good practice to release resources as soon as you
00066    * are finished with them to avoid tying up database resources.
00067    * <P>
00068    * Calling the method <code>close</code> on a <code>Statement</code>
00069    * object that is already closed has no effect.
00070    * <P>
00071    * <B>Note: </B> A <code>Statement</code> object is automatically closed
00072    * when it is garbage collected. When a <code>Statement</code> object is
00073    * closed, its current <code>ResultSet</code> object, if one exists, is also
00074    * closed.
00075    * 
00076    * @exception SQLException if a database access error occurs
00077    */
00078   void close() throws SQLException;
00079 
00080   //----------------------------------------------------------------------
00081 
00082   /**
00083    * Retrieves the maximum number of bytes that can be returned for character
00084    * and binary column values in a <code>ResultSet</code> object produced by
00085    * this <code>Statement</code> object. This limit applies only to
00086    * <code>BINARY</code>,<code>VARBINARY</code>,
00087    * <code>LONGVARBINARY</code>,<code>CHAR</code>,<code>VARCHAR</code>,
00088    * and <code>LONGVARCHAR</code> columns. If the limit is exceeded, the
00089    * excess data is silently discarded.
00090    * 
00091    * @return the current column size limit for columns storing character and
00092    *         binary values; zero means there is no limit
00093    * @exception SQLException if a database access error occurs
00094    * @see #setMaxFieldSize
00095    */
00096   int getMaxFieldSize() throws SQLException;
00097 
00098   /**
00099    * Sets the limit for the maximum number of bytes in a <code>ResultSet</code>
00100    * column storing character or binary values to the given number of bytes.
00101    * This limit applies only to <code>BINARY</code>,<code>VARBINARY</code>,
00102    * <code>LONGVARBINARY</code>,<code>CHAR</code>,<code>VARCHAR</code>,
00103    * and <code>LONGVARCHAR</code> fields. If the limit is exceeded, the excess
00104    * data is silently discarded. For maximum portability, use values greater
00105    * than 256.
00106    * 
00107    * @param max the new column size limit in bytes; zero means there is no limit
00108    * @exception SQLException if a database access error occurs or the condition
00109    *              max >= 0 is not satisfied
00110    * @see #getMaxFieldSize
00111    */
00112   void setMaxFieldSize(int max) throws SQLException;
00113 
00114   /**
00115    * Retrieves the maximum number of rows that a <code>ResultSet</code> object
00116    * produced by this <code>Statement</code> object can contain. If this limit
00117    * is exceeded, the excess rows are silently dropped.
00118    * 
00119    * @return the current maximum number of rows for a <code>ResultSet</code>
00120    *         object produced by this <code>Statement</code> object; zero means
00121    *         there is no limit
00122    * @exception SQLException if a database access error occurs
00123    * @see #setMaxRows
00124    */
00125   int getMaxRows() throws SQLException;
00126 
00127   /**
00128    * Sets the limit for the maximum number of rows that any
00129    * <code>ResultSet</code> object can contain to the given number. If the
00130    * limit is exceeded, the excess rows are silently dropped.
00131    * 
00132    * @param max the new max rows limit; zero means there is no limit
00133    * @exception SQLException if a database access error occurs or the condition
00134    *              max >= 0 is not satisfied
00135    * @see #getMaxRows
00136    */
00137   void setMaxRows(int max) throws SQLException;
00138 
00139   /**
00140    * Sets escape processing on or off. If escape scanning is on (the default),
00141    * the driver will do escape substitution before sending the SQL statement to
00142    * the database. Note: Since prepared statements have usually been parsed
00143    * prior to making this call, disabling escape processing for
00144    * <code>PreparedStatements</code> objects will have no effect.
00145    * 
00146    * @param enable <code>true</code> to enable escape processing;
00147    *          <code>false</code> to disable it
00148    * @exception SQLException if a database access error occurs
00149    */
00150   void setEscapeProcessing(boolean enable) throws SQLException;
00151 
00152   /**
00153    * Retrieves the number of seconds the driver will wait for a
00154    * <code>Statement</code> object to execute. If the limit is exceeded, a
00155    * <code>SQLException</code> is thrown.
00156    * 
00157    * @return the current query timeout limit in seconds; zero means there is no
00158    *         limit
00159    * @exception SQLException if a database access error occurs
00160    * @see #setQueryTimeout
00161    */
00162   int getQueryTimeout() throws SQLException;
00163 
00164   /**
00165    * Sets the number of seconds the driver will wait for a
00166    * <code>Statement</code> object to execute to the given number of seconds.
00167    * If the limit is exceeded, an <code>SQLException</code> is thrown.
00168    * 
00169    * @param seconds the new query timeout limit in seconds; zero means there is
00170    *          no limit
00171    * @exception SQLException if a database access error occurs or the condition
00172    *              seconds >= 0 is not satisfied
00173    * @see #getQueryTimeout
00174    */
00175   void setQueryTimeout(int seconds) throws SQLException;
00176 
00177   /**
00178    * Cancels this <code>Statement</code> object if both the DBMS and driver
00179    * support aborting an SQL statement. This method can be used by one thread to
00180    * cancel a statement that is being executed by another thread.
00181    * 
00182    * @exception SQLException if a database access error occurs
00183    */
00184   void cancel() throws SQLException;
00185 
00186   /**
00187    * Retrieves the first warning reported by calls on this
00188    * <code>Statement</code> object. Subsequent <code>Statement</code> object
00189    * warnings will be chained to this <code>SQLWarning</code> object.
00190    * <p>
00191    * The warning chain is automatically cleared each time a statement is
00192    * (re)executed. This method may not be called on a closed
00193    * <code>Statement</code> object; doing so will cause an
00194    * <code>SQLException</code> to be thrown.
00195    * <P>
00196    * <B>Note: </B> If you are processing a <code>ResultSet</code> object, any
00197    * warnings associated with reads on that <code>ResultSet</code> object will
00198    * be chained on it rather than on the <code>Statement</code> object that
00199    * produced it.
00200    * 
00201    * @return the first <code>SQLWarning</code> object or <code>null</code>
00202    *         if there are no warnings
00203    * @exception SQLException if a database access error occurs or this method is
00204    *              called on a closed statement
00205    */
00206   SQLWarning getWarnings() throws SQLException;
00207 
00208   /**
00209    * Clears all the warnings reported on this <code>Statement</code> object.
00210    * After a call to this method, the method <code>getWarnings</code> will
00211    * return <code>null</code> until a new warning is reported for this
00212    * <code>Statement</code> object.
00213    * 
00214    * @exception SQLException if a database access error occurs
00215    */
00216   void clearWarnings() throws SQLException;
00217 
00218   /**
00219    * Sets the SQL cursor name to the given <code>String</code>, which will be
00220    * used by subsequent <code>Statement</code> object <code>execute</code>
00221    * methods. This name can then be used in SQL positioned update or delete
00222    * statements to identify the current row in the <code>ResultSet</code>
00223    * object generated by this statement. If the database does not support
00224    * positioned update/delete, this method is a noop. To insure that a cursor
00225    * has the proper isolation level to support updates, the cursor's
00226    * <code>SELECT</code> statement should have the form
00227    * <code>SELECT FOR UPDATE</code>. If <code>FOR UPDATE</code> is not
00228    * present, positioned updates may fail.
00229    * <P>
00230    * <B>Note: </B> By definition, the execution of positioned updates and
00231    * deletes must be done by a different <code>Statement</code> object than
00232    * the one that generated the <code>ResultSet</code> object being used for
00233    * positioning. Also, cursor names must be unique within a connection.
00234    * 
00235    * @param name the new cursor name, which must be unique within a connection
00236    * @exception SQLException if a database access error occurs
00237    */
00238   void setCursorName(String name) throws SQLException;
00239 
00240   //----------------------- Multiple Results --------------------------
00241 
00242   /**
00243    * Executes the given SQL statement, which may return multiple results. In
00244    * some (uncommon) situations, a single SQL statement may return multiple
00245    * result sets and/or update counts. Normally you can ignore this unless you
00246    * are (1) executing a stored procedure that you know may return multiple
00247    * results or (2) you are dynamically executing an unknown SQL string.
00248    * <P>
00249    * The <code>execute</code> method executes an SQL statement and indicates
00250    * the form of the first result. You must then use the methods
00251    * <code>getResultSet</code> or <code>getUpdateCount</code> to retrieve
00252    * the result, and <code>getMoreResults</code> to move to any subsequent
00253    * result(s).
00254    * 
00255    * @param sql any SQL statement
00256    * @return <code>true</code> if the first result is a <code>ResultSet</code>
00257    *         object; <code>false</code> if it is an update count or there are
00258    *         no results
00259    * @exception SQLException if a database access error occurs
00260    * @see #getResultSet
00261    * @see #getUpdateCount
00262    * @see #getMoreResults()
00263    */
00264   boolean execute(String sql) throws SQLException;
00265 
00266   /**
00267    * Retrieves the current result as a <code>ResultSet</code> object. This
00268    * method should be called only once per result.
00269    * 
00270    * @return the current result as a <code>ResultSet</code> object or
00271    *         <code>null</code> if the result is an update count or there are
00272    *         no more results
00273    * @exception SQLException if a database access error occurs
00274    * @see #execute(String)
00275    */
00276   ResultSet getResultSet() throws SQLException;
00277 
00278   /**
00279    * Retrieves the current result as an update count; if the result is a
00280    * <code>ResultSet</code> object or there are no more results, -1 is
00281    * returned. This method should be called only once per result.
00282    * 
00283    * @return the current result as an update count; -1 if the current result is
00284    *         a <code>ResultSet</code> object or there are no more results
00285    * @exception SQLException if a database access error occurs
00286    * @see #execute(String)
00287    */
00288   int getUpdateCount() throws SQLException;
00289 
00290   /**
00291    * Moves to this <code>Statement</code> object's next result, returns
00292    * <code>true</code> if it is a <code>ResultSet</code> object, and
00293    * implicitly closes any current <code>ResultSet</code> object(s) obtained
00294    * with the method <code>getResultSet</code>.
00295    * <P>
00296    * There are no more results when the following is true:
00297    * 
00298    * <PRE>
00299    *      <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
00300    * </PRE>
00301    * 
00302    * @return <code>true</code> if the next result is a <code>ResultSet</code>
00303    *         object; <code>false</code> if it is an update count or there are
00304    *         no more results
00305    * @exception SQLException if a database access error occurs
00306    * @see #execute(String)
00307    */
00308   boolean getMoreResults() throws SQLException;
00309 
00310   //--------------------------JDBC 2.0-----------------------------
00311 
00312   /**
00313    * Gives the driver a hint as to the direction in which rows will be processed
00314    * in <code>ResultSet</code> objects created using this
00315    * <code>Statement</code> object. The default value is
00316    * <code>ResultSet.FETCH_FORWARD</code>.
00317    * <P>
00318    * Note that this method sets the default fetch direction for result sets
00319    * generated by this <code>Statement</code> object. Each result set has its
00320    * own methods for getting and setting its own fetch direction.
00321    * 
00322    * @param direction the initial direction for processing rows
00323    * @exception SQLException if a database access error occurs or the given
00324    *              direction is not one of <code>ResultSet.FETCH_FORWARD</code>,
00325    *              <code>ResultSet.FETCH_REVERSE</code>, or
00326    *              <code>ResultSet.FETCH_UNKNOWN</code>
00327    * @since 1.2
00328    * @see #getFetchDirection
00329    */
00330   void setFetchDirection(int direction) throws SQLException;
00331 
00332   /**
00333    * Retrieves the direction for fetching rows from database tables that is the
00334    * default for result sets generated from this <code>Statement</code>
00335    * object. If this <code>Statement</code> object has not set a fetch
00336    * direction by calling the method <code>setFetchDirection</code>, the
00337    * return value is implementation-specific.
00338    * 
00339    * @return the default fetch direction for result sets generated from this
00340    *         <code>Statement</code> object
00341    * @exception SQLException if a database access error occurs
00342    * @since 1.2
00343    * @see #setFetchDirection
00344    */
00345   int getFetchDirection() throws SQLException;
00346 
00347   /**
00348    * Gives the JDBC driver a hint as to the number of rows that should be
00349    * fetched from the database when more rows are needed. The number of rows
00350    * specified affects only result sets created using this statement. If the
00351    * value specified is zero, then the hint is ignored. The default value is
00352    * zero.
00353    * 
00354    * @param rows the number of rows to fetch
00355    * @exception SQLException if a database access error occurs, or the condition
00356    *              0 <=<code>rows</code><=<code>
00357    *              this.getMaxRows()</code>
00358    *              is not satisfied.
00359    * @since 1.2
00360    * @see #getFetchSize
00361    */
00362   void setFetchSize(int rows) throws SQLException;
00363 
00364   /**
00365    * Retrieves the number of result set rows that is the default fetch size for
00366    * <code>ResultSet</code> objects generated from this <code>Statement</code>
00367    * object. If this <code>Statement</code> object has not set a fetch size by
00368    * calling the method <code>setFetchSize</code>, the return value is
00369    * implementation-specific.
00370    * 
00371    * @return the default fetch size for result sets generated from this
00372    *         <code>Statement</code> object
00373    * @exception SQLException if a database access error occurs
00374    * @since 1.2
00375    * @see #setFetchSize
00376    */
00377   int getFetchSize() throws SQLException;
00378 
00379   /**
00380    * Retrieves the result set concurrency for <code>ResultSet</code> objects
00381    * generated by this <code>Statement</code> object.
00382    * 
00383    * @return either <code>ResultSet.CONCUR_READ_ONLY</code> or
00384    *         <code>ResultSet.CONCUR_UPDATABLE</code>
00385    * @exception SQLException if a database access error occurs
00386    * @since 1.2
00387    */
00388   int getResultSetConcurrency() throws SQLException;
00389 
00390   /**
00391    * Retrieves the result set type for <code>ResultSet</code> objects
00392    * generated by this <code>Statement</code> object.
00393    * 
00394    * @return one of <code>ResultSet.TYPE_FORWARD_ONLY</code>,
00395    *         <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or
00396    *         <code>ResultSet.TYPE_SCROLL_SENSITIVE</code>
00397    * @exception SQLException if a database access error occurs
00398    * @since 1.2
00399    */
00400   int getResultSetType() throws SQLException;
00401 
00402   /**
00403    * Adds the given SQL command to the current list of commmands for this
00404    * <code>Statement</code> object. The commands in this list can be executed
00405    * as a batch by calling the method <code>executeBatch</code>.
00406    * <P>
00407    * <B>NOTE: </B> This method is optional.
00408    * 
00409    * @param sql typically this is a static SQL <code>INSERT</code> or
00410    *          <code>UPDATE</code> statement
00411    * @exception SQLException if a database access error occurs, or the driver
00412    *              does not support batch updates
00413    * @see #executeBatch
00414    * @since 1.2
00415    */
00416   void addBatch(String sql) throws SQLException;
00417 
00418   /**
00419    * Empties this <code>Statement</code> object's current list of SQL
00420    * commands.
00421    * <P>
00422    * <B>NOTE: </B> This method is optional.
00423    * 
00424    * @exception SQLException if a database access error occurs or the driver
00425    *              does not support batch updates
00426    * @see #addBatch
00427    * @since 1.2
00428    */
00429   void clearBatch() throws SQLException;
00430 
00431   /**
00432    * Submits a batch of commands to the database for execution and if all
00433    * commands execute successfully, returns an array of update counts. The
00434    * <code>int</code> elements of the array that is returned are ordered to
00435    * correspond to the commands in the batch, which are ordered according to the
00436    * order in which they were added to the batch. The elements in the array
00437    * returned by the method <code>executeBatch</code> may be one of the
00438    * following:
00439    * <OL>
00440    * <LI>A number greater than or equal to zero -- indicates that the command
00441    * was processed successfully and is an update count giving the number of rows
00442    * in the database that were affected by the command's execution
00443    * <LI>A value of <code>SUCCESS_NO_INFO</code>-- indicates that the
00444    * command was processed successfully but that the number of rows affected is
00445    * unknown
00446    * <P>
00447    * If one of the commands in a batch update fails to execute properly, this
00448    * method throws a <code>BatchUpdateException</code>, and a JDBC driver may
00449    * or may not continue to process the remaining commands in the batch.
00450    * However, the driver's behavior must be consistent with a particular DBMS,
00451    * either always continuing to process commands or never continuing to process
00452    * commands. If the driver continues processing after a failure, the array
00453    * returned by the method <code>BatchUpdateException.getUpdateCounts</code>
00454    * will contain as many elements as there are commands in the batch, and at
00455    * least one of the elements will be the following:
00456    * <P>
00457    * <LI>A value of <code>EXECUTE_FAILED</code>-- indicates that the command
00458    * failed to execute successfully and occurs only if a driver continues to
00459    * process commands after a command fails
00460    * </OL>
00461    * <P>
00462    * A driver is not required to implement this method. The possible
00463    * implementations and return values have been modified in the Java 2 SDK,
00464    * Standard Edition, version 1.3 to accommodate the option of continuing to
00465    * proccess commands in a batch update after a
00466    * <code>BatchUpdateException</code> obejct has been thrown.
00467    * 
00468    * @return an array of update counts containing one element for each command
00469    *         in the batch. The elements of the array are ordered according to
00470    *         the order in which commands were added to the batch.
00471    * @exception SQLException if a database access error occurs or the driver
00472    *              does not support batch statements. Throws
00473    *              {@link BatchUpdateException}(a subclass of
00474    *              <code>SQLException</code>) if one of the commands sent to
00475    *              the database fails to execute properly or attempts to return a
00476    *              result set.
00477    * @since 1.3
00478    */
00479   int[] executeBatch() throws SQLException;
00480 
00481   /**
00482    * Retrieves the <code>Connection</code> object that produced this
00483    * <code>Statement</code> object.
00484    * 
00485    * @return the connection that produced this statement
00486    * @exception SQLException if a database access error occurs
00487    * @since 1.2
00488    */
00489   Connection getConnection() throws SQLException;
00490 
00491   //--------------------------JDBC 3.0-----------------------------
00492 
00493   /**
00494    * The constant indicating that the current <code>ResultSet</code> object
00495    * should be closed when calling <code>getMoreResults</code>.
00496    * 
00497    * @since 1.4
00498    */
00499   int CLOSE_CURRENT_RESULT  = 1;
00500 
00501   /**
00502    * The constant indicating that the current <code>ResultSet</code> object
00503    * should not be closed when calling <code>getMoreResults</code>.
00504    * 
00505    * @since 1.4
00506    */
00507   int KEEP_CURRENT_RESULT   = 2;
00508 
00509   /**
00510    * The constant indicating that all <code>ResultSet</code> objects that have
00511    * previously been kept open should be closed when calling
00512    * <code>getMoreResults</code>.
00513    * 
00514    * @since 1.4
00515    */
00516   int CLOSE_ALL_RESULTS     = 3;
00517 
00518   /**
00519    * The constant indicating that a batch statement executed successfully but
00520    * that no count of the number of rows it affected is available.
00521    * 
00522    * @since 1.4
00523    */
00524   int SUCCESS_NO_INFO       = -2;
00525 
00526   /**
00527    * The constant indicating that an error occured while executing a batch
00528    * statement.
00529    * 
00530    * @since 1.4
00531    */
00532   int EXECUTE_FAILED        = -3;
00533 
00534   /**
00535    * The constant indicating that generated keys should be made available for
00536    * retrieval.
00537    * 
00538    * @since 1.4
00539    */
00540   int RETURN_GENERATED_KEYS = 1;
00541 
00542   /**
00543    * The constant indicating that generated keys should not be made available
00544    * for retrieval.
00545    * 
00546    * @since 1.4
00547    */
00548   int NO_GENERATED_KEYS     = 2;
00549 
00550   /**
00551    * Moves to this <code>Statement</code> object's next result, deals with any
00552    * current <code>ResultSet</code> object(s) according to the instructions
00553    * specified by the given flag, and returns <code>true</code> if the next
00554    * result is a <code>ResultSet</code> object.
00555    * <P>
00556    * There are no more results when the following is true:
00557    * 
00558    * <PRE>
00559    *      <code>(!getMoreResults() && (getUpdateCount() == -1)</code>
00560    * </PRE>
00561    * 
00562    * @param current one of the following <code>Statement</code> constants
00563    *          indicating what should happen to current <code>ResultSet</code>
00564    *          objects obtained using the method <code>getResultSet</code:
00565    *        <code>CLOSE_CURRENT_RESULT</code>, 
00566    *        <code>KEEP_CURRENT_RESULT</code>, or
00567    *        <code>CLOSE_ALL_RESULTS</code>
00568    * @return <code>true</code> if the next result is a <code>ResultSet</code> 
00569    *         object; <code>false</code> if it is an update count or there are no 
00570    *         more results
00571    * @exception SQLException if a database access error occurs
00572    * @since 1.4
00573    * @see #execute(String)
00574    */
00575   boolean getMoreResults(int current) throws SQLException;
00576 
00577   /**
00578    * Retrieves any auto-generated keys created as a result of executing this
00579    * <code>Statement</code> object. If this <code>Statement</code> object
00580    * did not generate any keys, an empty <code>ResultSet</code> object is
00581    * returned.
00582    * 
00583    * @return a <code>ResultSet</code> object containing the auto-generated
00584    *         key(s) generated by the execution of this <code>Statement</code>
00585    *         object
00586    * @exception SQLException if a database access error occurs
00587    * @since 1.4
00588    */
00589   ResultSet getGeneratedKeys() throws SQLException;
00590 
00591   /**
00592    * Executes the given SQL statement and signals the driver with the given flag
00593    * about whether the auto-generated keys produced by this
00594    * <code>Statement</code> object should be made available for retrieval.
00595    * 
00596    * @param sql must be an SQL <code>INSERT</code>,<code>UPDATE</code> or
00597    *          <code>DELETE</code> statement or an SQL statement that returns
00598    *          nothing
00599    * @param autoGeneratedKeys a flag indicating whether auto-generated keys
00600    *          should be made available for retrieval; one of the following
00601    *          constants: <code>Statement.RETURN_GENERATED_KEYS</code>
00602    *         <code>Statement.NO_GENERATED_KEYS</code>
00603    * @return either the row count for <code>INSERT</code>,
00604    *         <code>UPDATE</code> or <code>DELETE</code> statements, or
00605    *         <code>0</code> for SQL statements that return nothing
00606    * @exception SQLException if a database access error occurs, the given SQL
00607    *              statement returns a <code>ResultSet</code> object, or the
00608    *              given constant is not one of those allowed
00609    * @since 1.4
00610    */
00611   int executeUpdate(String sql, int autoGeneratedKeys) throws SQLException;
00612 
00613   /**
00614    * Executes the given SQL statement and signals the driver that the
00615    * auto-generated keys indicated in the given array should be made available
00616    * for retrieval. The driver will ignore the array if the SQL statement is not
00617    * an <code>INSERT</code> statement.
00618    * 
00619    * @param sql an SQL <code>INSERT</code>,<code>UPDATE</code> or
00620    *          <code>DELETE</code> statement or an SQL statement that returns
00621    *          nothing, such as an SQL DDL statement
00622    * @param columnIndexes an array of column indexes indicating the columns that
00623    *          should be returned from the inserted row
00624    * @return either the row count for <code>INSERT</code>,
00625    *         <code>UPDATE</code>, or <code>DELETE</code> statements, or 0
00626    *         for SQL statements that return nothing
00627    * @exception SQLException if a database access error occurs or the SQL
00628    *              statement returns a <code>ResultSet</code> object
00629    * @since 1.4
00630    */
00631   int executeUpdate(String sql, int columnIndexes[]) throws SQLException;
00632 
00633   /**
00634    * Executes the given SQL statement and signals the driver that the
00635    * auto-generated keys indicated in the given array should be made available
00636    * for retrieval. The driver will ignore the array if the SQL statement is not
00637    * an <code>INSERT</code> statement.
00638    * 
00639    * @param sql an SQL <code>INSERT</code>,<code>UPDATE</code> or
00640    *          <code>DELETE</code> statement or an SQL statement that returns
00641    *          nothing
00642    * @param columnNames an array of the names of the columns that should be
00643    *          returned from the inserted row
00644    * @return either the row count for <code>INSERT</code>,
00645    *         <code>UPDATE</code>, or <code>DELETE</code> statements, or 0
00646    *         for SQL statements that return nothing
00647    * @exception SQLException if a database access error occurs
00648    * @since 1.4
00649    */
00650   int executeUpdate(String sql, String columnNames[]) throws SQLException;
00651 
00652   /**
00653    * Executes the given SQL statement, which may return multiple results, and
00654    * signals the driver that any auto-generated keys should be made available
00655    * for retrieval. The driver will ignore this signal if the SQL statement is
00656    * not an <code>INSERT</code> statement.
00657    * <P>
00658    * In some (uncommon) situations, a single SQL statement may return multiple
00659    * result sets and/or update counts. Normally you can ignore this unless you
00660    * are (1) executing a stored procedure that you know may return multiple
00661    * results or (2) you are dynamically executing an unknown SQL string.
00662    * <P>
00663    * The <code>execute</code> method executes an SQL statement and indicates
00664    * the form of the first result. You must then use the methods
00665    * <code>getResultSet</code> or <code>getUpdateCount</code> to retrieve
00666    * the result, and <code>getMoreResults</code> to move to any subsequent
00667    * result(s).
00668    * 
00669    * @param sql any SQL statement
00670    * @param autoGeneratedKeys a constant indicating whether auto-generated keys
00671    *          should be made available for retrieval using the method
00672    *          <code>getGeneratedKeys</code>; one of the following constants:
00673    *          <code>Statement.RETURN_GENERATED_KEYS</code> or
00674    *          <code>Statement.NO_GENERATED_KEYS</code>
00675    * @return <code>true</code> if the first result is a <code>ResultSet</code>
00676    *         object; <code>false</code> if it is an update count or there are
00677    *         no results
00678    * @exception SQLException if a database access error occurs
00679    * @see #getResultSet
00680    * @see #getUpdateCount
00681    * @see #getMoreResults()
00682    * @see #getGeneratedKeys
00683    * @since 1.4
00684    */
00685   boolean execute(String sql, int autoGeneratedKeys) throws SQLException;
00686 
00687   /**
00688    * Executes the given SQL statement, which may return multiple results, and
00689    * signals the driver that the auto-generated keys indicated in the given
00690    * array should be made available for retrieval. This array contains the
00691    * indexes of the columns in the target table that contain the auto-generated
00692    * keys that should be made available. The driver will ignore the array if the
00693    * given SQL statement is not an <code>INSERT</code> statement.
00694    * <P>
00695    * Under some (uncommon) situations, a single SQL statement may return
00696    * multiple result sets and/or update counts. Normally you can ignore this
00697    * unless you are (1) executing a stored procedure that you know may return
00698    * multiple results or (2) you are dynamically executing an unknown SQL
00699    * string.
00700    * <P>
00701    * The <code>execute</code> method executes an SQL statement and indicates
00702    * the form of the first result. You must then use the methods
00703    * <code>getResultSet</code> or <code>getUpdateCount</code> to retrieve
00704    * the result, and <code>getMoreResults</code> to move to any subsequent
00705    * result(s).
00706    * 
00707    * @param sql any SQL statement
00708    * @param columnIndexes an array of the indexes of the columns in the inserted
00709    *          row that should be made available for retrieval by a call to the
00710    *          method <code>getGeneratedKeys</code>
00711    * @return <code>true</code> if the first result is a <code>ResultSet</code>
00712    *         object; <code>false</code> if it is an update count or there are
00713    *         no results
00714    * @exception SQLException if a database access error occurs
00715    * @see #getResultSet
00716    * @see #getUpdateCount
00717    * @see #getMoreResults()
00718    * @since 1.4
00719    */
00720   boolean execute(String sql, int columnIndexes[]) throws SQLException;
00721 
00722   /**
00723    * Executes the given SQL statement, which may return multiple results, and
00724    * signals the driver that the auto-generated keys indicated in the given
00725    * array should be made available for retrieval. This array contains the names
00726    * of the columns in the target table that contain the auto-generated keys
00727    * that should be made available. The driver will ignore the array if the
00728    * given SQL statement is not an <code>INSERT</code> statement.
00729    * <P>
00730    * In some (uncommon) situations, a single SQL statement may return multiple
00731    * result sets and/or update counts. Normally you can ignore this unless you
00732    * are (1) executing a stored procedure that you know may return multiple
00733    * results or (2) you are dynamically executing an unknown SQL string.
00734    * <P>
00735    * The <code>execute</code> method executes an SQL statement and indicates
00736    * the form of the first result. You must then use the methods
00737    * <code>getResultSet</code> or <code>getUpdateCount</code> to retrieve
00738    * the result, and <code>getMoreResults</code> to move to any subsequent
00739    * result(s).
00740    * 
00741    * @param sql any SQL statement
00742    * @param columnNames an array of the names of the columns in the inserted row
00743    *          that should be made available for retrieval by a call to the
00744    *          method <code>getGeneratedKeys</code>
00745    * @return <code>true</code> if the next result is a <code>ResultSet</code>
00746    *         object; <code>false</code> if it is an update count or there are
00747    *         no more results
00748    * @exception SQLException if a database access error occurs
00749    * @see #getResultSet
00750    * @see #getUpdateCount
00751    * @see #getMoreResults()
00752    * @see #getGeneratedKeys
00753    * @since 1.4
00754    */
00755   boolean execute(String sql, String columnNames[]) throws SQLException;
00756 
00757   /**
00758    * Retrieves the result set holdability for <code>ResultSet</code> objects
00759    * generated by this <code>Statement</code> object.
00760    * 
00761    * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
00762    *         <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
00763    * @exception SQLException if a database access error occurs
00764    * @since 1.4
00765    */
00766   int getResultSetHoldability() throws SQLException;
00767 
00768 }

Generated on Mon Apr 11 22:01:35 2005 for C-JDBC by  doxygen 1.3.9.1