Interface SQLInput
public interface SQLInput
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:
SQLData
-
Method Summary
Modifier and Type Method Description ArrayreadArray()Returns the next attribute in the stream in the form of ajava.sql.Array.InputStreamreadAsciiStream()Returns the next attribute in the stream in the form of an ASCII character stream embodied as ajava.io.InputStream.BigDecimalreadBigDecimal()Returns the next attribute in the stream in the form of ajava.math.BigDecimal.InputStreamreadBinaryStream()Returns the next attribute in the stream in the form of a stream of bytes embodied as ajava.io.InputStream.BlobreadBlob()Returns the next attribute in the stream in the form of ajava.sql.Blob.booleanreadBoolean()Returns the next attribute in the stream in the form of aboolean.bytereadByte()Returns the next attribute in the stream in the form of abyte.byte[]readBytes()Returns the next attribute in the stream in the form of a byte array.ReaderreadCharacterStream()Returns the next attribute in the stream in the form of a Unicode character stream embodied as ajava.io.Reader.ClobreadClob()Returns the next attribute in the stream in the form of ajava.sql.Clob.DatereadDate()Returns the next attribute in the stream in the form of ajava.sql.Date.doublereadDouble()Returns the next attribute in the stream in the form of adouble.floatreadFloat()Returns the next attribute in the stream in the form of afloat.intreadInt()Returns the next attribute in the stream in the form of anint.longreadLong()Returns the next attribute in the stream in the form of along.NClobreadNClob()Returns the next attribute in the stream in the form of ajava.sql.NClob.StringreadNString()Returns the next attribute in the stream in the form of ajava.lang.String.ObjectreadObject()Returns the next attribute in the stream in the form of ajava.lang.Object.RefreadRef()Returns the next attribute in the stream in the form of ajava.sql.Ref.RowIdreadRowId()Returns the next attribute in the stream in the form of ajava.sql.RowId.shortreadShort()Returns the next attribute in the stream in the form of ashort.SQLXMLreadSQLXML()Returns the next attribute in the stream in the form of ajava.sql.SQLXML.StringreadString()Returns the next attribute in the stream in the form of aString.TimereadTime()Returns the next attribute in the stream in the form of ajava.sql.Time.TimestampreadTimestamp()Returns the next attribute in the stream in the form of ajava.sql.Timestamp.URLreadURL()Reads the next attribute in the stream (SQL DATALINK value) and returns it as ajava.net.URLobject.booleanwasNull()Reports whether the last value read was SQLNULL.
-
Method Details
-
readString
Returns the next attribute in the stream in the form of aString.- Returns:
- the next attribute.
nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readBoolean
Returns the next attribute in the stream in the form of aboolean.- Returns:
- the next attribute as a
boolean.falseif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readByte
Returns the next attribute in the stream in the form of abyte.- Returns:
- the next attribute as a
byte. 0 if the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readShort
Returns the next attribute in the stream in the form of ashort.- Returns:
- the next attribute as a
short. 0 if the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readInt
Returns the next attribute in the stream in the form of anint.- Returns:
- the next attribute as an
int. 0 if the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readLong
Returns the next attribute in the stream in the form of along.- Returns:
- the next attribute as a
long. 0 if the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readFloat
Returns the next attribute in the stream in the form of afloat.- Returns:
- the next attribute as a
float. 0 if the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readDouble
Returns the next attribute in the stream in the form of adouble.- Returns:
- the next attribute as a
double. 0 if the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readBigDecimal
Returns the next attribute in the stream in the form of ajava.math.BigDecimal.- Returns:
- the attribute as a
java.math.BigDecimal.nullif the read returns SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
BigDecimal
-
readBytes
Returns the next attribute in the stream in the form of a byte array.- Returns:
- the attribute as a byte array.
nullif the read returns SQLNULL. - Throws:
SQLException- if there is a database error.
-
readDate
Returns the next attribute in the stream in the form of ajava.sql.Date.- Returns:
- the next attribute as a
java.sql.Date.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Date
-
readTime
Returns the next attribute in the stream in the form of ajava.sql.Time.- Returns:
- the attribute as a
java.sql.Time.nullif the read returns SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Time
-
readTimestamp
Returns the next attribute in the stream in the form of ajava.sql.Timestamp.- Returns:
- the attribute as a
java.sql.Timestamp.nullif the read returns SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Timestamp
-
readCharacterStream
Returns the next attribute in the stream in the form of a Unicode character stream embodied as ajava.io.Reader.- Returns:
- the next attribute as a
java.io.Reader.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Reader
-
readAsciiStream
Returns the next attribute in the stream in the form of an ASCII character stream embodied as ajava.io.InputStream.- Returns:
- the next attribute as a
java.io.InputStream.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
InputStream
-
readBinaryStream
Returns the next attribute in the stream in the form of a stream of bytes embodied as ajava.io.InputStream.- Returns:
- the next attribute as a
java.io.InputStream.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
InputStream
-
readObject
Returns the next attribute in the stream in the form of ajava.lang.Object.The type of the
Objectreturned is determined by the type mapping for this JDBC driver, including any customized mappings, if present. A type map is given to theSQLInputby the JDBC driver before theSQLInputis 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.readSQLon it, which reads supplementary data from the stream using whichever protocol is defined for that method.- Returns:
- the next attribute as an Object.
nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readRef
Returns the next attribute in the stream in the form of ajava.sql.Ref.- Returns:
- the next attribute as a
java.sql.Ref.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Ref
-
readBlob
Returns the next attribute in the stream in the form of ajava.sql.Blob.- Returns:
- the next attribute as a
java.sql.Blob.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readClob
Returns the next attribute in the stream in the form of ajava.sql.Clob.- Returns:
- the next attribute as a
java.sql.Clob.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Clob
-
readArray
Returns the next attribute in the stream in the form of ajava.sql.Array.- Returns:
- the next attribute as an
Array.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
Array
-
wasNull
Reports whether the last value read was SQLNULL.- Returns:
trueif the last value read was SQLNULL,falseotherwise.- Throws:
SQLException- if there is a database error.
-
readURL
Reads the next attribute in the stream (SQL DATALINK value) and returns it as ajava.net.URLobject.- Returns:
- the next attribute as a
java.net.URL.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.- See Also:
URL
-
readNClob
Returns the next attribute in the stream in the form of ajava.sql.NClob.- Returns:
- the next attribute as a
java.sql.NClob.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readNString
Returns the next attribute in the stream in the form of ajava.lang.String. Used for the NCHAR, NVARCHAR and LONGNVARCHAR types. SeereadString()otherwise.- Returns:
- the next attribute as a
java.lang.String.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readSQLXML
Returns the next attribute in the stream in the form of ajava.sql.SQLXML.- Returns:
- the next attribute as a
java.sql.SQLXML.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-
readRowId
Returns the next attribute in the stream in the form of ajava.sql.RowId. Used for the ROWID type.- Returns:
- the next attribute as a
java.sql.RowId.nullif the value is SQLNULL. - Throws:
SQLException- if there is a database error.
-