📄 jdbcstatement.java
字号:
* such as an SQL DDL statement
* @param columnIndexes an array of column indexes indicating the columns
* that should be returned from the inserted row
* @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
* or <code>DELETE</code> statements, or 0 for SQL statements
* that return nothing
* @exception SQLException if a database access error occurs or the SQL
* statement returns a <code>ResultSet</code> object
* @since JDK 1.4, HSQLDB 1.7
*/
//#ifdef JDBC3
public int executeUpdate(String sql,
int[] columnIndexes) throws SQLException {
throw Util.notSupported;
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Executes the given SQL statement and signals the driver that the
* auto-generated keys indicated in the given array should be made available
* for retrieval. The driver will ignore the array if the SQL statement
* is not an <code>INSERT</code> statement. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>,
* stating that the function is not supported.
* </div>
* <!-- end release-specific documentation -->
*
* @param sql an SQL <code>INSERT</code>, <code>UPDATE</code> or
* <code>DELETE</code> statement or an SQL statement that returns nothing
* @param columnNames an array of the names of the columns that should be
* returned from the inserted row
* @return either the row count for <code>INSERT</code>, <code>UPDATE</code>,
* or <code>DELETE</code> statements, or 0 for SQL statements
* that return nothing
* @exception SQLException if a database access error occurs
* @since JDK 1.4, HSQLDB 1.7
*/
//#ifdef JDBC3
public int executeUpdate(String sql,
String[] columnNames) throws SQLException {
throw Util.notSupported;
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Executes the given SQL statement, which may return multiple results,
* and signals the driver that any
* auto-generated keys should be made available
* for retrieval. The driver will ignore this signal if the SQL statement
* is not an <code>INSERT</code> statement.
* <P>
* In some (uncommon) situations, a single SQL statement may return
* multiple result sets and/or update counts. Normally you can ignore
* this unless you are (1) executing a stored procedure that you know may
* return multiple results or (2) you are dynamically executing an
* unknown SQL string.
* <P>
* The <code>execute</code> method executes an SQL statement and indicates the
* form of the first result. You must then use the methods
* <code>getResultSet</code> or <code>getUpdateCount</code>
* to retrieve the result, and <code>getMoreResults</code> to
* move to any subsequent result(s). <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>,
* stating that the function is not supported.
* </div>
* <!-- end release-specific documentation -->
*
* @param sql any SQL statement
* @param autoGeneratedKeys a constant indicating whether auto-generated
* keys should be made available for retrieval using the method
* <code>getGeneratedKeys</code>; one of the following constants:
* <code>Statement.RETURN_GENERATED_KEYS</code> or
* <code>Statement.NO_GENERATED_KEYS</code>
* @return <code>true</code> if the first result is a <code>ResultSet</code>
* object; <code>false</code> if it is an update count or there are
* no results
* @exception SQLException if a database access error occurs
* @see #getResultSet
* @see #getUpdateCount
* @see #getMoreResults
* @see #getGeneratedKeys
* @since JDK 1.4, HSQLDB 1.7
*/
//#ifdef JDBC3
public boolean execute(String sql,
int autoGeneratedKeys) throws SQLException {
throw Util.notSupported;
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Executes the given SQL statement, which may return multiple results,
* and signals the driver that the
* auto-generated keys indicated in the given array should be made available
* for retrieval. This array contains the indexes of the columns in the
* target table that contain the auto-generated keys that should be made
* available. The driver will ignore the array if the given SQL statement
* is not an <code>INSERT</code> statement.
* <P>
* Under some (uncommon) situations, a single SQL statement may return
* multiple result sets and/or update counts. Normally you can ignore
* this unless you are (1) executing a stored procedure that you know may
* return multiple results or (2) you are dynamically executing an
* unknown SQL string.
* <P>
* The <code>execute</code> method executes an SQL statement and indicates the
* form of the first result. You must then use the methods
* <code>getResultSet</code> or <code>getUpdateCount</code>
* to retrieve the result, and <code>getMoreResults</code> to
* move to any subsequent result(s). <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>,
* stating that the function is not supported.
* </div>
* <!-- end release-specific documentation -->
*
* @param sql any SQL statement
* @param columnIndexes an array of the indexes of the columns in the
* inserted row that should be made available for retrieval by a
* call to the method <code>getGeneratedKeys</code>
* @return <code>true</code> if the first result is a <code>ResultSet</code>
* object; <code>false</code> if it is an update count or there
* are no results
* @exception SQLException if a database access error occurs
* @see #getResultSet
* @see #getUpdateCount
* @see #getMoreResults
* @since JDK 1.4, HSQLDB 1.7
*/
//#ifdef JDBC3
public boolean execute(String sql,
int[] columnIndexes) throws SQLException {
throw Util.notSupported;
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Executes the given SQL statement, which may return multiple results,
* and signals the driver that the
* auto-generated keys indicated in the given array should be made available
* for retrieval. This array contains the names of the columns in the
* target table that contain the auto-generated keys that should be made
* available. The driver will ignore the array if the given SQL statement
* is not an <code>INSERT</code> statement.
* <P>
* In some (uncommon) situations, a single SQL statement may return
* multiple result sets and/or update counts. Normally you can ignore
* this unless you are (1) executing a stored procedure that you know may
* return multiple results or (2) you are dynamically executing an
* unknown SQL string.
* <P>
* The <code>execute</code> method executes an SQL statement and indicates the
* form of the first result. You must then use the methods
* <code>getResultSet</code> or <code>getUpdateCount</code>
* to retrieve the result, and <code>getMoreResults</code> to
* move to any subsequent result(s). <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* HSQLDB 1.7.2 does not support this feature. <p>
*
* Calling this method always throws an <code>SQLException</code>,
* stating that the function is not supported.
* </div>
* <!-- end release-specific documentation -->
*
* @param sql any SQL statement
* @param columnNames an array of the names of the columns in the inserted
* row that should be made available for retrieval by a call to the
* method <code>getGeneratedKeys</code>
* @return <code>true</code> if the next result is a <code>ResultSet</code>
* object; <code>false</code> if it is an update count or there
* are no more results
* @exception SQLException if a database access error occurs
* @see #getResultSet
* @see #getUpdateCount
* @see #getMoreResults
* @see #getGeneratedKeys
* @since JDK 1.4, HSQLDB 1.7
*/
//#ifdef JDBC3
public boolean execute(String sql,
String[] columnNames) throws SQLException {
throw Util.notSupported;
}
//#endif JDBC3
/**
* <!-- start generic documentation -->
* Retrieves the result set holdability for <code>ResultSet</code> objects
* generated by this <code>Statement</code> object. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Starting with 1.7.2, this method returns HOLD_CURSORS_OVER_COMMIT
* </div>
* <!-- end release-specific documentation -->
*
* @return either <code>ResultSet.HOLD_CURSORS_OVER_COMMIT</code> or
* <code>ResultSet.CLOSE_CURSORS_AT_COMMIT</code>
* @exception SQLException if a database access error occurs
* @since JDK 1.4, HSQLDB 1.7
*/
//#ifdef JDBC3
public int getResultSetHoldability() throws SQLException {
return jdbcResultSet.HOLD_CURSORS_OVER_COMMIT;
}
//#endif JDBC3
// -------------------- Internal Implementation ----------------------------
/**
* Constructs a new jdbcStatement with the specified connection and
* result type.
*
* @param c the connection on which this statement will execute
* @param type the kind of results this will return
*/
jdbcStatement(jdbcConnection c, int type) {
// PRE: assume connection is not null and is not closed
// PRE: assume type is a valid result set type code
connection = c;
rsType = type;
}
/**
* Retrieves whether this statement is closed.
*/
synchronized boolean isClosed() {
return isClosed;
}
/**
* An internal check for closed statements.
*
* @throws SQLException when the connection is closed
*/
void checkClosed() throws SQLException {
if (isClosed) {
throw Util.sqlException(Trace.STATEMENT_IS_CLOSED);
}
if (connection.isClosed) {
throw Util.sqlException(Trace.CONNECTION_IS_CLOSED);
}
}
/**
* Internal result producer for jdbcStatement (sqlExecDirect mode). <p>
*
* @param sql a character sequence representing the SQL to be executed
* @throws SQLException when a database access error occurs
*/
private void fetchResult(String sql) throws SQLException {
if (isEscapeProcessing) {
sql = connection.nativeSQL(sql);
}
resultIn = null;
resultOut.setMainString(sql);
resultOut.setMaxRows(maxRows);
try {
resultIn = connection.sessionProxy.execute(resultOut);
if (resultIn.mode == ResultConstants.ERROR) {
throw new HsqlException(resultIn);
}
} catch (HsqlException e) {
throw Util.sqlException(e);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -