- 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). AnSQLInputImplobject 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
getObjectis called on an SQL structured or distinct type that has a custom mapping; a programmer never invokesSQLInputImplmethods directly. They are provided here as a convenience for those who writeRowSetimplementations.The
SQLInputImplclass provides a set of reader methods analogous to theResultSetgetter methods. These methods make it possible to read the values in anSQLInputImplobject.The method
wasNullis used to determine whether the 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 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 theSQLInputImplreader 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 anSQLInputImplobject initialized with the given array of attributes and the given type map.
-
Method Summary
Methods Modifier and Type Method and 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 Detail
-
SQLInputImpl
public SQLInputImpl(Object[] attributes, Map<String,Class<?>> map) throws SQLException
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 Detail
-
readString
public String readString() throws SQLException
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
public boolean readBoolean() throws SQLExceptionRetrieves 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
public byte readByte() throws SQLExceptionRetrieves 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
public short readShort() throws SQLExceptionRetrieves 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
public int readInt() throws SQLExceptionRetrieves 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
public long readLong() throws SQLExceptionRetrieves 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
public float readFloat() throws SQLExceptionRetrieves 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
public double readDouble() throws SQLExceptionRetrieves 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
public BigDecimal readBigDecimal() throws SQLException
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
public byte[] readBytes() throws SQLExceptionRetrieves 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
public Date readDate() throws SQLException
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
public Time readTime() throws SQLException
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
public Timestamp readTimestamp() throws SQLException
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
public Reader readCharacterStream() throws SQLException
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
public InputStream readAsciiStream() throws SQLException
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
public InputStream readBinaryStream() throws SQLException
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
public Object readObject() throws SQLException
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
public Ref readRef() throws SQLException
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
public Blob readBlob() throws SQLException
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
public Clob readClob() throws SQLException
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
public Array readArray() throws SQLException
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
public boolean wasNull() throws SQLExceptionAscertains 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
public URL readURL() throws SQLException
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
public NClob readNClob() throws SQLException
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
-
readNString
public 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.- Specified by:
readNStringin 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 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
-
readRowId
public RowId readRowId() throws SQLException
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
-
-
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 dieser 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.