Some of the standard SQLInput and SQLOutput Stream methods need an additional length argument to read or write an opaque data type because the JDBC driver cannot determine the field lengths for an opaque type. Informix database server provides the IfmxUDTSQLInput and IfmxUDTSQLOutput extensions, which inherit from the standard JDBC 2.0 SQLInput and SQLOutput interfaces.
The IfmxUDTSQLInput interface extends SQLInput, which contains the following public methods:
String readString() boolean readBoolean() byte readByte() short readShort() int readInt() long readLong() float readFloat() double readDouble() java.math.BigDecimal readBigDecimal() byte[] readBytes() java.sql.Date readDate() java.sql.Time readTime() java.sql.Timestamp readTimestamp() java.io.Reader readCharacterStream() java.io.InputStream readAsciiStream() java.io.InputStream readBinaryStream() Object readObject() Ref readRef() Blob readBlob() Clob readClob() Array readArray() boolean wasNull()
The IfmxUDTSQLInput interface adds the following Informix methods:
String readString(int maxlen) byte[] readBytes(int maxlen) Interval readInterval() int available(); int length(); IfxUDTInfo getUDTInfo(int xid) IfxUDTInfo getUDTInfo(String name, String owner)
All the readXXX() methods throw an SQLException when they detect parsing errors. Use the readXXX() methods to convert the buffer of the given Input stream into a Java object. When the Input stream is empty, each read method throws an SQLException with e.getErrorcode equal to -79772 or IfxErrMsg.S_BADSQLDATA. However, you can use the length() and available() methods to determine when the Input stream is exhausted while converting variable length UDTs to Java objects.
The IfmxUDTSQLOutput interface extends SQLOutput, which contains the following public methods:
void writeString(String x) void writeBoolean(boolean x) void writeByte(byte x) void writeShort(short x) void writeInt(int x) void writeLong(long x) void writeFloat(float x) void writeDouble(double x) void writeBigDecimal(java.math.BigDecimal x) void writeBytes(byte[] x) void writeDate(java.sql.Date x) void writeTime(java.sql.Time x) void writeTimestamp(java.sql.Timestamp x) void writeCharacterStream(java.io.Reader x) void writeAsciiStream(java.io.InputStream x) void writeBinaryStream(java.io.InputStream x) void writeObject(SQLData x) void writeRef(Ref x) void writeBlob(Blob x) void writeClob(Clob x) void writeStruct(Struct x) void writeArray(Array x)
The IfmxUDTSQLOutput interface adds the following Informix methods:
void writeString(String x, int length) void writeBytes(byte[] b, int length) void writeInterval(Interval intrvl) int available() int length() IfxUDTInfo getUDTInfo(int xid) IfxUDTInfo getUDTInfo(String name, String owner)
All the writeXXX() methods throw an exception when they encounter conversion errors. Use the Stream write() methods to convert a Java object into the given Output buffer. The length() method returns the number of bytes that remain in the buffer. The JDBC 2.0 class files describe the SQLOutput definition.
Home | [ Top of Page | Previous Page | Next Page | Contents | Index ]