SQLInput (Java SE 13 & JDK 13 )
- All Known Implementing Classes:
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 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 Details
-
readString
Reads the next attribute in the stream and returns it as a
Stringin 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 a
booleanin 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 a
bytein 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 a
shortin 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 an
intin 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 a
longin 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 a
floatin 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 a
doublein 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 a
java.math.BigDecimalobject 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 a
java.sql.Dateobject.- 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 a
java.sql.Timeobject.- 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 a
java.sql.Timestampobject.- 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 an
Objectin 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.readSQLon 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
Objectin the Java programming language;nullif 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 SQL
REFvalue from the stream and returns it as aRefobject in the Java programming language.- Returns:
- a
Refobject representing the SQLREFvalue at the head of the stream;nullif 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 SQL
BLOBvalue from the stream and returns it as aBlobobject in the Java programming language.- Returns:
- a
Blobobject representing data of the SQLBLOBvalue at the head of the stream;nullif 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 SQL
CLOBvalue from the stream and returns it as aClobobject in the Java programming language.- Returns:
- a
Clobobject representing data of the SQLCLOBvalue at the head of the stream;nullif 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 SQL
ARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.- Returns:
- an
Arrayobject representing data of the SQLARRAYvalue at the head of the stream;nullif 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 SQL
NULL.- Returns:
trueif the most recently read SQL value was SQLNULL;falseotherwise- Throws:
SQLException- if a database access error occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.2
-
readURL
Reads an SQL
DATALINKvalue from the stream and returns it as ajava.net.URLobject in the Java programming language.- Returns:
- a
java.net.URLobject. - 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 SQL
NCLOBvalue from the stream and returns it as aNClobobject in the Java programming language.- Returns:
- a
NClobobject representing data of the SQLNCLOBvalue at the head of the stream;nullif 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 a
Stringin the Java programming language. It is intended for use when accessingNCHAR,NVARCHARandLONGNVARCHARcolumns.- 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 SQL
XMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.- Returns:
- a
SQLXMLobject representing data of the SQLXMLvalue at the head of the stream;nullif 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 SQL
ROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.- Returns:
- a
RowIdobject representing data of the SQLROWIDvalue at the head of the stream;nullif 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 an
Objectin 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
NULLthe 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.readSQLon 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
Objectin the Java programming language;nullif the attribute is SQLNULL - Throws:
SQLException- if a database access error occursSQLFeatureNotSupportedException- if the JDBC driver does not support this method- Since:
- 1.8
-