|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object![]()
![]()
![]()
javax.sql.rowset.serial.SQLOutputImpl

public class SQLOutputImpl


The output stream for writing the attributes of a custom-mapped user-defined type (UDT) back to the database. The driver uses this interface internally, and its methods are never directly invoked by an application programmer.
When an application calls the
method PreparedStatement.setObject, the driver
checks to see whether the value to be written is a UDT with
a custom mapping. If it is, there will be an entry in a
type map containing the Class object for the
class that implements SQLData for this UDT.
If the value to be written is an instance of SQLData,
the driver will create an instance of SQLOutputImpl
and pass it to the method SQLData.writeSQL.
The method writeSQL in turn calls the
appropriate SQLOutputImpl.writeXXX methods
to write data from the SQLData object to
the SQLOutputImpl output stream as the
representation of an SQL user-defined type.
| Constructor Summary | |
|---|---|
SQLOutputImpl
Creates a new SQLOutputImpl object
initialized with the given vector of attributes and
type map. |
|
| Method Summary | |
|---|---|
void |
writeArray
Writes an Array object in the Java
programming language to this SQLOutputImpl
object. |
void |
writeAsciiStream
Writes a stream of ASCII characters to this SQLOutputImpl object. |
void |
writeBigDecimal
Writes a java.math.BigDecimal object in the Java programming
language to this SQLOutputImpl object. |
void |
writeBinaryStream
Writes a stream of uninterpreted bytes to this SQLOutputImpl
object. |
void |
writeBlob
Writes a Blob object in the Java programming language
to this SQLOutputImpl object. |
void |
writeBoolean
Writes a boolean in the Java programming language
to this SQLOutputImpl object. |
void |
writeByte
Writes a byte in the Java programming language
to this SQLOutputImpl object. |
void |
writeBytes
Writes an array of bytes in the Java programming language
to this SQLOutputImpl object. |
void |
writeCharacterStream
Writes a stream of Unicode characters to this SQLOutputImpl object. |
void |
writeClob
Writes a Clob object in the Java programming language
to this SQLOutputImpl object. |
void |
writeDate
Writes a java.sql.Date object in the Java programming
language to this SQLOutputImpl object. |
void |
writeDouble
Writes a double in the Java programming language
to this SQLOutputImpl object. |
void |
writeFloat
Writes a float in the Java programming language
to this object. |
void |
writeInt
Writes an int in the Java programming language
to this SQLOutputImpl object. |
void |
writeLong
Writes a long in the Java programming language
to this SQLOutputImpl object. |
void |
writeObject
Writes to the stream the data contained in the given SQLData object. |
void |
writeRef
Writes a Ref object in the Java programming language
to this SQLOutputImpl object. |
void |
writeShort
Writes a short in the Java programming language
to this SQLOutputImpl object. |
void |
writeString
Writes a String in the Java programming language
to this SQLOutputImpl object. |
void |
writeStruct
Writes a Struct object in the Java
programming language to this SQLOutputImpl
object. |
void |
writeTime
Writes a java.sql.Time object in the Java programming
language to this SQLOutputImpl object. |
void |
writeTimestamp
Writes a java.sql.Timestamp object in the Java programming
language to this SQLOutputImpl object. |
void |
writeURL
Writes an java.sql.Type.DATALINK object in the Java
programming language to this SQLOutputImpl object. |
Methods inherited from class java.lang.Object ![]() |
|---|
clone |
| Constructor Detail |
|---|

public SQLOutputImpl(Vector![]()
![]()
<?> attributes, Map
![]()
![]()
<String
![]()
![]()
,?> map) throws SQLException
![]()
![]()
SQLOutputImpl object
initialized with the given vector of attributes and
type map. The driver will use the type map to determine
which SQLData.writeSQL method to invoke.
This method will then call the appropriate
SQLOutputImpl writer methods in order and
thereby write the attributes to the new output stream.
attributes - a Vector object containing the attributes of
the UDT to be mapped to one or more objects in the Java
programming languagemap - a java.util.Map object containing zero or
more entries, with each entry consisting of 1) a String
giving the fully qualified name of a UDT and 2) the
Class object for the SQLData implementation
that defines how the UDT is to be mapped
SQLException

- if the attributes or the map
is a null value| Method Detail |
|---|

public void writeString(String![]()
![]()
x) throws SQLException
![]()
![]()
String in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL CHAR, VARCHAR, or
LONGVARCHAR before returning it to the database.
writeString

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeBoolean(boolean x)
throws SQLException

boolean in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL BIT before returning it to the database.
writeBoolean

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeByte(byte x)
throws SQLException

byte in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL BIT before returning it to the database.
writeByte

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeShort(short x)
throws SQLException

short in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL SMALLINT before returning it to the database.
writeShort

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeInt(int x)
throws SQLException

int in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL INTEGER before returning it to the database.
writeInt

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeLong(long x)
throws SQLException

long in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL BIGINT before returning it to the database.
writeLong

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeFloat(float x)
throws SQLException

float in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL REAL before returning it to the database.
writeFloat

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeDouble(double x)
throws SQLException

double in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL DOUBLE before returning it to the database.
writeDouble

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeBigDecimal(BigDecimal![]()
![]()
x) throws SQLException
![]()
![]()
java.math.BigDecimal object in the Java programming
language to this SQLOutputImpl object. The driver converts
it to an SQL NUMERIC before returning it to the database.
writeBigDecimal

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeBytes(byte[] x)
throws SQLException

bytes in the Java programming language
to this SQLOutputImpl object. The driver converts
it to an SQL VARBINARY or LONGVARBINARY
before returning it to the database.
writeBytes

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeDate(Date![]()
![]()
x) throws SQLException
![]()
![]()
java.sql.Date object in the Java programming
language to this SQLOutputImpl object. The driver converts
it to an SQL DATE before returning it to the database.
writeDate

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeTime(Time![]()
![]()
x) throws SQLException
![]()
![]()
java.sql.Time object in the Java programming
language to this SQLOutputImpl object. The driver converts
it to an SQL TIME before returning it to the database.
writeTime

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeTimestamp(Timestamp![]()
![]()
x) throws SQLException
![]()
![]()
java.sql.Timestamp object in the Java programming
language to this SQLOutputImpl object. The driver converts
it to an SQL TIMESTAMP before returning it to the database.
writeTimestamp

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeCharacterStream(Reader![]()
![]()
x) throws SQLException
![]()
![]()
SQLOutputImpl object. The driver will do any necessary
conversion from Unicode to the database CHAR format.
writeCharacterStream

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeAsciiStream(InputStream![]()
![]()
x) throws SQLException
![]()
![]()
SQLOutputImpl object. The driver will do any necessary
conversion from ASCII to the database CHAR format.
writeAsciiStream

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeBinaryStream(InputStream![]()
![]()
x) throws SQLException
![]()
![]()
SQLOutputImpl
object.
writeBinaryStream

in interface SQLOutput

x - the value to pass to the database
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.

public void writeObject(SQLData![]()
![]()
x) throws SQLException
![]()
![]()
SQLData object.
When the SQLData object is null, this
method writes an SQL NULL to the stream.
Otherwise, it calls the SQLData.writeSQL
method of the given object, which
writes the object's attributes to the stream.
The implementation of the method SQLData.writeSQ
calls the appropriate SQLOutputImpl.writeXXX method(s)
for writing each of the object's attributes in order.
The attributes must be read from an SQLInput
input stream and written to an SQLOutputImpl
output stream in the same order in which they were
listed in the SQL definition of the user-defined type.
writeObject

in interface SQLOutput

x - the object representing data of an SQL structured or
distinct type
SQLException

- if the SQLOutputImpl object is in
use by a SQLData object attempting to write the attribute
values of a UDT to the database.