-
- All Known Implementing Classes:
- SQLInputImpl
public interface SQLInput
An 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 invokesSQLInput
methods. The reader methods (readLong
,readBytes
, and so on) provide a way for an implementation of theSQLData
interface to read the values in anSQLInput
object. 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 methodwasNull
is used to determine whether 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 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 theSQLInput
reader methods in its implementation for reading the attributes from the input stream.- Since:
- 1.2
-
-
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()
Reads the next attribute in the stream and returns it as a stream of ASCII characters.BigDecimal
readBigDecimal()
Reads the next attribute in the stream and returns it as ajava.math.BigDecimal
object in the Java programming language.InputStream
readBinaryStream()
Reads the next attribute in the stream and returns it as a stream of uninterpreted bytes.Blob
readBlob()
Reads an SQLBLOB
value from the stream and returns it as aBlob
object in the Java programming language.boolean
readBoolean()
Reads the next attribute in the stream and returns it as aboolean
in the Java programming language.byte
readByte()
Reads the next attribute in the stream and returns it as abyte
in 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.Reader
readCharacterStream()
Reads the next attribute in the stream and returns it as a stream of Unicode characters.Clob
readClob()
Reads an SQLCLOB
value from the stream and returns it as aClob
object in the Java programming language.Date
readDate()
Reads the next attribute in the stream and returns it as ajava.sql.Date
object.double
readDouble()
Reads the next attribute in the stream and returns it as adouble
in the Java programming language.float
readFloat()
Reads the next attribute in the stream and returns it as afloat
in the Java programming language.int
readInt()
Reads the next attribute in the stream and returns it as anint
in the Java programming language.long
readLong()
Reads the next attribute in the stream and returns it as along
in the Java programming language.NClob
readNClob()
Reads an SQLNCLOB
value from the stream and returns it as aNClob
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()
Reads the datum at the head of the stream and returns it as anObject
in the Java programming language.Ref
readRef()
Reads an SQLREF
value from the stream and returns it 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()
Reads the next attribute in the stream and returns it 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()
Reads the next attribute in the stream and returns it as aString
in the Java programming language.Time
readTime()
Reads the next attribute in the stream and returns it as ajava.sql.Time
object.Timestamp
readTimestamp()
Reads the next attribute in the stream and returns it as ajava.sql.Timestamp
object.URL
readURL()
Reads an SQLDATALINK
value from the stream and returns it as ajava.net.URL
object in the Java programming language.boolean
wasNull()
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 aString
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
-
readBoolean
boolean readBoolean() throws SQLException
Reads the next attribute in the stream and returns it as aboolean
in 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 SQLException
Reads the next attribute in the stream and returns it as abyte
in 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 SQLException
Reads the next attribute in the stream and returns it as ashort
in 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 SQLException
Reads the next attribute in the stream and returns it as anint
in 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 SQLException
Reads the next attribute in the stream and returns it as along
in 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 SQLException
Reads the next attribute in the stream and returns it as afloat
in 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 SQLException
Reads the next attribute in the stream and returns it as adouble
in 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.BigDecimal
object 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 SQLException
Reads 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.Date
object.- 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.Time
object.- 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.Timestamp
object.- 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 anObject
in 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.readSQL
on 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
Object
in the Java programming language;null
if 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 SQLREF
value from the stream and returns it as aRef
object in the Java programming language.- Returns:
- a
Ref
object representing the SQLREF
value at the head of the stream;null
if 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 SQLBLOB
value from the stream and returns it as aBlob
object in the Java programming language.- Returns:
- a
Blob
object representing data of the SQLBLOB
value at the head of the stream;null
if 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 SQLCLOB
value from the stream and returns it as aClob
object in the Java programming language.- Returns:
- a
Clob
object representing data of the SQLCLOB
value at the head of the stream;null
if 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 SQLARRAY
value from the stream and returns it as anArray
object in the Java programming language.- Returns:
- an
Array
object representing data of the SQLARRAY
value at the head of the stream;null
if 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 SQLException
Retrieves whether the last value read was SQLNULL
.- Returns:
true
if the most recently read SQL value was SQLNULL
;false
otherwise- 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 SQLDATALINK
value from the stream and returns it as ajava.net.URL
object in the Java programming language.- Returns:
- a
java.net.URL
object. - 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 SQLNCLOB
value from the stream and returns it as aNClob
object in the Java programming language.- 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 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 aString
in the Java programming language. It is intended for use when accessingNCHAR
,NVARCHAR
andLONGNVARCHAR
columns.- 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 SQLXML
value from the stream and returns it as aSQLXML
object in the Java programming language.- 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 occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.6
-
readRowId
RowId readRowId() throws SQLException
Reads an SQLROWID
value from the stream and returns it as aRowId
object in the Java programming language.- 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 occursSQLFeatureNotSupportedException
- if the JDBC driver does not support this method- Since:
- 1.6
-
-
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-java/sql/SQLInput.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.