📄 statement.html
字号:
<DD>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.<DD><DL><DT><B>Parameters:</B><DD><CODE>max</CODE> - the new max rows limit; zero means unlimited<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="setEscapeProcessing(boolean)"><!-- --></A><H3>setEscapeProcessing</H3><PRE>public void <B>setEscapeProcessing</B>(boolean enable) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Sets escape processing on or off. If escape scanning is on (the default), the driver will do escape substitution before sending the SQL to the database. Note: Since prepared statements have usually been parsed prior to making this call, disabling escape processing for prepared statements will have no effect.<DD><DL><DT><B>Parameters:</B><DD><CODE>enable</CODE> - <code>true</code> to enable; <code>false</code> to disable<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="getQueryTimeout()"><!-- --></A><H3>getQueryTimeout</H3><PRE>public int <B>getQueryTimeout</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Retrieves the number of seconds the driver will wait for a <code>Statement</code> object to execute. If the limit is exceeded, a <code>SQLException</code> is thrown.<DD><DL><DT><B>Returns:</B><DD>the current query timeout limit in seconds; zero means unlimited<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="setQueryTimeout(int)"><!-- --></A><H3>setQueryTimeout</H3><PRE>public void <B>setQueryTimeout</B>(int seconds) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>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.<DD><DL><DT><B>Parameters:</B><DD><CODE>seconds</CODE> - the new query timeout limit in seconds; zero means unlimited<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="cancel()"><!-- --></A><H3>cancel</H3><PRE>public void <B>cancel</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>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.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="getWarnings()"><!-- --></A><H3>getWarnings</H3><PRE>public <A HREF="../../java/sql/SQLWarning.html">SQLWarning</A> <B>getWarnings</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>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. <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.<DD><DL><DT><B>Returns:</B><DD>the first <code>SQLWarning</code> object or <code>null</code><DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="clearWarnings()"><!-- --></A><H3>clearWarnings</H3><PRE>public void <B>clearWarnings</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>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.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="setCursorName(java.lang.String)"><!-- --></A><H3>setCursorName</H3><PRE>public void <B>setCursorName</B>(<A HREF="../../java/lang/String.html">String</A> name) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Defines the SQL cursor name that will be used by subsequent <code>Statement</code> object <code>execute</code> methods. This name can then be used in SQL positioned update/delete statements to identify the current row in the <code>ResultSet</code> object generated by this statement. If the database doesn't 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 be of the form 'select for update ...'. If the 'for update' phrase is omitted, positioned updates may fail. <P><B>Note:</B> By definition, positioned update/delete execution must be done by a different <code>Statement</code> object than the one which generated the <code>ResultSet</code> object being used for positioning. Also, cursor names must be unique within a connection.<DD><DL><DT><B>Parameters:</B><DD><CODE>name</CODE> - the new cursor name, which must be unique within a connection<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs</DL></DD></DL><HR><A NAME="execute(java.lang.String)"><!-- --></A><H3>execute</H3><PRE>public boolean <B>execute</B>(<A HREF="../../java/lang/String.html">String</A> sql) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Executes an SQL statement that may return multiple results. 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. The methods <code>execute</code>, <code>getMoreResults</code>, <code>getResultSet</code>, and <code>getUpdateCount</code> let you navigate through multiple results. The <code>execute</code> method executes an SQL statement and indicates the form of the first result. You can 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).<DD><DL><DT><B>Parameters:</B><DD><CODE>sql</CODE> - any SQL statement<DT><B>Returns:</B><DD><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<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<DT><B>See Also: </B><DD><A HREF="../../java/sql/Statement.html#getResultSet()"><CODE>getResultSet()</CODE></A>, <A HREF="../../java/sql/Statement.html#getUpdateCount()"><CODE>getUpdateCount()</CODE></A>, <A HREF="../../java/sql/Statement.html#getMoreResults()"><CODE>getMoreResults()</CODE></A></DL></DD></DL><HR><A NAME="getResultSet()"><!-- --></A><H3>getResultSet</H3><PRE>public <A HREF="../../java/sql/ResultSet.html">ResultSet</A> <B>getResultSet</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Returns the current result as a <code>ResultSet</code> object. This method should be called only once per result.<DD><DL><DT><B>Returns:</B><DD>the current result as a <code>ResultSet</code> object; <code>null</code> if the result is an update count or there are no more results<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<DT><B>See Also: </B><DD><A HREF="../../java/sql/Statement.html#execute(java.lang.String)"><CODE>execute(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getUpdateCount()"><!-- --></A><H3>getUpdateCount</H3><PRE>public int <B>getUpdateCount</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Returns the current result as an update count; if the result is a <code>ResultSet</code> object or there are no more results, -1 is returned. This method should be called only once per result.<DD><DL><DT><B>Returns:</B><DD>the current result as an update count; -1 if the current result is a <code>ResultSet</code> object or there are no more results<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<DT><B>See Also: </B><DD><A HREF="../../java/sql/Statement.html#execute(java.lang.String)"><CODE>execute(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="getMoreResults()"><!-- --></A><H3>getMoreResults</H3><PRE>public boolean <B>getMoreResults</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Moves to a <code>Statement</code> object's next result. It returns <code>true</code> if this result is a <code>ResultSet</code> object. This method also implicitly closes any current <code>ResultSet</code> object obtained with the method <code>getResultSet</code>. <P>There are no more results when the following is true: <PRE> <code>(!getMoreResults() && (getUpdateCount() == -1)</code> </PRE><DD><DL><DT><B>Returns:</B><DD><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<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<DT><B>See Also: </B><DD><A HREF="../../java/sql/Statement.html#execute(java.lang.String)"><CODE>execute(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="setFetchDirection(int)"><!-- --></A><H3>setFetchDirection</H3><PRE>public void <B>setFetchDirection</B>(int direction) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Gives the driver a hint as to the direction in which the rows in a result set will be processed. The hint applies only to result sets created using this <code>Statement</code> object. The default value is <code>ResultSet.FETCH_FORWARD</code>. <p>Note that this method sets the default fetch direction for result sets generated by this <code>Statement</code> object. Each result set has its own methods for getting and setting its own fetch direction.<DD><DL><DT><B>Parameters:</B><DD><CODE>direction</CODE> - the initial direction for processing rows<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs or the given direction is not one of <code>ResultSet.FETCH_FORWARD</code>, <code>ResultSet.FETCH_REVERSE</code>, or <code>ResultSet.FETCH_UNKNOWN</code><DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><a href="package-summary.html#2.0 API">What Is in the JDBC 2.0 API</a></DL></DD></DL><HR><A NAME="getFetchDirection()"><!-- --></A><H3>getFetchDirection</H3>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -