- java.lang.Object
-
- javax.sql.rowset.serial.SQLInputImpl
-
- All Implemented Interfaces:
- SQLInput
public class SQLInputImpl extends Object implements SQLInput
An input stream used for custom mapping user-defined types (UDTs). AnSQLInputImpl
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 invokesSQLInputImpl
methods directly. They are provided here as a convenience for those who writeRowSet
implementations.The
SQLInputImpl
class provides a set of reader methods analogous to theResultSet
getter methods. These methods make it possible to read the values in anSQLInputImpl
object.The method
wasNull
is used to determine whether the the last value read was SQLNULL
.When the method
getObject
is called with an object of a class implementing the interfaceSQLData
, the JDBC driver calls the methodSQLData.getSQLType
to determine the SQL type of the UDT being custom mapped. The driver creates an instance ofSQLInputImpl
, populating it with the attributes of the UDT. The driver then passes the input stream to the methodSQLData.readSQL
, which in turn calls theSQLInputImpl
reader methods to read the attributes from the input stream.- See Also:
SQLData
-
-
Constructor Summary
Constructors Constructor and Description SQLInputImpl(Object[] attributes, Map<String,Class<?>> map)
Creates anSQLInputImpl
object initialized with the given array of attributes and the given type map.
-
Method Summary
Methods Modifier and Type Method and Description Array
readArray()
Reads an SQLARRAY
value from the stream and returns it as anArray
object in the Java programming language.InputStream
readAsciiStream()
Returns the next attribute in thisSQLInputImpl
object as a stream of ASCII characters.BigDecimal
readBigDecimal()
Retrieves the next attribute in thisSQLInputImpl
object as ajava.math.BigDecimal
.InputStream
readBinaryStream()
Returns the next attribute in thisSQLInputImpl
object as a stream of uninterpreted bytes.Blob
readBlob()
Retrieves theBLOB
value at the head of thisSQLInputImpl
object as aBlob
object in the Java programming language.boolean
readBoolean()
Retrieves the next attribute in thisSQLInputImpl
object as aboolean
in the Java programming language.byte
readByte()
Retrieves the next attribute in thisSQLInputImpl
object as abyte
in the Java programming language.byte[]
readBytes()
Retrieves the next attribute in thisSQLInputImpl
object as an array of bytes.Reader
readCharacterStream()
Retrieves the next attribute in thisSQLInputImpl
object as a stream of Unicode characters.Clob
readClob()
Retrieves theCLOB
value at the head of thisSQLInputImpl
object as aClob
object in the Java programming language.Date
readDate()
Retrieves the next attribute in thisSQLInputImpl
as ajava.sql.Date
object.double
readDouble()
Retrieves the next attribute in thisSQLInputImpl
object as adouble
in the Java programming language.float
readFloat()
Retrieves the next attribute in thisSQLInputImpl
object as afloat
in the Java programming language.int
readInt()
Retrieves the next attribute in thisSQLInputImpl
object as anint
in the Java programming language.long
readLong()
Retrieves the next attribute in thisSQLInputImpl
object as along
in the Java programming language.NClob
readNClob()
Reads an SQLNCLOB
value from the stream and returns it as aClob
object in the Java programming language.String
readNString()
Reads the next attribute in the stream and returns it as aString
in the Java programming language.Object
readObject()
Retrieves the value at the head of thisSQLInputImpl
object as anObject
in the Java programming language.Ref
readRef()
Retrieves the value at the head of thisSQLInputImpl
object as aRef
object in the Java programming language.RowId
readRowId()
Reads an SQLROWID
value from the stream and returns it as aRowId
object in the Java programming language.short
readShort()
Retrieves the next attribute in thisSQLInputImpl
object as ashort
in the Java programming language.SQLXML
readSQLXML()
Reads an SQLXML
value from the stream and returns it as aSQLXML
object in the Java programming language.String
readString()
Retrieves the next attribute in thisSQLInputImpl
object as aString
in the Java programming language.Time
readTime()
Retrieves the next attribute in thisSQLInputImpl
object as ajava.sql.Time
object.Timestamp
readTimestamp()
Retrieves the next attribute in thisSQLInputImpl
object as ajava.sql.Timestamp
object.URL
readURL()
Reads an SQLDATALINK
value from the stream and returns it as anURL
object in the Java programming language.boolean
wasNull()
Ascertains whether the last value read from thisSQLInputImpl
object wasnull
.
-
-
-
Constructor Detail
-
SQLInputImpl
public SQLInputImpl(Object[] attributes, Map<String,Class<?>> map) throws SQLException
Creates anSQLInputImpl
object 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 correspondingSQLData
implementation.- Parameters:
attributes
- an array ofObject
instances 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.Map
object containing zero or more entries, with each entry consisting of 1) aString
giving the fully qualified name of the UDT and 2) theClass
object for theSQLData
implementation that defines how the UDT is to be mapped- Throws:
SQLException
- if theattributes
or themap
is anull
value
-
-
Method Detail
-
readString
public String readString() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as aString
in 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
SQLData
implementation.- Specified by:
readString
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public boolean readBoolean() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as aboolean
in 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
SQLData
implementation.- Specified by:
readBoolean
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public byte readByte() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as abyte
in 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
SQLData
implementation.- Specified by:
readByte
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public short readShort() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as ashort
in 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
SQLData
implementation.- Specified by:
readShort
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public int readInt() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as anint
in 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
SQLData
implementation.- Specified by:
readInt
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public long readLong() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as along
in 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
SQLData
implementation.- Specified by:
readLong
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public float readFloat() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as afloat
in 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
SQLData
implementation.- Specified by:
readFloat
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public double readDouble() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as adouble
in 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
SQLData
implementation.- Specified by:
readDouble
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public BigDecimal readBigDecimal() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object 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
SQLData
implementation.- Specified by:
readBigDecimal
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public byte[] readBytes() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object 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
SQLData
implementation.- Specified by:
readBytes
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public Date readDate() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
as ajava.sql.Date
object.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
SQLData
implementation.- Specified by:
readDate
in interfaceSQLInput
- Returns:
- the next attribute in this
SQLInputImpl
object; 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
public Time readTime() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as ajava.sql.Time
object.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
SQLData
implementation.- Specified by:
readTime
in 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
public Timestamp readTimestamp() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object as ajava.sql.Timestamp
object.- Specified by:
readTimestamp
in 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
public Reader readCharacterStream() throws SQLException
Retrieves the next attribute in thisSQLInputImpl
object 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
SQLData
implementation.- Specified by:
readCharacterStream
in 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
public InputStream readAsciiStream() throws SQLException
Returns the next attribute in thisSQLInputImpl
object 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
SQLData
implementation.- Specified by:
readAsciiStream
in 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
public InputStream readBinaryStream() throws SQLException
Returns the next attribute in thisSQLInputImpl
object 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
SQLData
implementation.- Specified by:
readBinaryStream
in 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
public Object readObject() throws SQLException
Retrieves the value at the head of thisSQLInputImpl
object as anObject
in 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.readSQL
on that object. ThereadSQL
method then calls the appropriateSQLInputImpl.readXXX
methods to retrieve the attribute values from the stream.- Specified by:
readObject
in interfaceSQLInput
- Returns:
- the value at the head of the stream as an
Object
in the Java programming language;null
if 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
public Ref readRef() throws SQLException
Retrieves the value at the head of thisSQLInputImpl
object as aRef
object in the Java programming language.- Specified by:
readRef
in interfaceSQLInput
- Returns:
- a
Ref
object representing the SQLREF
value 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.
-
readBlob
public Blob readBlob() throws SQLException
Retrieves theBLOB
value at the head of thisSQLInputImpl
object as aBlob
object 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
SQLData
implementation.- Specified by:
readBlob
in interfaceSQLInput
- Returns:
- a
Blob
object representing the SQLBLOB
value 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
public Clob readClob() throws SQLException
Retrieves theCLOB
value at the head of thisSQLInputImpl
object as aClob
object 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
SQLData
implementation.- Specified by:
readClob
in interfaceSQLInput
- Returns:
- a
Clob
object representing the SQLCLOB
value 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
public Array readArray() throws SQLException
Reads an SQLARRAY
value from the stream and returns it as anArray
object 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
SQLData
implementation.- Specified by:
readArray
in interfaceSQLInput
- Returns:
- an
Array
object representing the SQLARRAY
value 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
public boolean wasNull() throws SQLException
Ascertains whether the last value read from thisSQLInputImpl
object wasnull
.- Specified by:
wasNull
in interfaceSQLInput
- Returns:
true
if 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 anull
value or not;
-
readURL
public URL readURL() throws SQLException
Reads an SQLDATALINK
value from the stream and returns it as anURL
object 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
SQLData
implementation.- Specified by:
readURL
in interfaceSQLInput
- Returns:
- an
URL
object representing the SQLDATALINK
value 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
public NClob readNClob() throws SQLException
Reads an SQLNCLOB
value from the stream and returns it as aClob
object in the Java programming language.- Specified by:
readNClob
in interfaceSQLInput
- 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 occurs
-
readNString
public String readNString() throws SQLException
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.- Specified by:
readNString
in interfaceSQLInput
- Returns:
- the attribute; if the value is SQL
NULL
, returnsnull
- Throws:
SQLException
- if a database access error occurs
-
readSQLXML
public SQLXML readSQLXML() throws SQLException
Reads an SQLXML
value from the stream and returns it as aSQLXML
object in the Java programming language.- Specified by:
readSQLXML
in interfaceSQLInput
- 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 occurs
-
readRowId
public RowId readRowId() throws SQLException
Reads an SQLROWID
value from the stream and returns it as aRowId
object in the Java programming language.- Specified by:
readRowId
in interfaceSQLInput
- 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 occurs
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 04/03/2020
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-rf-javax/sql/rowset/serial/SQLInputImpl.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor Diese Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.