所有类


java.sql
接口 SQLOutput

所有已知实现类:
SQLOutputImpl

public interface SQLOutput

用于将用户定义类型的属性写回数据库的输出流。此接口(仅用于自定义映射关系)供应用程序使用,程序员永远不能直接调用其方法。

将实现接口 SQLData 的类的对象作为参数传递给 SQL 语句时,JDBC 驱动程序将调用方法 SQLData.getSQLType 来确定要传递到数据库的 SQL 数据的种类。然后,驱动程序创建 SQLOutput 的实例并将其传递给方法 SQLData.writeSQL。方法 writeSQL 依次调用适当的 SQLOutputwriter 方法(writeBooleanwriteCharacterStream 等),将数据作为 SQL 用户定义类型的表示形式从 SQLData 对象写入 SQLOutput 输出流。

从以下版本开始:
1.2

方法摘要
 voidwriteArray(Array x)
          将 SQL ARRAY 值写入流中。
 voidwriteAsciiStream(InputStream x)
          将下一个属性作为 ASCII 字符流写入流中。
 voidwriteBigDecimal(BigDecimal x)
          将下一个属性作为 java.math.BigDecimal 对象写入流中。
 voidwriteBinaryStream(InputStream x)
          将下一个属性作为未解释字节流写入流中。
 voidwriteBlob(Blob x)
          将 SQL BLOB 值写入流中。
 voidwriteBoolean(boolean x)
          将下一个属性作为 Java boolean 值写入流。
 voidwriteByte(byte x)
          将下一个属性作为 Java byte 值写入流中。
 voidwriteBytes(byte[] x)
          将下一个属性作为字节数组写入流中。
 voidwriteCharacterStream(Reader x)
          将下一个属性作为 Unicode 字符的流写入流中。
 voidwriteClob(Clob x)
          将 SQL CLOB 值写入流中。
 voidwriteDate(Date x)
          将下一个属性作为 java.sql.Date 对象写入流中。
 voidwriteDouble(double x)
          将下一个属性作为 Java double 值写入流中。
 voidwriteFloat(float x)
          将下一个属性作为 Java float 值写入流中。
 voidwriteInt(int x)
          将下一个属性作为 Java int 值写入流中。
 voidwriteLong(long x)
          将下一个属性作为 Java long 值写入流中。
 voidwriteObject(SQLData x)
          将给定 SQLData 对象中包含的数据写入流中。
 voidwriteRef(Ref x)
          将 SQL REF 值写入流中。
 voidwriteShort(short x)
          将下一个属性作为 Java short 值写入流中。
 voidwriteString(String x)
          将下一个属性作为 Java 编程语言中的 String 写入流中。
 voidwriteStruct(Struct x)
          将 SQL 结构类型值写入流中。
 voidwriteTime(Time x)
          将下一个属性作为 java.sql.Time 对象写入流中。
 voidwriteTimestamp(Timestamp x)
          将下一个属性作为 java.sql.Timestamp 对象写入流中。
 voidwriteURL(URL x)
          将 SQL DATALINK 值写入流中。
 

方法详细信息

writeString

void writeString(String x)
                 throws SQLException
将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误

writeBoolean

void writeBoolean(boolean x)
                  throws SQLException
将下一个属性作为 Java boolean 值写入流。将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误

writeByte

void writeByte(byte x)
               throws SQLException
将下一个属性作为 Java byte 值写入流中。将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误

writeShort

void writeShort(short x)
                throws SQLException
将下一个属性作为 Java short 值写入流中。将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误

writeInt

void writeInt(int x)
              throws SQLException
将下一个属性作为 Java int 值写入流中。将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误

writeLong

void writeLong(long x)
               throws SQLException
将下一个属性作为 Java long 值写入流中。将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误

writeFloat

void writeFloat(float x)
                throws SQLException
将下一个属性作为 Java float 值写入流中。将下一个属性作为 Java 编程语言中的 String 写入流中。

参数:
x - 传递给数据库的值
抛出:
SQLException - 如果发生数据库访问错误