-
- All Known Implementing Classes:
SQLInputImpl
public interface SQLInputAn 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 invokesSQLInputmethods. The reader methods (readLong,readBytes, and so on) provide a way for an implementation of theSQLDatainterface to read the values in anSQLInputobject. And as described inSQLData, calls to reader methods must be made in the order that their corresponding attributes appear in the SQL definition of the type. The methodwasNullis used to determine whether the last value read was SQLNULL.When the method
getObjectis called with an object of a class implementing the interfaceSQLData, the JDBC driver calls the methodSQLData.getSQLTypeto determine the SQL type of the user-defined type (UDT) being custom mapped. The driver creates an instance ofSQLInput, populating it with the attributes of the UDT. The driver then passes the input stream to the methodSQLData.readSQL, which in turn calls theSQLInputreader methods in its implementation for reading the attributes from the input stream.- Since:
- 1.2
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description ArrayreadArray()Reads an SQLARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.InputStreamreadAsciiStream()Reads the next attribute in the stream and returns it as a stream of ASCII characters.BigDecimalreadBigDecimal()Reads the next attribute in the stream and returns it as ajava.math.BigDecimalobject in the Java programming language.InputStreamreadBinaryStream()Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.BlobreadBlob()Reads an SQLBLOBvalue from the stream and returns it as aBlobobject in the Java programming language.booleanreadBoolean()Reads the next attribute in the stream and returns it as abooleanin the Java programming language.bytereadByte()Reads the next attribute in the stream and returns it as abytein the Java programming language.byte[]readBytes()Reads the next attribute in the stream and returns it as an array of bytes in the Java programming language.ReaderreadCharacterStream()Reads the next attribute in the stream and returns it as a stream of Unicode characters.ClobreadClob()Reads an SQLCLOBvalue from the stream and returns it as aClobobject in the Java programming language.DatereadDate()Reads the next attribute in the stream and returns it as ajava.sql.Dateobject.doublereadDouble()Reads the next attribute in the stream and returns it as adoublein the Java programming language.floatreadFloat()Reads the next attribute in the stream and returns it as afloatin the Java programming language.intreadInt()Reads the next attribute in the stream and returns it as anintin the Java programming language.longreadLong()Reads the next attribute in the stream and returns it as alongin the Java programming language.NClobreadNClob()Reads an SQLNCLOBvalue from the stream and returns it as aNClobobject in the Java programming language.StringreadNString()Reads the next attribute in the stream and returns it as aStringin the Java programming language.ObjectreadObject()Reads the datum at the head of the stream and returns it as anObjectin the Java programming language.default <T> TreadObject(Class<T> type)Reads the next attribute in the stream and returns it as anObjectin the Java programming language.RefreadRef()Reads an SQLREFvalue from the stream and returns it as aRefobject in the Java programming language.RowIdreadRowId()Reads an SQLROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.shortreadShort()Reads the next attribute in the stream and returns it as ashortin the Java programming language.SQLXMLreadSQLXML()Reads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.StringreadString()Reads the next attribute in the stream and returns it as aStringin the Java programming language.TimereadTime()Reads the next attribute in the stream and returns it as ajava.sql.Timeobject.TimestampreadTimestamp()Reads the next attribute in the stream and returns it as ajava.sql.Timestampobject.URLreadURL()Reads an SQLDATALINKvalue from the stream and returns it as ajava.net.URLobject in the Java programming language.booleanwasNull()Retrieves whether the last value read was SQLNULL.
-
-
-
Method Detail
-
readString
String readString() throws SQLException
Reads the next attribute in the stream and returns it as aStringin 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
boolean readBoolean() throws SQLExceptionReads the next attribute in the stream and returns it as abooleanin 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
byte readByte() throws SQLExceptionReads the next attribute in the stream and returns it as abytein 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
short readShort() throws SQLExceptionReads the next attribute in the stream and returns it as ashortin 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
int readInt() throws SQLExceptionReads the next attribute in the stream and returns it as anintin 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
long readLong() throws SQLExceptionReads the next attribute in the stream and returns it as alongin 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
float readFloat() throws SQLExceptionReads the next attribute in the stream and returns it as afloatin 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
double readDouble() throws SQLExceptionReads the next attribute in the stream and returns it as adoublein 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
BigDecimal readBigDecimal() throws SQLException
Reads the next attribute in the stream and returns it as ajava.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
byte[] readBytes() throws SQLExceptionReads 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
Date readDate() throws SQLException
Reads the next attribute in the stream and returns it as ajava.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
Time readTime() throws SQLException
Reads the next attribute in the stream and returns it as ajava.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
Timestamp readTimestamp() throws SQLException
Reads the next attribute in the stream and returns it as ajava.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
Reader readCharacterStream() throws SQLException
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
InputStream readAsciiStream() throws SQLException
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
InputStream readBinaryStream() throws SQLException
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
Object readObject() throws SQLException
Reads the datum at the head of the stream and returns it as anObjectin 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
Ref readRef() throws SQLException
Reads an SQLREFvalue 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
Blob readBlob() throws SQLException
Reads an SQLBLOBvalue 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
Clob readClob() throws SQLException
Reads an SQLCLOBvalue 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
Array readArray() throws SQLException
Reads an SQLARRAYvalue 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
boolean wasNull() throws SQLExceptionRetrieves whether the last value read was SQLNULL.- 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
URL readURL() throws SQLException
Reads an SQLDATALINKvalue 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
NClob readNClob() throws SQLException
Reads an SQLNCLOBvalue 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
String readNString() throws SQLException
Reads the next attribute in the stream and returns it as aStringin 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
SQLXML readSQLXML() throws SQLException
Reads an SQLXMLvalue 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
RowId readRowId() throws SQLException
Reads an SQLROWIDvalue 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
default <T> T readObject(Class<T> type) throws SQLException
Reads the next attribute in the stream and returns it as anObjectin 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
-
-