站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

Java(TM) 2 Platform, Standard Edition, v1.2.2 API Specification: Interface SQLInput - JDK 5 Documentation v1.2.2, Java 2 SDK 英文文档

JavaTM 2 Platform
Standard Edition

java.sql
Interface SQLInput


public interface SQLInput

JDBC 2.0 A input stream that contains a stream of values representing an instance of an SQL structured or distinct type. This interface, used only for custom mapping, is used by the driver behind the scenes, and a programmer never directly invokes SQLInput methods.

When the method getObject is called with an object of a class implementing the interface SQLData, the JDBC driver calls the method SQLData.getSQLType to determine the SQL type of the user-defined type (UDT) being custom mapped. The driver creates an instance of SQLInput, populating it with the attributes of the UDT. The driver then passes the input stream to the method SQLData.readSQL, which in turn calls the SQLInput.readXXX methods in its implementation for reading the attributes from the input stream.


Method Summary
 Array readArray()
          Reads an array from the stream.
 InputStream readAsciiStream()
          Returns the next attribute in the stream as a stream of ASCII characters.
 BigDecimal readBigDecimal()
          Reads the next attribute in the stream as a java.math.BigDecimal object.
 InputStream readBinaryStream()
          Returns the next attribute in the stream as a stream of uninterpreted bytes.
 Blob readBlob()
          Reads a BLOB from the stream.
 boolean readBoolean()
          Reads the next attribute in the stream as a Java boolean.
 byte readByte()
          Reads the next attribute in the stream as a Java byte.
 byte[] readBytes()
          Reads the next attribute in the stream as an array of bytes.
 Reader readCharacterStream()
          Returns the next attribute in the stream as a stream of Unicode characters.
 Clob readClob()
          Reads a CLOB from the stream.
 Date readDate()
          Reads the next attribute in the stream as a java.sql.Date object.
 double readDouble()
          Reads the next attribute in the stream as a Java double.
 float readFloat()
          Reads the next attribute in the stream as a Java float.
 int readInt()
          Reads the next attribute in the stream as a Java int.
 long readLong()
          Reads the next attribute in the stream as a Java long.
 Object readObject()
          Returns the datum at the head of the stream as a Java object.
 Ref readRef()
          Reads a REF(<structured-type>) from the stream.
 short readShort()
          Reads the next attribute in the stream as a Java short.
 String readString()
          Reads the next attribute in the stream as a Java String.
 Time readTime()
          Reads the next attribute in the stream as a java.sql.Time object.
 Timestamp readTimestamp()
          Reads the next attribute in the stream as a java.sql.Timestamp object.
 boolean wasNull()
          Determines whether the last value read was null.
 

Method Detail

readString

public String readString()
                  throws SQLException
Reads the next attribute in the stream as a Java String.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readBoolean

public boolean readBoolean()
                    throws SQLException
Reads the next attribute in the stream as a Java boolean.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readByte

public byte readByte()
              throws SQLException
Reads the next attribute in the stream as a Java byte.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readShort

public short readShort()
                throws SQLException
Reads the next attribute in the stream as a Java short.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readInt

public int readInt()
            throws SQLException
Reads the next attribute in the stream as a Java int.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readLong

public long readLong()
              throws SQLException
Reads the next attribute in the stream as a Java long.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readFloat

public float readFloat()
                throws SQLException
Reads the next attribute in the stream as a Java float.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readDouble

public double readDouble()
                  throws SQLException
Reads the next attribute in the stream as a Java double.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readBigDecimal

public BigDecimal readBigDecimal()
                          throws SQLException
Reads the next attribute in the stream as a java.math.BigDecimal object.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readBytes

public byte[] readBytes()
                 throws SQLException
Reads the next attribute in the stream as an array of bytes.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readDate

public Date readDate()
              throws SQLException
Reads the next attribute in the stream as a java.sql.Date object.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readTime

public Time readTime()
              throws SQLException
Reads the next attribute in the stream as a java.sql.Time object.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readTimestamp

public Timestamp readTimestamp()
                        throws SQLException
Reads the next attribute in the stream as a java.sql.Timestamp object.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readCharacterStream

public Reader readCharacterStream()
                           throws SQLException
Returns the next attribute in the stream as a stream of Unicode characters.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readAsciiStream

public InputStream readAsciiStream()
                            throws SQLException
Returns the next attribute in the stream as a stream of ASCII characters.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readBinaryStream

public InputStream readBinaryStream()
                             throws SQLException
Returns the next attribute in the stream as a stream of uninterpreted bytes.
Returns:
the attribute; if the value is SQL NULL, return null.
Throws:
SQLException - if a database access error occurs

readObject

public Object readObject()
                  throws SQLException
Returns the datum at the head of the stream as a Java object. The actual type of the object returned is determined by the default type mapping, and any customizations present in this stream's type map. A type map is registered with the stream by the JDBC driver before the stream is passed to the application. When the datum at the head of the stream is an SQL NULL, the method returns null. If the datum is an SQL structured or distinct type, it determines the SQL type of the datum at the head of the stream, constructs an object of the appropriate class, and calls the method SQLData.readSQL on that object, which reads additional data from the stream, using the protocol described for that method.
Returns:
the datum at the head of the stream as a Java object; null if the datum is SQL NULL
Throws:
SQLException - if a database access error occurs

readRef

public Ref readRef()
            throws SQLException
Reads a REF(<structured-type>) from the stream.
Returns:
an object representing data of the SQL REF at the head of the stream
Throws:
SQLException - if a database access error occurs

readBlob

public Blob readBlob()
              throws SQLException
Reads a BLOB from the stream.
Returns:
an object representing the SQL BLOB at the head of the stream
Throws:
SQLException - if a database access error occurs

readClob

public Clob readClob()
              throws SQLException
Reads a CLOB from the stream.
Returns:
an object representing the SQL CLOB at the head of the stream
Throws:
SQLException - if a database access error occurs

readArray

public Array readArray()
                throws SQLException
Reads an array from the stream.
Returns:
an object representing the SQL array at the head of the stream
Throws:
SQLException - if a database access error occurs

wasNull

public boolean wasNull()
                throws SQLException
Determines whether the last value read was null.
Returns:
true if the most recently gotten SQL value was null; otherwise, false
Throws:
SQLException - if a database access error occurs

JavaTM 2 Platform
Standard Edition

Submit a bug or feature
Java, Java 2D, and JDBC are a trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1999 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.