java.sql
Interface SQLInput

All Known Implementing Classes:
SQLInputImpl sample code for javax.sql.rowset.serial.SQLInputImpl definition code for javax.sql.rowset.serial.SQLInputImpl

public interface SQLInput

An input stream that contains a stream of values representing an instance of an SQL structured type or an SQL 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. The reader methods (readLong, readBytes, and so on) provide a way to read the values in an SQLInput object. The method wasNull is used to determine whether the the last value read was SQL NULL.

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 reader methods in its implementation for reading the attributes from the input stream.

Since:
1.2

Method Summary
 Array sample code for java.sql.Array definition code for java.sql.Array readArray sample code for java.sql.SQLInput.readArray() definition code for java.sql.SQLInput.readArray() ()
          Reads an SQL ARRAY value from the stream and returns it as an Array object in the Java programming language.
 InputStream sample code for java.io.InputStream definition code for java.io.InputStream readAsciiStream sample code for java.sql.SQLInput.readAsciiStream() definition code for java.sql.SQLInput.readAsciiStream() ()
          Reads the next attribute in the stream and returns it as a stream of ASCII characters.
 BigDecimal sample code for java.math.BigDecimal definition code for java.math.BigDecimal readBigDecimal sample code for java.sql.SQLInput.readBigDecimal() definition code for java.sql.SQLInput.readBigDecimal() ()
          Reads the next attribute in the stream and returns it as a java.math.BigDecimal object in the Java programming language.
 InputStream sample code for java.io.InputStream definition code for java.io.InputStream readBinaryStream sample code for java.sql.SQLInput.readBinaryStream() definition code for java.sql.SQLInput.readBinaryStream() ()
          Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.
 Blob sample code for java.sql.Blob definition code for java.sql.Blob readBlob sample code for java.sql.SQLInput.readBlob() definition code for java.sql.SQLInput.readBlob() ()
          Reads an SQL BLOB value from the stream and returns it as a Blob object in the Java programming language.
 boolean readBoolean sample code for java.sql.SQLInput.readBoolean() definition code for java.sql.SQLInput.readBoolean() ()
          Reads the next attribute in the stream and returns it as a boolean in the Java programming language.
 byte readByte sample code for java.sql.SQLInput.readByte() definition code for java.sql.SQLInput.readByte() ()
          Reads the next attribute in the stream and returns it as a byte in the Java programming language.
 byte[] readBytes sample code for java.sql.SQLInput.readBytes() definition code for java.sql.SQLInput.readBytes() ()
          Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.
 Reader sample code for java.io.Reader definition code for java.io.Reader readCharacterStream sample code for java.sql.SQLInput.readCharacterStream() definition code for java.sql.SQLInput.readCharacterStream() ()
          Reads the next attribute in the stream and returns it as a stream of Unicode characters.
 Clob sample code for java.sql.Clob definition code for java.sql.Clob readClob sample code for java.sql.SQLInput.readClob() definition code for java.sql.SQLInput.readClob() ()
          Reads an SQL CLOB value from the stream and returns it as a Clob object in the Java programming language.
 Date sample code for java.sql.Date definition code for java.sql.Date readDate sample code for java.sql.SQLInput.readDate() definition code for java.sql.SQLInput.readDate() ()
          Reads the next attribute in the stream and returns it as a java.sql.Date object.
 double readDouble sample code for java.sql.SQLInput.readDouble() definition code for java.sql.SQLInput.readDouble() ()
          Reads the next attribute in the stream and returns it as a double in the Java programming language.
 float readFloat sample code for java.sql.SQLInput.readFloat() definition code for java.sql.SQLInput.readFloat() ()
          Reads the next attribute in the stream and returns it as a float in the Java programming language.
 int readInt sample code for java.sql.SQLInput.readInt() definition code for java.sql.SQLInput.readInt() ()
          Reads the next attribute in the stream and returns it as an int in the Java programming language.
 long readLong sample code for java.sql.SQLInput.readLong() definition code for java.sql.SQLInput.readLong() ()
          Reads the next attribute in the stream and returns it as a long in the Java programming language.
 Object sample code for java.lang.Object definition code for java.lang.Object readObject sample code for java.sql.SQLInput.readObject() definition code for java.sql.SQLInput.readObject() ()
          Reads the datum at the head of the stream and returns it as an Object in the Java programming language.
 Ref sample code for java.sql.Ref definition code for java.sql.Ref readRef sample code for java.sql.SQLInput.readRef() definition code for java.sql.SQLInput.readRef() ()
          Reads an SQL REF value from the stream and returns it as a Ref object in the Java programming language.
 short readShort sample code for java.sql.SQLInput.readShort() definition code for java.sql.SQLInput.readShort() ()
          Reads the next attribute in the stream and returns it as a short in the Java programming language.
 String sample code for java.lang.String definition code for java.lang.String readString sample code for java.sql.SQLInput.readString() definition code for java.sql.SQLInput.readString() ()
          Reads the next attribute in the stream and returns it as a String in the Java programming language.
 Time sample code for java.sql.Time definition code for java.sql.Time readTime sample code for java.sql.SQLInput.readTime() definition code for java.sql.SQLInput.readTime() ()
          Reads the next attribute in the stream and returns it as a java.sql.Time object.
 Timestamp sample code for java.sql.Timestamp definition code for java.sql.Timestamp readTimestamp sample code for java.sql.SQLInput.readTimestamp() definition code for java.sql.SQLInput.readTimestamp() ()
          Reads the next attribute in the stream and returns it as a java.sql.Timestamp object.
 URL sample code for java.net.URL definition code for java.net.URL readURL sample code for java.sql.SQLInput.readURL() definition code for java.sql.SQLInput.readURL() ()
          Reads an SQL DATALINK value from the stream and returns it as a java.net.URL object in the Java programming language.
 boolean wasNull sample code for java.sql.SQLInput.wasNull() definition code for java.sql.SQLInput.wasNull() ()
          Retrieves whether the last value read was SQL NULL.
 

Method Detail

readString sample code for java.sql.SQLInput.readString() definition code for java.sql.SQLInput.readString()

String sample code for java.lang.String definition code for java.lang.String  readString()
                  throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a String in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readBoolean sample code for java.sql.SQLInput.readBoolean() definition code for java.sql.SQLInput.readBoolean()

boolean readBoolean()
                    throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a boolean in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns false
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readByte sample code for java.sql.SQLInput.readByte() definition code for java.sql.SQLInput.readByte()

byte readByte()
              throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a byte in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns 0
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readShort sample code for java.sql.SQLInput.readShort() definition code for java.sql.SQLInput.readShort()

short readShort()
                throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a short in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns 0
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readInt sample code for java.sql.SQLInput.readInt() definition code for java.sql.SQLInput.readInt()

int readInt()
            throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as an int in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns 0
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readLong sample code for java.sql.SQLInput.readLong() definition code for java.sql.SQLInput.readLong()

long readLong()
              throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a long in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns 0
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readFloat sample code for java.sql.SQLInput.readFloat() definition code for java.sql.SQLInput.readFloat()

float readFloat()
                throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a float in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns 0
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readDouble sample code for java.sql.SQLInput.readDouble() definition code for java.sql.SQLInput.readDouble()

double readDouble()
                  throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a double in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns 0
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readBigDecimal sample code for java.sql.SQLInput.readBigDecimal() definition code for java.sql.SQLInput.readBigDecimal()

BigDecimal sample code for java.math.BigDecimal definition code for java.math.BigDecimal  readBigDecimal()
                          throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a java.math.BigDecimal object in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readBytes sample code for java.sql.SQLInput.readBytes() definition code for java.sql.SQLInput.readBytes()

byte[] readBytes()
                 throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readDate sample code for java.sql.SQLInput.readDate() definition code for java.sql.SQLInput.readDate()

Date sample code for java.sql.Date definition code for java.sql.Date  readDate()
              throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a java.sql.Date object.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readTime sample code for java.sql.SQLInput.readTime() definition code for java.sql.SQLInput.readTime()

Time sample code for java.sql.Time definition code for java.sql.Time  readTime()
              throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a java.sql.Time object.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readTimestamp sample code for java.sql.SQLInput.readTimestamp() definition code for java.sql.SQLInput.readTimestamp()

Timestamp sample code for java.sql.Timestamp definition code for java.sql.Timestamp  readTimestamp()
                        throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a java.sql.Timestamp object.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readCharacterStream sample code for java.sql.SQLInput.readCharacterStream() definition code for java.sql.SQLInput.readCharacterStream()

Reader sample code for java.io.Reader definition code for java.io.Reader  readCharacterStream()
                           throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a stream of Unicode characters.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readAsciiStream sample code for java.sql.SQLInput.readAsciiStream() definition code for java.sql.SQLInput.readAsciiStream()

InputStream sample code for java.io.InputStream definition code for java.io.InputStream  readAsciiStream()
                            throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a stream of ASCII characters.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readBinaryStream sample code for java.sql.SQLInput.readBinaryStream() definition code for java.sql.SQLInput.readBinaryStream()

InputStream sample code for java.io.InputStream definition code for java.io.InputStream  readBinaryStream()
                             throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.

Returns:
the attribute; if the value is SQL NULL, returns null
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readObject sample code for java.sql.SQLInput.readObject() definition code for java.sql.SQLInput.readObject()

Object sample code for java.lang.Object definition code for java.lang.Object  readObject()
                  throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads the datum at the head of the stream and returns it as an Object in the Java programming language. 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. If the stream's type map has an entry for that SQL type, the driver 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 an Object in the Java programming language;null if the datum is SQL NULL
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readRef sample code for java.sql.SQLInput.readRef() definition code for java.sql.SQLInput.readRef()

Ref sample code for java.sql.Ref definition code for java.sql.Ref  readRef()
            throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads an SQL REF value from the stream and returns it as a Ref object in the Java programming language.

Returns:
a Ref object representing the SQL REF value at the head of the stream; null if the value read is SQL NULL
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readBlob sample code for java.sql.SQLInput.readBlob() definition code for java.sql.SQLInput.readBlob()

Blob sample code for java.sql.Blob definition code for java.sql.Blob  readBlob()
              throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads an SQL BLOB value from the stream and returns it as a Blob object in the Java programming language.

Returns:
a Blob object representing data of the SQL BLOB value at the head of the stream; null if the value read is SQL NULL
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readClob sample code for java.sql.SQLInput.readClob() definition code for java.sql.SQLInput.readClob()

Clob sample code for java.sql.Clob definition code for java.sql.Clob  readClob()
              throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads an SQL CLOB value from the stream and returns it as a Clob object in the Java programming language.

Returns:
a Clob object representing data of the SQL CLOB value at the head of the stream; null if the value read is SQL NULL
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readArray sample code for java.sql.SQLInput.readArray() definition code for java.sql.SQLInput.readArray()

Array sample code for java.sql.Array definition code for java.sql.Array  readArray()
                throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads an SQL ARRAY value from the stream and returns it as an Array object in the Java programming language.

Returns:
an Array object representing data of the SQL ARRAY value at the head of the stream; null if the value read is SQL NULL
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

wasNull sample code for java.sql.SQLInput.wasNull() definition code for java.sql.SQLInput.wasNull()

boolean wasNull()
                throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Retrieves whether the last value read was SQL NULL.

Returns:
true if the most recently read SQL value was SQL NULL; false otherwise
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs

readURL sample code for java.sql.SQLInput.readURL() definition code for java.sql.SQLInput.readURL()

URL sample code for java.net.URL definition code for java.net.URL  readURL()
            throws SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException 
Reads an SQL DATALINK value from the stream and returns it as a java.net.URL object in the Java programming language.

Returns:
a java.net.URL object.
Throws:
SQLException sample code for java.sql.SQLException definition code for java.sql.SQLException - if a database access error occurs, or if a URL is malformed
Since:
1.4