updateCharacterStream 方法 (int, java.io.Reader, int)updateCharacterStream Method (int, java.io.Reader, int)

下载下载 JDBC 驱动程序DownloadDownload JDBC Driver

使用将有指定字符数的字符流值更新指定列。Updates the designated column with a character stream value, which will have the specified number of characters.

语法Syntax

  
public void updateCharacterStream(int columnIndex,  
                                  java.io.Reader readerValue,  
                                  int length)  

parametersParameters

columnIndex columnIndex

指示列索引的 int 。An int that indicates the column index.

readerValuereaderValue

Reader 对象。A Reader object.

lengthlength

指示流长度的 int。An int that indicates the length of the stream.

例外Exceptions

SQLServerExceptionSQLServerException

备注Remarks

此 updateCharacterStream 方法是由 java.sql.ResultSet 接口中的 updateCharacterStream 方法指定的。This updateCharacterStream method is specified by the updateCharacterStream method in the java.sql.ResultSet interface.

此方法将来自 Reader 对象的 Unicode 字符传递给所选文本和二进制列。This method passes Unicode characters from a Reader object to selected text and binary columns. 这包括所有文本列与 binary、varbinary、varbinary(max)、image 和 xml 列,但不包括 udt 列 。This includes all text columns and binary, varbinary, varbinary(max), image, and xml columns, but not udt columns.

如果流长度与 length 参数指定的长度不同,则 JDBC 驱动程序将在更新或插入行时引发异常。If the length of the stream is different than that specified in the length parameter, the JDBC driver throws an exception when the row is updated or inserted.

如果流长度未知,则可将 length 参数设置为 -1 以指示驱动程序应接受流而不考虑其长度。If the length of the stream is unknown, the length parameter may be set to -1 to indicate that the driver should accept the stream regardless of its length. 使用 sqljdbc4.jar,当应用程序希望使用长度未知的流来更新列时,建议使用 JDBC 4.0 方法 updateCharacterStream 方法 (int, java.io.Reader)With sqljdbc4.jar, we recommend that you use the JDBC 4.0 method updateCharacterStream Method (int, java.io.Reader) when the application wants to update the column from a stream whose length is unknown.

另请参阅See Also

updateCharacterStream 方法 (SQLServerResultSet) updateCharacterStream Method (SQLServerResultSet)
SQLServerResultSet 成员 SQLServerResultSet Members
SQLServerResultSet 类SQLServerResultSet Class