Interface SQLInput
-
public interface SQLInputTheSQLInputinterface 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
SQLInputmethods directly. Reader methods such asreadLongandreadBytesprovide means to read values from anSQLInputstream.When the
getObjectmethod is called with an object which implements theSQLDatainterface, the JDBC driver determines the SQL type of the UDT being mapped by calling theSQLData.getSQLTypemethod. The driver creates an instance of anSQLInputstream, filling the stream with the attributes of the UDT. TheSQLInputstream is passed to theSQLData.readSQLmethod which then calls theSQLInputreader methods to read the attributes.- See Also:
SQLData
-
-
Method Summary
All Methods Instance Methods Abstract Methods 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 Detail
-
readString
String readString() throws SQLException
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
boolean readBoolean() throws SQLExceptionReturns 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
byte readByte() throws SQLExceptionReturns 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
short readShort() throws SQLExceptionReturns 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
int readInt() throws SQLExceptionReturns 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
long readLong() throws SQLExceptionReturns 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
float readFloat() throws SQLExceptionReturns 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
double readDouble() throws SQLExceptionReturns 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
BigDecimal readBigDecimal() throws SQLException
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
byte[] readBytes() throws SQLExceptionReturns 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
Date readDate() throws SQLException
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
Time readTime() throws SQLException
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
Timestamp readTimestamp() throws SQLException
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
Reader readCharacterStream() throws SQLException
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
InputStream readAsciiStream() throws SQLException
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
InputStream readBinaryStream() throws SQLException
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
Object readObject() throws SQLException
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
Ref readRef() throws SQLException
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
Blob readBlob() throws SQLException
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
Clob readClob() throws SQLException
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
Array readArray() throws SQLException
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
boolean wasNull() throws SQLExceptionReports 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
URL readURL() throws SQLException
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
NClob readNClob() throws SQLException
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
String readNString() throws SQLException
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
SQLXML readSQLXML() throws SQLException
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
RowId readRowId() throws SQLException
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.
-
-