Statement.java revision 2751
2751N/A * Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * <P>The object used for executing a static SQL statement 0N/A * and returning the results it produces. 0N/A * By default, only one <code>ResultSet</code> object per <code>Statement</code> 0N/A * object can be open at the same time. Therefore, if the reading of one 0N/A * <code>ResultSet</code> object is interleaved 0N/A * with the reading of another, each must have been generated by 0N/A * different <code>Statement</code> objects. All execution methods in the 0N/A * <code>Statement</code> interface implicitly close a statment's current 0N/A * <code>ResultSet</code> object if an open one exists. 0N/A * @see Connection#createStatement 0N/A * Executes the given SQL statement, which returns a single 0N/A * <code>ResultSet</code> object. 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql an SQL statement to be sent to the database, typically a 0N/A * static SQL <code>SELECT</code> statement 0N/A * @return a <code>ResultSet</code> object that contains the data produced 0N/A * by the given query; never <code>null</code> 0N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>, the given 0N/A * SQL statement produces anything other than a single 2751N/A * <code>ResultSet</code> object, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * Executes the given SQL statement, which may be an <code>INSERT</code>, 0N/A * <code>UPDATE</code>, or <code>DELETE</code> statement or an 0N/A * SQL statement that returns nothing, such as an SQL DDL statement. 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or 0N/A * <code>DELETE</code>; or an SQL statement that returns nothing, 0N/A * such as a DDL statement. 0N/A * @return either (1) the row count for SQL Data Manipulation Language (DML) statements 0N/A * or (2) 0 for SQL statements that return nothing 0N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>, the given 2751N/A * SQL statement produces a <code>ResultSet</code> object, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * Releases this <code>Statement</code> object's database 0N/A * and JDBC resources immediately instead of waiting for 0N/A * this to happen when it is automatically closed. 0N/A * It is generally good practice to release resources as soon as 0N/A * you are finished with them to avoid tying up database 0N/A * Calling the method <code>close</code> on a <code>Statement</code> 0N/A * object that is already closed has no effect. 0N/A * <B>Note:</B>When a <code>Statement</code> object is 0N/A * closed, its current <code>ResultSet</code> object, if one exists, is 0N/A * @exception SQLException if a database access error occurs 0N/A //---------------------------------------------------------------------- 0N/A * Retrieves the maximum number of bytes that can be 0N/A * returned for character and binary column values in a <code>ResultSet</code> 0N/A * object produced by this <code>Statement</code> object. 0N/A * This limit applies only to <code>BINARY</code>, <code>VARBINARY</code>, 0N/A * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, 0N/A * <code>NCHAR</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code> 0N/A * and <code>LONGVARCHAR</code> columns. If the limit is exceeded, the 0N/A * excess data is silently discarded. 0N/A * @return the current column size limit for columns storing character and 0N/A * binary values; zero means there is no limit 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @see #setMaxFieldSize 0N/A * Sets the limit for the maximum number of bytes that can be returned for 0N/A * character and binary column values in a <code>ResultSet</code> 0N/A * object produced by this <code>Statement</code> object. 0N/A * This limit applies 0N/A * only to <code>BINARY</code>, <code>VARBINARY</code>, 0N/A * <code>LONGVARBINARY</code>, <code>CHAR</code>, <code>VARCHAR</code>, 0N/A * <code>NCHAR</code>, <code>NVARCHAR</code>, <code>LONGNVARCHAR</code> and 0N/A * <code>LONGVARCHAR</code> fields. If the limit is exceeded, the excess data 0N/A * is silently discarded. For maximum portability, use values 0N/A * @param max the new column size limit in bytes; zero means there is no limit 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> 0N/A * or the condition max >= 0 is not satisfied 0N/A * @see #getMaxFieldSize 0N/A * Retrieves the maximum number of rows that a 0N/A * <code>ResultSet</code> object produced by this 0N/A * <code>Statement</code> object can contain. If this limit is exceeded, 0N/A * the excess rows are silently dropped. 0N/A * @return the current maximum number of rows for a <code>ResultSet</code> 0N/A * object produced by this <code>Statement</code> object; 0N/A * zero means there is no limit 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Sets the limit for the maximum number of rows that any 0N/A * <code>ResultSet</code> object generated by this <code>Statement</code> 0N/A * object can contain to the given number. 0N/A * If the limit is exceeded, the excess 0N/A * rows are silently dropped. 0N/A * @param max the new max rows limit; zero means there is no limit 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> 0N/A * or the condition max >= 0 is not satisfied 0N/A * Sets escape processing on or off. 0N/A * If escape scanning is on (the default), the driver will do 0N/A * escape substitution before sending the SQL statement to the database. 0N/A * Note: Since prepared statements have usually been parsed prior 0N/A * to making this call, disabling escape processing for 0N/A * <code>PreparedStatements</code> objects will have no effect. 0N/A * @param enable <code>true</code> to enable escape processing; 0N/A * <code>false</code> to disable it 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Retrieves the number of seconds the driver will 0N/A * wait for a <code>Statement</code> object to execute. 0N/A * If the limit is exceeded, a 0N/A * <code>SQLException</code> is thrown. 0N/A * @return the current query timeout limit in seconds; zero means there is 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @see #setQueryTimeout 0N/A * Sets the number of seconds the driver will wait for a 0N/A * <code>Statement</code> object to execute to the given number of seconds. 2751N/A *By default there is no limit on the amount of time allowed for a running 2751N/A * statement to complete. If the limit is exceeded, an 2751N/A * <code>SQLTimeoutException</code> is thrown. 2751N/A * A JDBC driver must apply this limit to the <code>execute</code>, 2751N/A * <code>executeQuery</code> and <code>executeUpdate</code> methods. 2751N/A * <strong>Note:</strong> JDBC driver implementations may also apply this 2751N/A * limit to {@code ResultSet} methods 0N/A * (consult your driver vendor documentation for details). 2751N/A * <strong>Note:</strong> In the case of {@code Statement} batching, it is 2751N/A * implementation defined as to whether the time-out is applied to 2751N/A * individual SQL commands added via the {@code addBatch} method or to 2751N/A * the entire batch of SQL commands invoked by the {@code executeBatch} 2751N/A * method (consult your driver vendor documentation for details). 0N/A * @param seconds the new query timeout limit in seconds; zero means 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> 0N/A * or the condition seconds >= 0 is not satisfied 0N/A * @see #getQueryTimeout 0N/A * Cancels this <code>Statement</code> object if both the DBMS and 0N/A * driver support aborting an SQL statement. 0N/A * This method can be used by one thread to cancel a statement that 0N/A * is being executed by another thread. 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * Retrieves the first warning reported by calls on this <code>Statement</code> object. 0N/A * Subsequent <code>Statement</code> object warnings will be chained to this 0N/A * <code>SQLWarning</code> object. 0N/A * <p>The warning chain is automatically cleared each time 0N/A * a statement is (re)executed. This method may not be called on a closed 0N/A * <code>Statement</code> object; doing so will cause an <code>SQLException</code> 0N/A * <P><B>Note:</B> If you are processing a <code>ResultSet</code> object, any 0N/A * warnings associated with reads on that <code>ResultSet</code> object 0N/A * will be chained on it rather than on the <code>Statement</code> 0N/A * object that produced it. 0N/A * @return the first <code>SQLWarning</code> object or <code>null</code> 0N/A * if there are no warnings 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Clears all the warnings reported on this <code>Statement</code> 0N/A * object. After a call to this method, 0N/A * the method <code>getWarnings</code> will return 0N/A * <code>null</code> until a new warning is reported for this 0N/A * <code>Statement</code> object. 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Sets the SQL cursor name to the given <code>String</code>, which 0N/A * will be used by subsequent <code>Statement</code> object 0N/A * <code>execute</code> methods. This name can then be 0N/A * used in SQL positioned update or delete statements to identify the 0N/A * current row in the <code>ResultSet</code> object generated by this 0N/A * this method is a noop. To insure that a cursor has the proper isolation 0N/A * level to support updates, the cursor's <code>SELECT</code> statement 0N/A * should have the form <code>SELECT FOR UPDATE</code>. If 0N/A * <code>FOR UPDATE</code> is not present, positioned updates may fail. 0N/A * <P><B>Note:</B> By definition, the execution of positioned updates and 0N/A * deletes must be done by a different <code>Statement</code> object than 0N/A * the one that generated the <code>ResultSet</code> object being used for 0N/A * positioning. Also, cursor names must be unique within a connection. 0N/A * @param name the new cursor name, which must be unique within 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 0N/A //----------------------- Multiple Results -------------------------- 0N/A * Executes the given SQL statement, which may return multiple results. 0N/A * In some (uncommon) situations, a single SQL statement may return 0N/A * multiple result sets and/or update counts. Normally you can ignore 0N/A * this unless you are (1) executing a stored procedure that you know may 0N/A * return multiple results or (2) you are dynamically executing an 0N/A * unknown SQL string. 0N/A * The <code>execute</code> method executes an SQL statement and indicates the 0N/A * form of the first result. You must then use the methods 0N/A * <code>getResultSet</code> or <code>getUpdateCount</code> 0N/A * to retrieve the result, and <code>getMoreResults</code> to 0N/A * move to any subsequent result(s). 2751N/A *<strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql any SQL statement 0N/A * @return <code>true</code> if the first result is a <code>ResultSet</code> 0N/A * object; <code>false</code> if it is an update count or there are 2751N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>, 2751N/A * the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * @see #getResultSet 0N/A * @see #getUpdateCount 0N/A * @see #getMoreResults 0N/A * Retrieves the current result as a <code>ResultSet</code> object. 0N/A * This method should be called only once per result. 0N/A * @return the current result as a <code>ResultSet</code> object or 0N/A * <code>null</code> if the result is an update count or there are no more results 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Retrieves the current result as an update count; 0N/A * if the result is a <code>ResultSet</code> object or there are no more results, -1 0N/A * is returned. This method should be called only once per result. 0N/A * @return the current result as an update count; -1 if the current result is a 0N/A * <code>ResultSet</code> object or there are no more results 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Moves to this <code>Statement</code> object's next result, returns 0N/A * <code>true</code> if it is a <code>ResultSet</code> object, and 0N/A * implicitly closes any current <code>ResultSet</code> 0N/A * object(s) obtained with the method <code>getResultSet</code>. 0N/A * <P>There are no more results when the following is true: 0N/A * // stmt is a Statement object 0N/A * ((stmt.getMoreResults() == false) && (stmt.getUpdateCount() == -1)) 0N/A * @return <code>true</code> if the next result is a <code>ResultSet</code> 0N/A * object; <code>false</code> if it is an update count or there are 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A //--------------------------JDBC 2.0----------------------------- 0N/A * Gives the driver a hint as to the direction in which 0N/A * rows will be processed in <code>ResultSet</code> 0N/A * objects created using this <code>Statement</code> object. The 0N/A * default value is <code>ResultSet.FETCH_FORWARD</code>. 0N/A * Note that this method sets the default fetch direction for 0N/A * result sets generated by this <code>Statement</code> object. 0N/A * Each result set has its own methods for getting and setting 0N/A * its own fetch direction. 0N/A * @param direction the initial direction for processing rows 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> 0N/A * or the given direction 0N/A * is not one of <code>ResultSet.FETCH_FORWARD</code>, 0N/A * <code>ResultSet.FETCH_REVERSE</code>, or <code>ResultSet.FETCH_UNKNOWN</code> 0N/A * @see #getFetchDirection 0N/A * Retrieves the direction for fetching rows from 0N/A * database tables that is the default for result sets 0N/A * generated from this <code>Statement</code> object. 0N/A * If this <code>Statement</code> object has not set 0N/A * a fetch direction by calling the method <code>setFetchDirection</code>, 0N/A * the return value is implementation-specific. 0N/A * @return the default fetch direction for result sets generated 0N/A * from this <code>Statement</code> object 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @see #setFetchDirection 0N/A * Gives the JDBC driver a hint as to the number of rows that should 0N/A * be fetched from the database when more rows are needed for 0N/A * <code>ResultSet</code> objects genrated by this <code>Statement</code>. 0N/A * If the value specified is zero, then the hint is ignored. 0N/A * The default value is zero. 0N/A * @param rows the number of rows to fetch 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> or the 0N/A * condition <code>rows >= 0</code> is not satisfied. 0N/A * @see #getFetchSize 0N/A * Retrieves the number of result set rows that is the default 0N/A * fetch size for <code>ResultSet</code> objects 0N/A * generated from this <code>Statement</code> object. 0N/A * If this <code>Statement</code> object has not set 0N/A * a fetch size by calling the method <code>setFetchSize</code>, 0N/A * the return value is implementation-specific. 0N/A * @return the default fetch size for result sets generated 0N/A * from this <code>Statement</code> object 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @see #setFetchSize 0N/A * Retrieves the result set concurrency for <code>ResultSet</code> objects 0N/A * generated by this <code>Statement</code> object. 0N/A * @return either <code>ResultSet.CONCUR_READ_ONLY</code> or 0N/A * <code>ResultSet.CONCUR_UPDATABLE</code> 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Retrieves the result set type for <code>ResultSet</code> objects 0N/A * generated by this <code>Statement</code> object. 0N/A * @return one of <code>ResultSet.TYPE_FORWARD_ONLY</code>, 0N/A * <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or 0N/A * <code>ResultSet.TYPE_SCROLL_SENSITIVE</code> 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Adds the given SQL command to the current list of commmands for this 0N/A * <code>Statement</code> object. The commands in this list can be 0N/A * executed as a batch by calling the method <code>executeBatch</code>. 2751N/A *<strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql typically this is a SQL <code>INSERT</code> or 0N/A * <code>UPDATE</code> statement 0N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>, the 2751N/A * driver does not support batch updates, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @see #executeBatch 0N/A * @see DatabaseMetaData#supportsBatchUpdates 0N/A * Empties this <code>Statement</code> object's current list of 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> or the 0N/A * driver does not support batch updates 0N/A * @see DatabaseMetaData#supportsBatchUpdates 0N/A * Submits a batch of commands to the database for execution and 0N/A * if all commands execute successfully, returns an array of update counts. 0N/A * The <code>int</code> elements of the array that is returned are ordered 0N/A * to correspond to the commands in the batch, which are ordered 0N/A * according to the order in which they were added to the batch. 0N/A * The elements in the array returned by the method <code>executeBatch</code> 0N/A * may be one of the following: 0N/A * <LI>A number greater than or equal to zero -- indicates that the 0N/A * command was processed successfully and is an update count giving the 0N/A * number of rows in the database that were affected by the command's 0N/A * <LI>A value of <code>SUCCESS_NO_INFO</code> -- indicates that the command was 0N/A * processed successfully but that the number of rows affected is 0N/A * If one of the commands in a batch update fails to execute properly, 0N/A * this method throws a <code>BatchUpdateException</code>, and a JDBC 0N/A * driver may or may not continue to process the remaining commands in 0N/A * the batch. However, the driver's behavior must be consistent with a 0N/A * particular DBMS, either always continuing to process commands or never 0N/A * continuing to process commands. If the driver continues processing 0N/A * after a failure, the array returned by the method 0N/A * <code>BatchUpdateException.getUpdateCounts</code> 0N/A * will contain as many elements as there are commands in the batch, and 0N/A * at least one of the elements will be the following: 0N/A * <LI>A value of <code>EXECUTE_FAILED</code> -- indicates that the command failed 0N/A * to execute successfully and occurs only if a driver continues to 0N/A * process commands after a command fails 0N/A * The possible implementations and return values have been modified in 0N/A * the Java 2 SDK, Standard Edition, version 1.3 to 0N/A * accommodate the option of continuing to proccess commands in a batch 0N/A * update after a <code>BatchUpdateException</code> obejct has been thrown. 0N/A * @return an array of update counts containing one element for each 0N/A * command in the batch. The elements of the array are ordered according 0N/A * to the order in which commands were added to the batch. 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> or the 0N/A * driver does not support batch statements. Throws {@link BatchUpdateException} 0N/A * (a subclass of <code>SQLException</code>) if one of the commands sent to the 0N/A * database fails to execute properly or attempts to return a result set. 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * @see DatabaseMetaData#supportsBatchUpdates 0N/A * Retrieves the <code>Connection</code> object 0N/A * that produced this <code>Statement</code> object. 0N/A * @return the connection that produced this statement 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A //--------------------------JDBC 3.0----------------------------- 0N/A * The constant indicating that the current <code>ResultSet</code> object 0N/A * should be closed when calling <code>getMoreResults</code>. 0N/A * The constant indicating that the current <code>ResultSet</code> object 0N/A * should not be closed when calling <code>getMoreResults</code>. 0N/A * The constant indicating that all <code>ResultSet</code> objects that 0N/A * have previously been kept open should be closed when calling 0N/A * <code>getMoreResults</code>. 0N/A * The constant indicating that a batch statement executed successfully 0N/A * but that no count of the number of rows it affected is available. 0N/A * The constant indicating that an error occured while executing a 0N/A * The constant indicating that generated keys should be made 0N/A * available for retrieval. 0N/A * The constant indicating that generated keys should not be made 0N/A * available for retrieval. 0N/A * Moves to this <code>Statement</code> object's next result, deals with 0N/A * any current <code>ResultSet</code> object(s) according to the instructions 0N/A * specified by the given flag, and returns 0N/A * <code>true</code> if the next result is a <code>ResultSet</code> object. 0N/A * <P>There are no more results when the following is true: 0N/A * // stmt is a Statement object 0N/A * ((stmt.getMoreResults(current) == false) && (stmt.getUpdateCount() == -1)) 0N/A * @param current one of the following <code>Statement</code> 0N/A * constants indicating what should happen to current 0N/A * <code>ResultSet</code> objects obtained using the method 0N/A * <code>getResultSet</code>: 0N/A * <code>Statement.CLOSE_CURRENT_RESULT</code>, 0N/A * <code>Statement.KEEP_CURRENT_RESULT</code>, or 0N/A * <code>Statement.CLOSE_ALL_RESULTS</code> 0N/A * @return <code>true</code> if the next result is a <code>ResultSet</code> 0N/A * object; <code>false</code> if it is an update count or there are no 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code> or the argument 0N/A * supplied is not one of the following: 0N/A * <code>Statement.CLOSE_CURRENT_RESULT</code>, 0N/A * <code>Statement.KEEP_CURRENT_RESULT</code> or 0N/A * <code>Statement.CLOSE_ALL_RESULTS</code> 0N/A *@exception SQLFeatureNotSupportedException if 0N/A * <code>DatabaseMetaData.supportsMultipleOpenResults</code> returns 0N/A * <code>false</code> and either 0N/A * <code>Statement.KEEP_CURRENT_RESULT</code> or 0N/A * <code>Statement.CLOSE_ALL_RESULTS</code> are supplied as 0N/A * Retrieves any auto-generated keys created as a result of executing this 0N/A * <code>Statement</code> object. If this <code>Statement</code> object did 0N/A * not generate any keys, an empty <code>ResultSet</code> 0N/A * object is returned. 0N/A *<p><B>Note:</B>If the columns which represent the auto-generated keys were not specified, 0N/A * the JDBC driver implementation will determine the columns which best represent the auto-generated keys. 0N/A * @return a <code>ResultSet</code> object containing the auto-generated key(s) 0N/A * generated by the execution of this <code>Statement</code> object 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 0N/A * Executes the given SQL statement and signals the driver with the 0N/A * given flag about whether the 0N/A * auto-generated keys produced by this <code>Statement</code> object 0N/A * should be made available for retrieval. The driver will ignore the 0N/A * flag if the SQL statement 0N/A * is not an <code>INSERT</code> statement, or an SQL statement able to return 0N/A * auto-generated keys (the list of such statements is vendor-specific). 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or 0N/A * <code>DELETE</code>; or an SQL statement that returns nothing, 0N/A * such as a DDL statement. 0N/A * @param autoGeneratedKeys a flag indicating whether auto-generated keys 0N/A * should be made available for retrieval; 0N/A * one of the following constants: 0N/A * <code>Statement.RETURN_GENERATED_KEYS</code> 0N/A * <code>Statement.NO_GENERATED_KEYS</code> 0N/A * @return either (1) the row count for SQL Data Manipulation Language (DML) statements 0N/A * or (2) 0 for SQL statements that return nothing 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code>, the given 2751N/A * SQL statement returns a <code>ResultSet</code> object, 2751N/A * the given constant is not one of those allowed, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * this method with a constant of Statement.RETURN_GENERATED_KEYS 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * Executes the given SQL statement and signals the driver that the 0N/A * auto-generated keys indicated in the given array should be made available 0N/A * for retrieval. This array contains the indexes of the columns in the 0N/A * target table that contain the auto-generated keys that should be made 0N/A * available. The driver will ignore the array if the SQL statement 0N/A * is not an <code>INSERT</code> statement, or an SQL statement able to return 0N/A * auto-generated keys (the list of such statements is vendor-specific). 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or 0N/A * <code>DELETE</code>; or an SQL statement that returns nothing, 0N/A * such as a DDL statement. 0N/A * @param columnIndexes an array of column indexes indicating the columns 0N/A * that should be returned from the inserted row 0N/A * @return either (1) the row count for SQL Data Manipulation Language (DML) statements 0N/A * or (2) 0 for SQL statements that return nothing 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code>, the SQL 2751N/A * statement returns a <code>ResultSet</code> object,the second argument 2751N/A * supplied to this method is not an 2751N/A * <code>int</code> array whose elements are valid column indexes, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * Executes the given SQL statement and signals the driver that the 0N/A * auto-generated keys indicated in the given array should be made available 0N/A * for retrieval. This array contains the names of the columns in the 0N/A * target table that contain the auto-generated keys that should be made 0N/A * available. The driver will ignore the array if the SQL statement 0N/A * is not an <code>INSERT</code> statement, or an SQL statement able to return 0N/A * auto-generated keys (the list of such statements is vendor-specific). 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql an SQL Data Manipulation Language (DML) statement, such as <code>INSERT</code>, <code>UPDATE</code> or 0N/A * <code>DELETE</code>; or an SQL statement that returns nothing, 0N/A * such as a DDL statement. 0N/A * @param columnNames an array of the names of the columns that should be 0N/A * returned from the inserted row 0N/A * @return either the row count for <code>INSERT</code>, <code>UPDATE</code>, 0N/A * or <code>DELETE</code> statements, or 0 for SQL statements 0N/A * that return nothing 0N/A * @exception SQLException if a database access error occurs, 0N/A * this method is called on a closed <code>Statement</code>, the SQL 2751N/A * statement returns a <code>ResultSet</code> object, the 0N/A * second argument supplied to this method is not a <code>String</code> array 2751N/A * whose elements are valid column names, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * Executes the given SQL statement, which may return multiple results, 0N/A * and signals the driver that any 0N/A * auto-generated keys should be made available 0N/A * for retrieval. The driver will ignore this signal if the SQL statement 0N/A * is not an <code>INSERT</code> statement, or an SQL statement able to return 0N/A * auto-generated keys (the list of such statements is vendor-specific). 0N/A * In some (uncommon) situations, a single SQL statement may return 0N/A * multiple result sets and/or update counts. Normally you can ignore 0N/A * this unless you are (1) executing a stored procedure that you know may 0N/A * return multiple results or (2) you are dynamically executing an 0N/A * unknown SQL string. 0N/A * The <code>execute</code> method executes an SQL statement and indicates the 0N/A * form of the first result. You must then use the methods 0N/A * <code>getResultSet</code> or <code>getUpdateCount</code> 0N/A * to retrieve the result, and <code>getMoreResults</code> to 0N/A * move to any subsequent result(s). 2751N/A *<strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql any SQL statement 0N/A * @param autoGeneratedKeys a constant indicating whether auto-generated 0N/A * keys should be made available for retrieval using the method 0N/A * <code>getGeneratedKeys</code>; one of the following constants: 0N/A * <code>Statement.RETURN_GENERATED_KEYS</code> or 0N/A * <code>Statement.NO_GENERATED_KEYS</code> 0N/A * @return <code>true</code> if the first result is a <code>ResultSet</code> 0N/A * object; <code>false</code> if it is an update count or there are 0N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>, the second 0N/A * parameter supplied to this method is not 0N/A * <code>Statement.RETURN_GENERATED_KEYS</code> or 2751N/A * <code>Statement.NO_GENERATED_KEYS</code>, 2751N/A * the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @exception SQLFeatureNotSupportedException if the JDBC driver does not support 0N/A * this method with a constant of Statement.RETURN_GENERATED_KEYS 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * @see #getResultSet 0N/A * @see #getUpdateCount 0N/A * @see #getMoreResults 0N/A * @see #getGeneratedKeys 0N/A * Executes the given SQL statement, which may return multiple results, 0N/A * and signals the driver that the 0N/A * auto-generated keys indicated in the given array should be made available 0N/A * for retrieval. This array contains the indexes of the columns in the 0N/A * target table that contain the auto-generated keys that should be made 0N/A * available. The driver will ignore the array if the SQL statement 0N/A * is not an <code>INSERT</code> statement, or an SQL statement able to return 0N/A * auto-generated keys (the list of such statements is vendor-specific). 0N/A * Under some (uncommon) situations, a single SQL statement may return 0N/A * multiple result sets and/or update counts. Normally you can ignore 0N/A * this unless you are (1) executing a stored procedure that you know may 0N/A * return multiple results or (2) you are dynamically executing an 0N/A * unknown SQL string. 0N/A * The <code>execute</code> method executes an SQL statement and indicates the 0N/A * form of the first result. You must then use the methods 0N/A * <code>getResultSet</code> or <code>getUpdateCount</code> 0N/A * to retrieve the result, and <code>getMoreResults</code> to 0N/A * move to any subsequent result(s). 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql any SQL statement 0N/A * @param columnIndexes an array of the indexes of the columns in the 0N/A * inserted row that should be made available for retrieval by a 0N/A * call to the method <code>getGeneratedKeys</code> 0N/A * @return <code>true</code> if the first result is a <code>ResultSet</code> 0N/A * object; <code>false</code> if it is an update count or there 0N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>, the 0N/A * elements in the <code>int</code> array passed to this method 2751N/A * are not valid column indexes, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * @see #getResultSet 0N/A * @see #getUpdateCount 0N/A * @see #getMoreResults 0N/A * Executes the given SQL statement, which may return multiple results, 0N/A * and signals the driver that the 0N/A * auto-generated keys indicated in the given array should be made available 0N/A * for retrieval. This array contains the names of the columns in the 0N/A * target table that contain the auto-generated keys that should be made 0N/A * available. The driver will ignore the array if the SQL statement 0N/A * is not an <code>INSERT</code> statement, or an SQL statement able to return 0N/A * auto-generated keys (the list of such statements is vendor-specific). 0N/A * In some (uncommon) situations, a single SQL statement may return 0N/A * multiple result sets and/or update counts. Normally you can ignore 0N/A * this unless you are (1) executing a stored procedure that you know may 0N/A * return multiple results or (2) you are dynamically executing an 0N/A * unknown SQL string. 0N/A * The <code>execute</code> method executes an SQL statement and indicates the 0N/A * form of the first result. You must then use the methods 0N/A * <code>getResultSet</code> or <code>getUpdateCount</code> 0N/A * to retrieve the result, and <code>getMoreResults</code> to 0N/A * move to any subsequent result(s). 2751N/A * <strong>Note:</strong>This method cannot be called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code>. 0N/A * @param sql any SQL statement 0N/A * @param columnNames an array of the names of the columns in the inserted 0N/A * row that should be made available for retrieval by a call to the 0N/A * method <code>getGeneratedKeys</code> 0N/A * @return <code>true</code> if the next result is a <code>ResultSet</code> 0N/A * object; <code>false</code> if it is an update count or there 0N/A * are no more results 0N/A * @exception SQLException if a database access error occurs, 2751N/A * this method is called on a closed <code>Statement</code>,the 0N/A * elements of the <code>String</code> array passed to this 2751N/A * method are not valid column names, the method is called on a 2751N/A * <code>PreparedStatement</code> or <code>CallableStatement</code> 0N/A * @throws SQLFeatureNotSupportedException if the JDBC driver does not support this method 2751N/A * @throws SQLTimeoutException when the driver has determined that the 2751N/A * timeout value that was specified by the {@code setQueryTimeout} 2751N/A * method has been exceeded and has at least attempted to cancel 2751N/A * the currently running {@code Statement} 0N/A * @see #getResultSet 0N/A * @see #getUpdateCount 0N/A * @see #getMoreResults 0N/A * @see #getGeneratedKeys 0N/A * Retrieves the result set holdability for <code>ResultSet</code> objects 0N/A * generated by this <code>Statement</code> object. 0N/A * @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or 0N/A * <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code> 0N/A * @exception SQLException if a database access error occurs or 0N/A * this method is called on a closed <code>Statement</code> 0N/A * Retrieves whether this <code>Statement</code> object has been closed. A <code>Statement</code> is closed if the 0N/A * method close has been called on it, or if it is automatically closed. 0N/A * @return true if this <code>Statement</code> object is closed; false if it is still open 0N/A * @throws SQLException if a database access error occurs 0N/A * Requests that a <code>Statement</code> be pooled or not pooled. The value 0N/A * specified is a hint to the statement pool implementation indicating 0N/A * whether the applicaiton wants the statement to be pooled. It is up to 0N/A * the statement pool manager as to whether the hint is used. 0N/A * The poolable value of a statement is applicable to both internal 0N/A * statement caches implemented by the driver and external statement caches 0N/A * implemented by application servers and other applications. 0N/A * By default, a <code>Statement</code> is not poolable when created, and 0N/A * a <code>PreparedStatement</code> and <code>CallableStatement</code> 0N/A * are poolable when created. 0N/A * @param poolable requests that the statement be pooled if true and 0N/A * that the statement not be pooled if false 0N/A * @throws SQLException if this method is called on a closed 0N/A * <code>Statement</code> 0N/A * Returns a value indicating whether the <code>Statement</code> 0N/A * is poolable or not. 0N/A * @return <code>true</code> if the <code>Statement</code> 0N/A * is poolable; <code>false</code> otherwise 0N/A * @throws SQLException if this method is called on a closed 0N/A * <code>Statement</code> 0N/A * @see java.sql.Statement#setPoolable(boolean) setPoolable(boolean) 2751N/A //--------------------------JDBC 4.1 ----------------------------- 2751N/A * Specifies that this {@code Statement} will be closed when all its 2751N/A * dependent result sets are closed. If execution of the {@code Statement} 2751N/A * does not produce any result sets, this method has no effect. 2751N/A * <strong>Note:</strong> Multiple calls to {@code closeOnCompletion} do 2751N/A * not toggle the effect on this {@code Statement}. However, a call to 2751N/A * {@code closeOnCompletion} does effect both the subsequent execution of 2751N/A * statements, and statements that currently have open, dependent, 2751N/A * @throws SQLException if this method is called on a closed 2751N/A * Returns a value indicating whether this {@code Statement} will be 2751N/A * closed when all dependent objects such as resultsets are closed. 2751N/A * @return {@code true} if the {@code Statement} will be closed when all 2751N/A * of its dependent objects are closed; {@code false} otherwise 2751N/A * @throws SQLException if this method is called on a closed