- All Implemented Interfaces:
SQLInput
SQLInputImpl object is an input stream that contains a
stream of values that are the attributes of a UDT.
This class is used by the driver behind the scenes when the method
getObject is called on an SQL structured or distinct type
that has a custom mapping; a programmer never invokes
SQLInputImpl methods directly. They are provided here as a
convenience for those who write RowSet implementations.
The SQLInputImpl class provides a set of
reader methods analogous to the ResultSet getter
methods. These methods make it possible to read the values in an
SQLInputImpl object.
The method wasNull is used to determine whether the
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 UDT being custom mapped. The driver
creates an instance of SQLInputImpl, 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 SQLInputImpl reader methods
to read the attributes from the input stream.
- Since:
- 1.5
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionSQLInputImpl(Object[] attributes, Map<String, Class<?>> map) Creates anSQLInputImplobject initialized with the given array of attributes and the given type map. -
Method Summary
Modifier and TypeMethodDescriptionReads an SQLARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.Returns the next attribute in thisSQLInputImplobject as a stream of ASCII characters.Retrieves the next attribute in thisSQLInputImplobject as ajava.math.BigDecimal.Returns the next attribute in thisSQLInputImplobject as a stream of uninterpreted bytes.readBlob()Retrieves theBLOBvalue at the head of thisSQLInputImplobject as aBlobobject in the Java programming language.booleanRetrieves the next attribute in thisSQLInputImplobject as abooleanin the Java programming language.bytereadByte()Retrieves the next attribute in thisSQLInputImplobject as abytein the Java programming language.byte[]Retrieves the next attribute in thisSQLInputImplobject as an array of bytes.Retrieves the next attribute in thisSQLInputImplobject as a stream of Unicode characters.readClob()Retrieves theCLOBvalue at the head of thisSQLInputImplobject as aClobobject in the Java programming language.readDate()Retrieves the next attribute in thisSQLInputImplas ajava.sql.Dateobject.doubleRetrieves the next attribute in thisSQLInputImplobject as adoublein the Java programming language.floatRetrieves the next attribute in thisSQLInputImplobject as afloatin the Java programming language.intreadInt()Retrieves the next attribute in thisSQLInputImplobject as anintin the Java programming language.longreadLong()Retrieves the next attribute in thisSQLInputImplobject as alongin the Java programming language.Reads an SQLNCLOBvalue from the stream and returns it as aClobobject in the Java programming language.Reads the next attribute in the stream and returns it as aStringin the Java programming language.Retrieves the value at the head of thisSQLInputImplobject as anObjectin the Java programming language.readRef()Retrieves the value at the head of thisSQLInputImplobject as aRefobject in the Java programming language.Reads an SQLROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.shortRetrieves the next attribute in thisSQLInputImplobject as ashortin the Java programming language.Reads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.Retrieves the next attribute in thisSQLInputImplobject as aStringin the Java programming language.readTime()Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timeobject.Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timestampobject.readURL()Reads an SQLDATALINKvalue from the stream and returns it as anURLobject in the Java programming language.booleanwasNull()Ascertains whether the last value read from thisSQLInputImplobject wasnull.Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods declared in interface java.sql.SQLInput
readObject
-
Constructor Details
-
SQLInputImpl
Creates anSQLInputImplobject initialized with the given array of attributes and the given type map. If any of the attributes is a UDT whose name is in an entry in the type map, the attribute will be mapped according to the correspondingSQLDataimplementation.- Parameters:
attributes- an array ofObjectinstances in which each element is an attribute of a UDT. The order of the attributes in the array is the same order in which the attributes were defined in the UDT definition.map- ajava.util.Mapobject containing zero or more entries, with each entry consisting of 1) aStringgiving the fully qualified name of the UDT and 2) theClassobject for theSQLDataimplementation that defines how the UDT is to be mapped- Throws:
SQLException- if theattributesor themapis anullvalue
-
-
Method Details
-
readString
Retrieves the next attribute in thisSQLInputImplobject as aStringin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readStringin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no further values in the stream.
-
readBoolean
Retrieves the next attribute in thisSQLInputImplobject as abooleanin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readBooleanin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no further values in the stream.
-
readByte
Retrieves the next attribute in thisSQLInputImplobject as abytein the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readBytein interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no further values in the stream
-
readShort
Retrieves the next attribute in thisSQLInputImplobject as ashortin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readShortin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readInt
Retrieves the next attribute in thisSQLInputImplobject as anintin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readIntin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readLong
Retrieves the next attribute in thisSQLInputImplobject as alongin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readLongin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readFloat
Retrieves the next attribute in thisSQLInputImplobject as afloatin the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readFloatin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readDouble
Retrieves the next attribute in thisSQLInputImplobject as adoublein the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readDoublein interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readBigDecimal
Retrieves the next attribute in thisSQLInputImplobject as ajava.math.BigDecimal.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readBigDecimalin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readBytes
Retrieves the next attribute in thisSQLInputImplobject as an array of bytes.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readBytesin interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readDate
Retrieves the next attribute in thisSQLInputImplas ajava.sql.Dateobject.This method does not perform type-safe checking to determine if the returned type is the expected type; this responsibility is delegated to the UDT mapping as defined by a
SQLDataimplementation.- Specified by:
readDatein interfaceSQLInput- Returns:
- the next attribute in this
SQLInputImplobject; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position or if there are no more values in the stream
-
readTime
Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timeobject.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readTimein interfaceSQLInput- Returns:
- the attribute; if the value is
SQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readTimestamp
Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timestampobject.- Specified by:
readTimestampin interfaceSQLInput- Returns:
- the attribute; if the value is
SQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readCharacterStream
Retrieves the next attribute in thisSQLInputImplobject as a stream of Unicode characters.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readCharacterStreamin interfaceSQLInput- Returns:
- the attribute; if the value is
SQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readAsciiStream
Returns the next attribute in thisSQLInputImplobject as a stream of ASCII characters.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readAsciiStreamin interfaceSQLInput- Returns:
- the attribute; if the value is
SQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readBinaryStream
Returns the next attribute in thisSQLInputImplobject as a stream of uninterpreted bytes.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readBinaryStreamin interfaceSQLInput- Returns:
- the attribute; if the value is
SQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readObject
Retrieves the value at the head of thisSQLInputImplobject as anObjectin the Java programming language. The actual type of the object returned is determined by the default mapping of SQL types to types in the Java programming language unless there is a custom mapping, in which case the type of the object returned is determined by this stream's type map.The JDBC technology-enabled driver registers a type map with the stream before passing the stream to the application.
When the datum at the head of the stream is an SQL
NULL, this method returnsnull. If the datum is an SQL structured or distinct type with a custom mapping, this method determines the SQL type of the datum at the head of the stream, constructs an object of the appropriate class, and calls the methodSQLData.readSQLon that object. ThereadSQLmethod then calls the appropriateSQLInputImpl.readXXXmethods to retrieve the attribute values from the stream.- Specified by:
readObjectin interfaceSQLInput- Returns:
- the value at the head of the stream as an
Objectin the Java programming language;nullif the value is SQLNULL - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readRef
Retrieves the value at the head of thisSQLInputImplobject as aRefobject in the Java programming language.- Specified by:
readRefin interfaceSQLInput- Returns:
- a
Refobject representing the SQLREFvalue at the head of the stream; if the value isSQL NULLreturnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readBlob
Retrieves theBLOBvalue at the head of thisSQLInputImplobject as aBlobobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readBlobin interfaceSQLInput- Returns:
- a
Blobobject representing the SQLBLOBvalue at the head of this stream; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readClob
Retrieves theCLOBvalue at the head of thisSQLInputImplobject as aClobobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readClobin interfaceSQLInput- Returns:
- a
Clobobject representing the SQLCLOBvalue at the head of the stream; if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readArray
Reads an SQLARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readArrayin interfaceSQLInput- Returns:
- an
Arrayobject representing the SQLARRAYvalue at the head of the stream; * if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
wasNull
Ascertains whether the last value read from thisSQLInputImplobject wasnull.- Specified by:
wasNullin interfaceSQLInput- Returns:
trueif the SQL value read most recently wasnull; otherwise,false; by default it will return false- Throws:
SQLException- if an error occurs determining the last value read was anullvalue or not;
-
readURL
Reads an SQLDATALINKvalue from the stream and returns it as anURLobject in the Java programming language.This method does not perform type-safe checking to determine if the returned type is the expected type as this responsibility is delegated to the UDT mapping as implemented by a
SQLDataimplementation.- Specified by:
readURLin interfaceSQLInput- Returns:
- an
URLobject representing the SQLDATALINKvalue at the head of the stream; * if the value isSQL NULL, returnnull - Throws:
SQLException- if the read position is located at an invalid position; or if there are no further values in the stream.
-
readNClob
Reads an SQLNCLOBvalue from the stream and returns it as aClobobject in the Java programming language.- Specified by:
readNClobin interfaceSQLInput- 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 occurs- Since:
- 1.6
-
readNString
Reads the next attribute in the stream and returns it as aStringin the Java programming language. It is intended for use when accessingNCHAR,NVARCHARandLONGNVARCHARcolumns.- Specified by:
readNStringin interfaceSQLInput- Returns:
- the attribute; if the value is SQL
NULL, returnsnull - Throws:
SQLException- if a database access error occurs- Since:
- 1.6
-
readSQLXML
Reads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.- Specified by:
readSQLXMLin interfaceSQLInput- 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 occurs- Since:
- 1.6
-
readRowId
Reads an SQLROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.- Specified by:
readRowIdin interfaceSQLInput- 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 occurs- Since:
- 1.6
-