📄 statement.html
字号:
<PRE>public int <B>getFetchDirection</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Retrieves the direction for fetching rows from database tables that is the default for result sets generated from this <code>Statement</code> object. If this <code>Statement</code> object has not set a fetch direction by calling the method <code>setFetchDirection</code>, the return value is implementation-specific.<DD><DL><DT><B>Returns:</B><DD>the default fetch direction for result sets generated from this <code>Statement</code> object<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<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="setFetchSize(int)"><!-- --></A><H3>setFetchSize</H3><PRE>public void <B>setFetchSize</B>(int rows) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Gives the JDBC driver a hint as to the number of rows that should be fetched from the database when more rows are needed. The number of rows specified affects only result sets created using this statement. If the value specified is zero, then the hint is ignored. The default value is zero.<DD><DL><DT><B>Parameters:</B><DD><CODE>rows</CODE> - the number of rows to fetch<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs, or the condition 0 <= rows <= this.getMaxRows() is not satisfied.<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="getFetchSize()"><!-- --></A><H3>getFetchSize</H3><PRE>public int <B>getFetchSize</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Retrieves the number of result set rows that is the default fetch size for result sets generated from this <code>Statement</code> object. If this <code>Statement</code> object has not set a fetch size by calling the method <code>setFetchSize</code>, the return value is implementation-specific.<DD><DL><DT><B>Returns:</B><DD>the default fetch size for result sets generated from this <code>Statement</code> object<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<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="getResultSetConcurrency()"><!-- --></A><H3>getResultSetConcurrency</H3><PRE>public int <B>getResultSetConcurrency</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Retrieves the result set concurrency for <code>ResultSet</code> objects generated by this <code>Statement</code> object.<DD><DL><DT><B>Returns:</B><DD>either <code>ResultSet.CONCUR_READ_ONLY</code> or <code>ResultSet.CONCUR_UPDATABLE</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="getResultSetType()"><!-- --></A><H3>getResultSetType</H3><PRE>public int <B>getResultSetType</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Retrieves the result set type for <code>ResultSet</code> objects generated by this <code>Statement</code> object.<DD><DL><DT><B>Returns:</B><DD>one of <code>ResultSet.TYPE_FORWARD_ONLY</code>, <code>ResultSet.TYPE_SCROLL_INSENSITIVE</code>, or <code>ResultSet.TYPE_SCROLL_SENSITIVE</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="addBatch(java.lang.String)"><!-- --></A><H3>addBatch</H3><PRE>public void <B>addBatch</B>(<A HREF="../../java/lang/String.html">String</A> sql) throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Adds an SQL command to the current batch of commmands for this <code>Statement</code> object. This method is optional.<DD><DL><DT><B>Parameters:</B><DD><CODE>sql</CODE> - typically this is a static SQL <code>INSERT</code> or <code>UPDATE</code> statement<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs, or the driver does not support batch statements<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="clearBatch()"><!-- --></A><H3>clearBatch</H3><PRE>public void <B>clearBatch</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Makes the set of commands in the current batch empty. This method is optional.<DD><DL><DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs or the driver does not support batch statements<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="executeBatch()"><!-- --></A><H3>executeBatch</H3><PRE>public int[] <B>executeBatch</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Submits a batch of commands to the database for execution and if all commands execute successfully, returns an array of update counts. The <code>int</code> elements of the array that is returned are ordered to correspond to the commands in the batch, which are ordered according to the order in which they were added to the batch. The elements in the array returned by the method <code>executeBatch</code> may be one of the following: <OL> <LI>A number greater than or equal to zero -- indicates that the command was processed successfully and is an update count giving the number of rows in the database that were affected by the command's execution <LI>A value of <code>-2</code> -- indicates that the command was processed successfully but that the number of rows affected is unknown <P> If one of the commands in a batch update fails to execute properly, this method throws a <code>BatchUpdateException</code>, and a JDBC driver may or may not continue to process the remaining commands in the batch. However, the driver's behavior must be consistent with a particular DBMS, either always continuing to process commands or never continuing to process commands. If the driver continues processing after a failure, the array returned by the method <code>BatchUpdateException.getUpdateCounts</code> will contain as many elements as there are commands in the batch, and at least one of the elements will be the following: <P> <LI>A value of <code>-3</code> -- indicates that the command failed to execute successfully and occurs only if a driver continues to process commands after a command fails </OL> <P> A driver is not required to implement this method. The possible implementations and return values have been modified in the Java 2 SDK, Standard Edition, version 1.3 to accommodate the option of continuing to proccess commands in a batch update after a <code>BatchUpdateException</code> obejct has been thrown.<DD><DL><DT><B>Returns:</B><DD>an array of update counts containing one element for each command in the batch. The elements of the array are ordered according to the order in which commands were added to the batch.<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs or the driver does not support batch statements. Throws <A HREF="../../java/sql/BatchUpdateException.html"><CODE>BatchUpdateException</CODE></A> (a subclass of <code>SQLException</code>) if one of the commands sent to the database fails to execute properly or attempts to return a result set.<DT><B>Since: </B><DD>1.3</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="getConnection()"><!-- --></A><H3>getConnection</H3><PRE>public <A HREF="../../java/sql/Connection.html">Connection</A> <B>getConnection</B>() throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Returns the <code>Connection</code> object that produced this <code>Statement</code> object.<DD><DL><DT><B>Returns:</B><DD>the connection that produced this statement<DT><B>Throws:</B><DD><CODE><A HREF="../../java/sql/SQLException.html">SQLException</A></CODE> - if a database access error occurs<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><!-- ========= END OF CLASS DATA ========= --><HR><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_bottom"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_bottom_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3"> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/Statement.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-files/index-1.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD> </TR></TABLE></TD><TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/sql/SQLOutput.html"><B>PREV CLASS</B></A> <A HREF="../../java/sql/Struct.html"><B>NEXT CLASS</B></A></FONT></TD><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A> <A HREF="Statement.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | FIELD | CONSTR | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: FIELD | CONSTR | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><font size="-1"><a href="http://java.sun.com/cgi-bin/bugreport.cgi">Submit a bug or feature</a><br>For further API reference and developer documentation, see <a href="http://java.sun.com/products/jdk/1.3/devdocs-vs-specs.html">Java 2 SDK SE Developer Documentation</a>. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples. <p>Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.<br>Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road<br>Palo Alto, California, 94303, U.S.A. All Rights Reserved.</font></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -