Class SQLOutputImpl
- All Implemented Interfaces:
SQLOutput
public class SQLOutputImpl extends Object implements SQLOutput
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.
- Since:
- 1.5
Constructor Summary
| Constructor | Description |
|---|---|
SQLOutputImpl |
Creates a new SQLOutputImpl object initialized with the given vector of attributes and type map. |
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
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 SQLOutputImpl 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 |
writeNClob |
Writes an SQL NCLOB value to the stream. |
void |
writeNString |
Writes the next attribute to the stream as a String in the Java programming language. |
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 |
writeRowId |
Writes an SQL ROWID value to the stream. |
void |
writeShort |
Writes a short in the Java programming language to this SQLOutputImpl object. |
void |
writeSQLXML |
Writes an SQL XML value to the stream. |
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 declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods declared in interface java.sql.SQLOutput
writeObject
Constructor Details
SQLOutputImpl
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.- Parameters:
-
attributes- aVectorobject containing the attributes of the UDT to be mapped to one or more objects in the Java programming language -
map- ajava.util.Mapobject containing zero or more entries, with each entry consisting of 1) aStringgiving the fully qualified name of a UDT and 2) theClassobject for theSQLDataimplementation that defines how the UDT is to be mapped - Throws:
-
SQLException- if theattributesor themapis anullvalue
Method Details
writeString
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.- Specified by:
-
writeStringin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeBoolean
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.- Specified by:
-
writeBooleanin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeByte
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.- Specified by:
-
writeBytein interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeShort
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.- Specified by:
-
writeShortin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeInt
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.- Specified by:
-
writeIntin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeLong
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.- Specified by:
-
writeLongin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeFloat
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.- Specified by:
-
writeFloatin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeDouble
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.- Specified by:
-
writeDoublein interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeBigDecimal
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.- Specified by:
-
writeBigDecimalin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeBytes
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.- Specified by:
-
writeBytesin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeDate
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.- Specified by:
-
writeDatein interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeTime
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.- Specified by:
-
writeTimein interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeTimestamp
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.- Specified by:
-
writeTimestampin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeCharacterStream
public void writeCharacterStream(Reader x) throws SQLException
SQLOutputImpl object. The driver will do any necessary conversion from Unicode to the database CHAR format.- Specified by:
-
writeCharacterStreamin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeAsciiStream
public void writeAsciiStream(InputStream x) throws SQLException
SQLOutputImpl object. The driver will do any necessary conversion from ASCII to the database CHAR format.- Specified by:
-
writeAsciiStreamin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeBinaryStream
public void writeBinaryStream(InputStream x) throws SQLException
SQLOutputImpl object.- Specified by:
-
writeBinaryStreamin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeObject
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.
- Specified by:
-
writeObjectin interfaceSQLOutput - Parameters:
-
x- the object representing data of an SQL structured or distinct type - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeRef
public void writeRef(Ref x) throws SQLException
Ref object in the Java programming language to this SQLOutputImpl object. The driver converts it to a serializable SerialRef SQL REF value before returning it to the database.- Specified by:
-
writeRefin interfaceSQLOutput - Parameters:
-
x- an object representing an SQLREFvalue - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeBlob
public void writeBlob(Blob x) throws SQLException
Blob object in the Java programming language to this SQLOutputImpl object. The driver converts it to a serializable SerialBlob SQL BLOB value before returning it to the database.- Specified by:
-
writeBlobin interfaceSQLOutput - Parameters:
-
x- an object representing an SQLBLOBvalue - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeClob
public void writeClob(Clob x) throws SQLException
Clob object in the Java programming language to this SQLOutputImpl object. The driver converts it to a serializable SerialClob SQL CLOB value before returning it to the database.- Specified by:
-
writeClobin interfaceSQLOutput - Parameters:
-
x- an object representing an SQLCLOBvalue - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeStruct
public void writeStruct(Struct x) throws SQLException
Struct object in the Java programming language to this SQLOutputImpl object. The driver converts this value to an SQL structured type before returning it to the database. This method should be used when an SQL structured type has been mapped to a Struct object in the Java programming language (the standard mapping). The method writeObject should be used if an SQL structured type has been custom mapped to a class in the Java programming language.
- Specified by:
-
writeStructin interfaceSQLOutput - Parameters:
-
x- an object representing the attributes of an SQL structured type - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeArray
public void writeArray(Array x) throws SQLException
Array object in the Java programming language to this SQLOutputImpl object. The driver converts this value to a serializable SerialArray SQL ARRAY value before returning it to the database.- Specified by:
-
writeArrayin interfaceSQLOutput - Parameters:
-
x- an object representing an SQLARRAYvalue - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeURL
public void writeURL(URL url) throws SQLException
java.sql.Type.DATALINK object in the Java programming language to this SQLOutputImpl object. The driver converts this value to a serializable SerialDatalink SQL DATALINK value before return it to the database.- Specified by:
-
writeURLin interfaceSQLOutput - Parameters:
-
url- an object representing a SQLDATALINKvalue - Throws:
-
SQLException- if theSQLOutputImplobject is in use by aSQLDataobject attempting to write the attribute values of a UDT to the database.
writeNString
public void writeNString(String x) throws SQLException
String in the Java programming language. The driver converts this to a SQL NCHAR or NVARCHAR or LONGNVARCHAR value (depending on the argument's size relative to the driver's limits on NVARCHAR values) when it sends it to the stream.- Specified by:
-
writeNStringin interfaceSQLOutput - Parameters:
-
x- the value to pass to the database - Throws:
-
SQLException- if a database access error occurs - Since:
- 1.6
writeNClob
public void writeNClob(NClob x) throws SQLException
NCLOB value to the stream.- Specified by:
-
writeNClobin interfaceSQLOutput - Parameters:
-
x- aNClobobject representing data of an SQLNCLOBvalue - Throws:
-
SQLException- if a database access error occurs - Since:
- 1.6
writeRowId
public void writeRowId(RowId x) throws SQLException
ROWID value to the stream.- Specified by:
-
writeRowIdin interfaceSQLOutput - Parameters:
-
x- aRowIdobject representing data of an SQLROWIDvalue - Throws:
-
SQLException- if a database access error occurs - Since:
- 1.6
writeSQLXML
public void writeSQLXML(SQLXML x) throws SQLException
XML value to the stream.- Specified by:
-
writeSQLXMLin interfaceSQLOutput - Parameters:
-
x- aSQLXMLobject representing data of an SQLXMLvalue - Throws:
-
SQLException- if a database access error occurs - Since:
- 1.6
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.sql.rowset/javax/sql/rowset/serial/SQLOutputImpl.html