⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 preparedstatement.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
 When a very large ASCII value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code>. Data will be read from the stream as needed until end-of-file is reached.  The JDBC driver will do any necessary conversion from ASCII to the database char format.  <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the Java input stream that contains the ASCII parameter value<DD><CODE>length</CODE> - the number of bytes in the stream<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="setUnicodeStream(int, java.io.InputStream, int)"><!-- --></A><H3>setUnicodeStream</H3><PRE>public void <B>setUnicodeStream</B>(int&nbsp;parameterIndex,                             <A HREF="../../java/io/InputStream.html">InputStream</A>&nbsp;x,                             int&nbsp;length)                      throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD><B>Deprecated.</B>&nbsp;<I></I>&nbsp;<P><DD>Sets the designated parameter to the given input stream, which will have  the specified number of bytes. When a very large UNICODE value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code> object. The data will be read from the stream as needed until end-of-file is reached.  The JDBC driver will do any necessary conversion from UNICODE to the database char format. The byte format of the Unicode stream must be Java UTF-8, as defined in the Java Virtual Machine Specification.  <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the java input stream which contains the UNICODE parameter value<DD><CODE>length</CODE> - the number of bytes in the stream<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="setBinaryStream(int, java.io.InputStream, int)"><!-- --></A><H3>setBinaryStream</H3><PRE>public void <B>setBinaryStream</B>(int&nbsp;parameterIndex,                            <A HREF="../../java/io/InputStream.html">InputStream</A>&nbsp;x,                            int&nbsp;length)                     throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Sets the designated parameter to the given input stream, which will have  the specified number of bytes. When a very large binary value is input to a <code>LONGVARBINARY</code> parameter, it may be more practical to send it via a <code>java.io.InputStream</code> object. The data will be read from the stream as needed until end-of-file is reached.  <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the java input stream which contains the binary parameter value<DD><CODE>length</CODE> - the number of bytes in the stream<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="clearParameters()"><!-- --></A><H3>clearParameters</H3><PRE>public void <B>clearParameters</B>()                     throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Clears the current parameter values immediately. <P>In general, parameter values remain in force for repeated use of a statement. Setting a parameter value automatically clears its previous value.  However, in some cases it is useful to immediately release the resources used by the current parameter values; this can be done by calling the method <code>clearParameters</code>.<DD><DL></DL></DD><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="setObject(int, java.lang.Object, int, int)"><!-- --></A><H3>setObject</H3><PRE>public void <B>setObject</B>(int&nbsp;parameterIndex,                      <A HREF="../../java/lang/Object.html">Object</A>&nbsp;x,                      int&nbsp;targetSqlType,                      int&nbsp;scale)               throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD><p>Sets the value of the designated parameter with the given object. The second argument must be an object type; for integral values, the <code>java.lang</code> equivalent objects should be used. <p>The given Java object will be converted to the given targetSqlType before being sent to the database. If the object has a custom mapping (is of a class implementing the  interface <code>SQLData</code>), the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it  to the SQL data stream. If, on the other hand, the object is of a class implementing Ref, Blob, Clob, Struct,  or Array, the driver should pass it to the database as a value of the  corresponding SQL type. <p>Note that this method may be used to pass datatabase- specific abstract data types.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the object containing the input parameter value<DD><CODE>targetSqlType</CODE> - the SQL type (as defined in java.sql.Types) to be  sent to the database. The scale argument may further qualify this type.<DD><CODE>scale</CODE> - for java.sql.Types.DECIMAL or java.sql.Types.NUMERIC types,          this is the number of digits after the decimal point.  For all other          types, this value will be ignored.<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/Types.html"><CODE>Types</CODE></A></DL></DD></DL><HR><A NAME="setObject(int, java.lang.Object, int)"><!-- --></A><H3>setObject</H3><PRE>public void <B>setObject</B>(int&nbsp;parameterIndex,                      <A HREF="../../java/lang/Object.html">Object</A>&nbsp;x,                      int&nbsp;targetSqlType)               throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Sets the value of the designated parameter with the given object. This method is like the method <code>setObject</code> above, except that it assumes a scale of zero.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the object containing the input parameter value<DD><CODE>targetSqlType</CODE> - the SQL type (as defined in java.sql.Types) to be                       sent to the database<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="setObject(int, java.lang.Object)"><!-- --></A><H3>setObject</H3><PRE>public void <B>setObject</B>(int&nbsp;parameterIndex,                      <A HREF="../../java/lang/Object.html">Object</A>&nbsp;x)               throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD><p>Sets the value of the designated parameter using the given object.  The second parameter must be of type <code>Object</code>; therefore, the <code>java.lang</code> equivalent objects should be used for built-in types. <p>The JDBC specification specifies a standard mapping from Java <code>Object</code> types to SQL types.  The given argument  will be converted to the corresponding SQL type before being sent to the database. <p>Note that this method may be used to pass datatabase- specific abstract data types, by using a driver-specific Java type. If the object is of a class implementing the interface <code>SQLData</code>, the JDBC driver should call the method <code>SQLData.writeSQL</code> to write it to the SQL data stream. If, on the other hand, the object is of a class implementing Ref, Blob, Clob, Struct,  or Array, then the driver should pass it to the database as a value of the  corresponding SQL type. This method throws an exception if there is an ambiguity, for example, if the object is of a class implementing more than one of the interfaces named above.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the object containing the input parameter value<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()"><!-- --></A><H3>execute</H3><PRE>public boolean <B>execute</B>()                throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Executes any kind of SQL statement. Some prepared statements return multiple results; the <code>execute</code> method handles these complex statements as well as the simpler form of statements handled by the methods <code>executeQuery</code> and <code>executeUpdate</code>.<DD><DL></DL></DD><DD><DL><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>Statement.execute(java.lang.String)</CODE></A></DL></DD></DL><HR><A NAME="addBatch()"><!-- --></A><H3>addBatch</H3><PRE>public void <B>addBatch</B>()              throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Adds a set of parameters to this <code>PreparedStatement</code> object's batch of commands.<DD><DL></DL></DD><DD><DL><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="../../java/sql/Statement.html#addBatch(java.lang.String)"><CODE>Statement.addBatch(java.lang.String)</CODE></A>, <a href="package-summary.html#2.0 API">What Is in the JDBC      2.0 API</a></DL></DD></DL><HR><A NAME="setCharacterStream(int, java.io.Reader, int)"><!-- --></A><H3>setCharacterStream</H3><PRE>public void <B>setCharacterStream</B>(int&nbsp;parameterIndex,                               <A HREF="../../java/io/Reader.html">Reader</A>&nbsp;reader,                               int&nbsp;length)                        throws <A HREF="../../java/sql/SQLException.html">SQLException</A></PRE><DL><DD>Sets the designated parameter to the given <code>Reader</code> object, which is the given number of characters long. When a very large UNICODE value is input to a <code>LONGVARCHAR</code> parameter, it may be more practical to send it via a <code>java.io.Reader</code> object. The data will be read from the stream as needed until end-of-file is reached.  The JDBC driver will do any necessary conversion from UNICODE to the database char format.  <P><B>Note:</B> This stream object can either be a standard Java stream object or your own subclass that implements the standard interface.<DD><DL></DL></DD><DD><DL><DT><B>Parameters:</B><DD><CODE>parameterIndex</CODE> - the first parameter is 1, the second is 2, ...<DD><CODE>x</CODE> - the java reader which contains the UNICODE data<DD><CODE>length</CODE> - the number of characters in the stream<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="setRef(int, java.sql.Ref)"><!-- --></A><H3>setRef</H3><PRE>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -