- All Implemented Interfaces:
- SQLInput
public class SQLInputImpl extends Object implements 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:
- SQLData
- 
Constructor SummaryConstructors Constructor Description SQLInputImpl(Object[] attributes, Map<String,Class<?>> map)Creates anSQLInputImplobject initialized with the given array of attributes and the given type map.
- 
Method SummaryModifier and Type Method Description ArrayreadArray()Reads an SQLARRAYvalue from the stream and returns it as anArrayobject in the Java programming language.InputStreamreadAsciiStream()Returns the next attribute in thisSQLInputImplobject as a stream of ASCII characters.BigDecimalreadBigDecimal()Retrieves the next attribute in thisSQLInputImplobject as ajava.math.BigDecimal.InputStreamreadBinaryStream()Returns the next attribute in thisSQLInputImplobject as a stream of uninterpreted bytes.BlobreadBlob()Retrieves theBLOBvalue at the head of thisSQLInputImplobject as aBlobobject in the Java programming language.booleanreadBoolean()Retrieves 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[]readBytes()Retrieves the next attribute in thisSQLInputImplobject as an array of bytes.ReaderreadCharacterStream()Retrieves the next attribute in thisSQLInputImplobject as a stream of Unicode characters.ClobreadClob()Retrieves theCLOBvalue at the head of thisSQLInputImplobject as aClobobject in the Java programming language.DatereadDate()Retrieves the next attribute in thisSQLInputImplas ajava.sql.Dateobject.doublereadDouble()Retrieves the next attribute in thisSQLInputImplobject as adoublein the Java programming language.floatreadFloat()Retrieves 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.NClobreadNClob()Reads an SQLNCLOBvalue from the stream and returns it as aClobobject in the Java programming language.StringreadNString()Reads the next attribute in the stream and returns it as aStringin the Java programming language.ObjectreadObject()Retrieves the value at the head of thisSQLInputImplobject as anObjectin the Java programming language.RefreadRef()Retrieves the value at the head of thisSQLInputImplobject 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()Retrieves the next attribute in thisSQLInputImplobject as ashortin the Java programming language.SQLXMLreadSQLXML()Reads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.StringreadString()Retrieves the next attribute in thisSQLInputImplobject as aStringin the Java programming language.TimereadTime()Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timeobject.TimestampreadTimestamp()Retrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timestampobject.URLreadURL()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.
- 
Constructor Details- 
SQLInputImplCreates 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 of- Objectinstances 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- a- java.util.Mapobject containing zero or more entries, with each entry consisting of 1) a- Stringgiving the fully qualified name of the UDT and 2) the- Classobject for the- SQLDataimplementation that defines how the UDT is to be mapped
- Throws:
- SQLException- if the- attributesor the- mapis a- nullvalue
 
 
- 
- 
Method Details- 
readStringRetrieves 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 interface- SQLInput
- 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.
 
- 
readBooleanRetrieves 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 interface- SQLInput
- 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.
 
- 
readByteRetrieves 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 interface- SQLInput
- 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
 
- 
readShortRetrieves 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 interface- SQLInput
- 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
 
- 
readIntRetrieves 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 interface- SQLInput
- 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
 
- 
readLongRetrieves 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 interface- SQLInput
- 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
 
- 
readFloatRetrieves 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 interface- SQLInput
- 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
 
- 
readDoubleRetrieves 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 interface- SQLInput
- 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
 
- 
readBigDecimalRetrieves 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 interface- SQLInput
- 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
 
- 
readBytesRetrieves 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 interface- SQLInput
- 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
 
- 
readDateRetrieves 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 interface- SQLInput
- 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
 
- 
readTimeRetrieves 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 interface- SQLInput
- 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.
 
- 
readTimestampRetrieves the next attribute in thisSQLInputImplobject as ajava.sql.Timestampobject.- Specified by:
- readTimestampin interface- SQLInput
- 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.
 
- 
readCharacterStreamRetrieves 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 interface- SQLInput
- 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.
 
- 
readAsciiStreamReturns 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 interface- SQLInput
- 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.
 
- 
readBinaryStreamReturns 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 interface- SQLInput
- 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.
 
- 
readObjectRetrieves 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 interface- SQLInput
- 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.
 
- 
readRefRetrieves the value at the head of thisSQLInputImplobject as aRefobject in the Java programming language.- Specified by:
- readRefin interface- SQLInput
- 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.
 
- 
readBlobRetrieves 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 interface- SQLInput
- 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.
 
- 
readClobRetrieves 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 interface- SQLInput
- 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.
 
- 
readArrayReads 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 interface- SQLInput
- 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.
 
- 
wasNullAscertains whether the last value read from thisSQLInputImplobject wasnull.- Specified by:
- wasNullin interface- SQLInput
- Returns:
- trueif the SQL value read most recently was- null; otherwise,- false; by default it will return false
- Throws:
- SQLException- if an error occurs determining the last value read was a- nullvalue or not;
 
- 
readURLReads 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 interface- SQLInput
- 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.
 
- 
readNClobReads an SQLNCLOBvalue from the stream and returns it as aClobobject in the Java programming language.- Specified by:
- readNClobin interface- SQLInput
- 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
 
- 
readNStringReads 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 interface- SQLInput
- Returns:
- the attribute; if the value is SQL NULL, returnsnull
- Throws:
- SQLException- if a database access error occurs
- Since:
- 1.6
 
- 
readSQLXMLReads an SQLXMLvalue from the stream and returns it as aSQLXMLobject in the Java programming language.- Specified by:
- readSQLXMLin interface- SQLInput
- 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
 
- 
readRowIdReads an SQLROWIDvalue from the stream and returns it as aRowIdobject in the Java programming language.- Specified by:
- readRowIdin interface- SQLInput
- 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
 
 
-