📄 jdbcstatement.java
字号:
* greater than 256. <p>
* <!-- emd generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, calls to this method are simply ignored; HSQLDB always
* stores the full number of bytes when dealing with any of the field types
* mentioned above. These types all have an absolute maximum element upper
* bound determined by the Java array index limit
* java.lang.Integer.MAX_VALUE. For XXXBINARY types, this translates to
* Integer.MAX_VALUE bytes. For XXXCHAR types, this translates to
* 2 * Integer.MAX_VALUE bytes (2 bytes / character)
* </div>
* <!-- end release-specific documentation -->
*
* @param max the new column size limit in bytes; zero means there is no limit
* @exception SQLException if a database access error occurs
* or the condition max >= 0 is not satisfied
* @see #getMaxFieldSize
*/
public void setMaxFieldSize(int max) throws SQLException {
checkClosed();
if (max < 0) {
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT);
}
}
/**
* <!-- start generic documentation -->
* Retrieves the maximum number of rows that a
* <code>ResultSet</code> object produced by this
* <code>Statement</code> object can contain. If this limit is exceeded,
* the excess rows are silently dropped. <p>
* <!-- start generic documentation -->
*
* @return the current maximum number of rows for a <code>ResultSet</code>
* object produced by this <code>Statement</code> object;
* zero means there is no limit
* @exception SQLException if a database access error occurs
* @see #setMaxRows
*/
public int getMaxRows() throws SQLException {
checkClosed();
return maxRows;
}
/**
* <!-- start generic documentation -->
* Sets the limit for the maximum number of rows that any
* <code>ResultSet</code> object can contain to the given number.
* If the limit is exceeded, the excess
* rows are silently dropped. <p>
* <!-- end generic documentation -->
*
* @param max the new max rows limit; zero means there is no limit
* @exception SQLException if a database access error occurs
* or the condition max >= 0 is not satisfied
* @see #getMaxRows
*/
public void setMaxRows(int max) throws SQLException {
checkClosed();
if (max < 0) {
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT);
}
maxRows = max;
}
/**
* <!-- start generic documentation -->
* Sets escape processing on or off.
* If escape scanning is on (the default), the driver will do
* escape substitution before sending the SQL statement to the database.
*
* Note: Since prepared statements have usually been parsed prior
* to making this call, disabling escape processing for
* <code>PreparedStatements</code> objects will have no effect. <p>
* <!-- end generic documentation -->
*
* @param enable <code>true</code> to enable escape processing;
* <code>false</code> to disable it
* @exception SQLException if a database access error occurs
*/
public void setEscapeProcessing(boolean enable) throws SQLException {
checkClosed();
isEscapeProcessing = enable;
}
/**
* <!-- start generic documentation -->
* Retrieves the number of seconds the driver will
* wait for a <code>Statement</code> object to execute. If the
* limit is exceeded, an <code>SQLException</code> is thrown. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, HSQLDB always returns zero, meaning there
* is no limit.
* </div>
* <!-- end release-specific documentation -->
*
* @return the current query timeout limit in seconds; zero means there is
* no limit
* @exception SQLException if a database access error occurs
* @see #setQueryTimeout
*/
public int getQueryTimeout() throws SQLException {
checkClosed();
return 0;
}
/**
* <!-- start generic documentation -->
* Sets the number of seconds the driver will wait for a
* <code>Statement</code> object to execute to the given number of seconds.
* If the limit is exceeded, an <code>SQLException</code> is thrown. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, calls to this method are ignored; HSQLDB waits an
* unlimited amount of time for statement execution
* requests to return.
* </div>
* <!-- end release-specific documentation -->
*
* @param seconds the new query timeout limit in seconds; zero means
* there is no limit
* @exception SQLException if a database access error occurs
* or the condition seconds >= 0 is not satisfied
* @see #getQueryTimeout
*/
public void setQueryTimeout(int seconds) throws SQLException {
checkClosed();
if (seconds < 0) {
throw Util.sqlException(Trace.INVALID_JDBC_ARGUMENT);
}
}
/**
* <!-- start generic documentation -->
* Cancels this <code>Statement</code> object if both the DBMS and
* driver support aborting an SQL statement.
* This method can be used by one thread to cancel a statement that
* is being executed by another thread. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, HSQLDB does <i>not</i> support aborting a SQL
* statement; calls to this method are ignored.
* </div>
* <!-- end release-specific documentation -->
*
* @exception SQLException if a database access error occurs
*/
public void cancel() throws SQLException {
checkClosed();
}
/**
* <!-- start generic documentation -->
* Retrieves the first warning reported by calls on this <code>Statement</code> object.
* Subsequent <code>Statement</code> object warnings will be chained to this
* <code>SQLWarning</code> object.
*
* <p>The warning chain is automatically cleared each time
* a statement is (re)executed. This method may not be called on a closed
* <code>Statement</code> object; doing so will cause an <code>SQLException</code>
* to be thrown.
*
* <P><B>Note:</B> If you are processing a <code>ResultSet</code> object, any
* warnings associated with reads on that <code>ResultSet</code> object
* will be chained on it rather than on the <code>Statement</code>
* object that produced it. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, HSQLDB never produces Statement warnings;
* this method always returns null.
* </div>
* <!-- end release-specific documentation -->
*
* @return the first <code>SQLWarning</code> object or <code>null</code>
* if there are no warnings
* @exception SQLException if a database access error occurs or this
* method is called on a closed statement
*/
public SQLWarning getWarnings() throws SQLException {
checkClosed();
return null;
}
/**
* <!-- start generic documentation -->
* Clears all the warnings reported on this <code>Statement</code>
* object. After a call to this method,
* the method <code>getWarnings</code> will return
* <code>null</code> until a new warning is reported for this
* <code>Statement</code> object. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including HSQLDB 1.7.2, <code>SQLWarning</code> objects are
* never produced for Statement Objects; calls to this method are
* ignored.
* </div>
* <!-- end release-specific documentation -->
*
* @exception SQLException if a database access error occurs
*/
public void clearWarnings() throws SQLException {
checkClosed();
}
/**
* <!-- start generic documentation -->
* Sets the SQL cursor name to the given <code>String</code>, which
* will be used by subsequent <code>Statement</code> object
* <code>execute</code> methods. This name can then be
* used in SQL positioned update or delete statements to identify the
* current row in the <code>ResultSet</code> object generated by this
* statement. If the database does not support positioned update/delete,
* this method is a noop. To insure that a cursor has the proper isolation
* level to support updates, the cursor's <code>SELECT</code> statement
* should have the form <code>SELECT FOR UPDATE</code>. If
* <code>FOR UPDATE</code> is not present, positioned updates may fail.
*
* <P><B>Note:</B> By definition, the execution of positioned updates and
* deletes must be done by a different <code>Statement</code> object than
* the one that generated the <code>ResultSet</code> object being used for
* positioning. Also, cursor names must be unique within a connection. <p>
* <!-- end generic documentation -->
*
* <!-- start release-specific documentation -->
* <div class="ReleaseSpecificDocumentation">
* <h3>HSQLDB-Specific Information:</h3> <p>
*
* Including 1.7.2, HSQLDB does not support named cursors,
* updateable results or table locking via <code>SELECT FOR UPDATE</code>;
* calls to this method are ignored.
* </div>
* <!-- end release-specific documentation -->
*
* @param name the new cursor name, which must be unique within
* a connection
* @exception SQLException if a database access error occurs
*/
public void setCursorName(String name) throws SQLException {
checkClosed();
}
//----------------------- Multiple Results --------------------------
/**
* <!-- start generic documentation -->
* Executes the given SQL statement, which may return multiple results.
* 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 -->
*
* @param sql any SQL statement
* @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
*/
public boolean execute(String sql) throws SQLException {
checkClosed();
connection.clearWarningsNoCheck();
fetchResult(sql);
return resultIn.mode == ResultConstants.DATA;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -