Since: API Level 1
public interface

SQLInput

java.sql.SQLInput

Class Overview

The SQLInput interface defines operations which apply to a type of input stream which carries a series of values representing an instance of an SQL structured type or SQL distinct type.

This interface is used to define custom mappings of SQL User Defined Types (UDTs) to Java classes. It is used by JDBC drivers, therefore application programmers do not normally use the SQLInput methods directly. Reader methods such as readLong and readBytes provide means to read values from an SQLInput stream.

When the getObject method is called with an object which implements the SQLData interface, the JDBC driver determines the SQL type of the UDT being mapped by calling the SQLData.getSQLType method. The driver creates an instance of an SQLInput stream, filling the stream with the attributes of the UDT. The SQLInput stream is passed to the SQLData.readSQL method which then calls the SQLInput reader methods to read the attributes.

See Also

Summary

Public Methods
abstract Array readArray()
Returns the next attribute in the stream in the form of a java.sql.Array.
abstract InputStream readAsciiStream()
Returns the next attribute in the stream in the form of an ASCII character stream embodied as a java.io.InputStream.
abstract BigDecimal readBigDecimal()
Returns the next attribute in the stream in the form of a java.math.BigDecimal.
abstract InputStream readBinaryStream()
Returns the next attribute in the stream in the form of a stream of bytes embodied as a java.io.InputStream.
abstract Blob readBlob()
Returns the next attribute in the stream in the form of a java.sql.Blob.
abstract boolean readBoolean()
Returns the next attribute in the stream in the form of a boolean .
abstract byte readByte()
Returns the next attribute in the stream in the form of a byte.
abstract byte[] readBytes()
Returns the next attribute in the stream in the form of a byte array.
abstract Reader readCharacterStream()
Returns the next attribute in the stream in the form of a Unicode character stream embodied as a java.io.Reader.
abstract Clob readClob()
Returns the next attribute in the stream in the form of a java.sql.Clob.
abstract Date readDate()
Returns the next attribute in the stream in the form of a java.sql.Date.
abstract double readDouble()
Returns the next attribute in the stream in the form of a double.
abstract float readFloat()
Returns the next attribute in the stream in the form of a float.
abstract int readInt()
Returns the next attribute in the stream in the form of an int.
abstract long readLong()
Returns the next attribute in the stream in the form of a long.
abstract Object readObject()
Returns the next attribute in the stream in the form of a java.lang.Object.
abstract Ref readRef()
Returns the next attribute in the stream in the form of a java.sql.Ref.
abstract short readShort()
Returns the next attribute in the stream in the form of a short.
abstract String readString()
Returns the next attribute in the stream in the form of a String.
abstract Time readTime()
Returns the next attribute in the stream in the form of a java.sql.Time.
abstract Timestamp readTimestamp()
Returns the next attribute in the stream in the form of a java.sql.Timestamp.
abstract URL readURL()
Reads the next attribute in the stream (SQL DATALINK value) and returns it as a java.net.URL object.
abstract boolean wasNull()
Reports whether the last value read was SQL NULL.

Public Methods

public abstract Array readArray ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Array.

Returns
  • the next attribute as an Array. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract InputStream readAsciiStream ()

Since: API Level 1

Returns the next attribute in the stream in the form of an ASCII character stream embodied as a java.io.InputStream.

Returns
  • the next attribute as a java.io.InputStream. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract BigDecimal readBigDecimal ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.math.BigDecimal.

Returns
  • the attribute as a java.math.BigDecimal. null if the read returns SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract InputStream readBinaryStream ()

Since: API Level 1

Returns the next attribute in the stream in the form of a stream of bytes embodied as a java.io.InputStream.

Returns
  • the next attribute as a java.io.InputStream. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract Blob readBlob ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Blob.

Returns
  • the next attribute as a java.sql.Blob. null if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract boolean readBoolean ()

Since: API Level 1

Returns the next attribute in the stream in the form of a boolean .

Returns
  • the next attribute as a boolean. false if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract byte readByte ()

Since: API Level 1

Returns the next attribute in the stream in the form of a byte.

Returns
  • the next attribute as a byte. 0 if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract byte[] readBytes ()

Since: API Level 1

Returns the next attribute in the stream in the form of a byte array.

Returns
  • the attribute as a byte array. null if the read returns SQL NULL.
Throws
SQLException if there is a database error.

public abstract Reader readCharacterStream ()

Since: API Level 1

Returns the next attribute in the stream in the form of a Unicode character stream embodied as a java.io.Reader.

Returns
  • the next attribute as a java.io.Reader. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract Clob readClob ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Clob.

Returns
  • the next attribute as a java.sql.Clob. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract Date readDate ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Date.

Returns
  • the next attribute as a java.sql.Date. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract double readDouble ()

Since: API Level 1

Returns the next attribute in the stream in the form of a double.

Returns
  • the next attribute as a double. 0 if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract float readFloat ()

Since: API Level 1

Returns the next attribute in the stream in the form of a float.

Returns
  • the next attribute as a float. 0 if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract int readInt ()

Since: API Level 1

Returns the next attribute in the stream in the form of an int.

Returns
  • the next attribute as an int. 0 if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract long readLong ()

Since: API Level 1

Returns the next attribute in the stream in the form of a long.

Returns
  • the next attribute as a long. 0 if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract Object readObject ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.lang.Object.

The type of the Object returned is determined by the type mapping for this JDBC driver, including any customized mappings, if present. A type map is given to the SQLInput by the JDBC driver before the SQLInput is given to the application.

If the attribute is an SQL structured or distinct type, its SQL type is determined. If the stream's type map contains an element for that SQL type, the driver creates an object for the relevant type and invokes the method SQLData.readSQL on it, which reads supplementary data from the stream using whichever protocol is defined for that method.

Returns
  • the next attribute as an Object. null if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract Ref readRef ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Ref.

Returns
  • the next attribute as a java.sql.Ref. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract short readShort ()

Since: API Level 1

Returns the next attribute in the stream in the form of a short.

Returns
  • the next attribute as a short. 0 if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract String readString ()

Since: API Level 1

Returns the next attribute in the stream in the form of a String.

Returns
  • the next attribute. null if the value is SQL NULL.
Throws
SQLException if there is a database error.

public abstract Time readTime ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Time.

Returns
  • the attribute as a java.sql.Time. null if the read returns SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract Timestamp readTimestamp ()

Since: API Level 1

Returns the next attribute in the stream in the form of a java.sql.Timestamp.

Returns
  • the attribute as a java.sql.Timestamp. null if the read returns SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract URL readURL ()

Since: API Level 1

Reads the next attribute in the stream (SQL DATALINK value) and returns it as a java.net.URL object.

Returns
  • the next attribute as a java.net.URL. null if the value is SQL NULL.
Throws
SQLException if there is a database error.
See Also

public abstract boolean wasNull ()

Since: API Level 1

Reports whether the last value read was SQL NULL.

Returns
  • true if the last value read was SQL NULL, false otherwise.
Throws
SQLException if there is a database error.