- All Known Implementing Classes:
SQLInputImpl
SQLInput
methods. The reader methods
(readLong
, readBytes
, and so on)
provide a way for an implementation of the SQLData
interface to read the values in an SQLInput
object.
And as described in SQLData
, calls to reader methods must
be made in the order that their corresponding attributes appear in the
SQL definition of the type.
The method wasNull
is used to determine whether
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
Modifier and TypeMethodDescriptionReads an SQLARRAY
value from the stream and returns it as anArray
object in the Java programming language.Reads the next attribute in the stream and returns it as a stream of ASCII characters.Reads the next attribute in the stream and returns it as ajava.math.BigDecimal
object in the Java programming language.Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.readBlob()
Reads an SQLBLOB
value from the stream and returns it as aBlob
object in the Java programming language.boolean
Reads the next attribute in the stream and returns it as aboolean
in the Java programming language.byte
readByte()
Reads the next attribute in the stream and returns it as abyte
in the Java programming language.byte[]
Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.Reads the next attribute in the stream and returns it as a stream of Unicode characters.readClob()
Reads an SQLCLOB
value from the stream and returns it as aClob
object in the Java programming language.readDate()
Reads the next attribute in the stream and returns it as ajava.sql.Date
object.double
Reads the next attribute in the stream and returns it as adouble
in the Java programming language.float
Reads the next attribute in the stream and returns it as afloat
in the Java programming language.int
readInt()
Reads the next attribute in the stream and returns it as anint
in the Java programming language.long
readLong()
Reads the next attribute in the stream and returns it as along
in the Java programming language.Reads an SQLNCLOB
value from the stream and returns it as aNClob
object in the Java programming language.Reads the next attribute in the stream and returns it as aString
in the Java programming language.Reads the datum at the head of the stream and returns it as anObject
in the Java programming language.default <T> T
readObject(Class<T> type)
Reads the next attribute in the stream and returns it as anObject
in the Java programming language.readRef()
Reads an SQLREF
value from the stream and returns it as aRef
object in the Java programming language.Reads an SQLROWID
value from the stream and returns it as aRowId
object in the Java programming language.short
Reads the next attribute in the stream and returns it as ashort
in the Java programming language.Reads an SQLXML
value from the stream and returns it as aSQLXML
object in the Java programming language.Reads the next attribute in the stream and returns it as aString
in the Java programming language.readTime()
Reads the next attribute in the stream and returns it as ajava.sql.Time
object.Reads the next attribute in the stream and returns it as ajava.sql.Timestamp
object.readURL()
Reads an SQLDATALINK
value from the stream and returns it as ajava.net.URL
object in the Java programming language.boolean
wasNull()
Retrieves whether the last value read was SQLNULL
.
-
Method Details
-
readString
Reads the next attribute in the stream and returns it as aString
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readBoolean
Reads the next attribute in the stream and returns it as aboolean
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returnsfalse
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readByte
Reads the next attribute in the stream and returns it as abyte
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returns0
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readShort
Reads the next attribute in the stream and returns it as ashort
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returns0
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readInt
Reads the next attribute in the stream and returns it as anint
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returns0
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readLong
Reads the next attribute in the stream and returns it as along
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returns0
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readFloat
Reads the next attribute in the stream and returns it as afloat
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returns0
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readDouble
Reads the next attribute in the stream and returns it as adouble
in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returns0
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readBigDecimal
Reads the next attribute in the stream and returns it as ajava.math.BigDecimal
object in the Java programming language.- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readBytes
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
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readDate
Reads the next attribute in the stream and returns it as ajava.sql.Date
object.- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readTime
Reads the next attribute in the stream and returns it as ajava.sql.Time
object.- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readTimestamp
Reads the next attribute in the stream and returns it as ajava.sql.Timestamp
object.- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readCharacterStream
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
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readAsciiStream
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
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readBinaryStream
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
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readObject
Reads the datum at the head of the stream and returns it as anObject
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 returnsnull
. 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 methodSQLData.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 SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readRef
Reads an SQLREF
value from the stream and returns it as aRef
object in the Java programming language.- Returns:
- a
Ref
object representing the SQLREF
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readBlob
Reads an SQLBLOB
value from the stream and returns it as aBlob
object in the Java programming language.- Returns:
- a
Blob
object representing data of the SQLBLOB
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readClob
Reads an SQLCLOB
value from the stream and returns it as aClob
object in the Java programming language.- Returns:
- a
Clob
object representing data of the SQLCLOB
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readArray
Reads an SQLARRAY
value from the stream and returns it as anArray
object in the Java programming language.- Returns:
- an
Array
object representing data of the SQLARRAY
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
wasNull
Retrieves whether the last value read was SQLNULL
.- Returns:
true
if the most recently read SQL value was SQLNULL
;false
otherwise- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.2
-
readURL
Reads an SQLDATALINK
value from the stream and returns it as ajava.net.URL
object in the Java programming language.- Returns:
- a
java.net.URL
object. - Throws:
SQLException
- if a database access error occurs, or if a URL is malformedSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.4
-
readNClob
Reads an SQLNCLOB
value from the stream and returns it as aNClob
object in the Java programming language.- Returns:
- a
NClob
object representing data of the SQLNCLOB
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.6
-
readNString
Reads the next attribute in the stream and returns it as aString
in the Java programming language. It is intended for use when accessingNCHAR
,NVARCHAR
andLONGNVARCHAR
columns.- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.6
-
readSQLXML
Reads an SQLXML
value from the stream and returns it as aSQLXML
object in the Java programming language.- Returns:
- a
SQLXML
object representing data of the SQLXML
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.6
-
readRowId
Reads an SQLROWID
value from the stream and returns it as aRowId
object in the Java programming language.- Returns:
- a
RowId
object representing data of the SQLROWID
value at the head of the stream;null
if the value read is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.6
-
readObject
Reads the next attribute in the stream and returns it as anObject
in the Java programming language. The actual type of the object returned is determined by the specified Java data type, 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 attribute at the head of the stream is an SQL
NULL
the method returnsnull
. If the attribute is an SQL structured or distinct type, it determines the SQL type of the attribute 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 methodSQLData.readSQL
on that object, which reads additional data from the stream, using the protocol described for that method.The default implementation will throw
SQLFeatureNotSupportedException
- Type Parameters:
T
- the type of the class modeled by this Class object- Parameters:
type
- Class representing the Java data type to convert the attribute to.- Returns:
- the attribute at the head of the stream as an
Object
in the Java programming language;null
if the attribute is SQLNULL
- Throws:
SQLException
- if a database access error occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.8
-