com.informix.jdbc
Interface IfmxUDTSQLInput

All Superinterfaces:
java.sql.SQLInput, com.informix.jdbc.SQLUDTInput

public interface IfmxUDTSQLInput
extends java.sql.SQLInput, com.informix.jdbc.SQLUDTInput

The IfmxUDTSQLInput interface extends the SQLInput interface. This interface is specifically for Informix user-defined types. It contains Informix extension methods for materializing fixed-length data.


Method Summary
 int available()
          Returns the number of bytes remaining in this input stream
 boolean getAutoAlignment()
          Returns true if auto alignment is enabled and false if auto alignment has been disabled.
 int getCurrentPosition()
          Returns the current position in the input stream.
 IfxUDTInfo getUDTInfo(int xid)
          Get general information about opaque and distinct types and detailed information for complex types.
 IfxUDTInfo getUDTInfo(java.lang.String name, java.lang.String owner)
          Get general information about opaque and distinct types and detailed information for complex types.
 int length()
           Gets the total length of the entire data stream.
 byte[] readBytes(int maxlen)
          Reads the next attribute in the stream as Java byte array.
 Interval readInterval()
          Reads the next attribute in the stream as a Java Interval.
 java.lang.String readString(int maxlen)
           Reads the next attribute in the stream as a Java String.
 void setAutoAlignment(boolean value)
          Enable or disable automatic alignment.
 void setCurrentPosition(int position)
          Resets the current position.
 void skipBytes(int len)
          Skips over and discards len bytes of data from the input stream.
 
Methods inherited from interface java.sql.SQLInput
readArray, readAsciiStream, readBigDecimal, readBinaryStream, readBlob, readBoolean, readByte, readBytes, readCharacterStream, readClob, readDate, readDouble, readFloat, readInt, readLong, readObject, readRef, readShort, readString, readTime, readTimestamp, readURL, wasNull
 

Method Detail

length

public int length()

Gets the total length of the entire data stream.

Specified by:
length in interface com.informix.jdbc.SQLUDTInput
Returns:
The total length.

readString

public java.lang.String readString(int maxlen)
                            throws java.sql.SQLException

Reads the next attribute in the stream as a Java String. This method is similar to SQLInput.readString(), except that it reads a fixed length of data. This method replaces SQLInput.readString() in the UDT implementation. Since the user-defined type is unknown to the driver, the user MUST supply a length in order for the driver to read in the next attribute properly.

Specified by:
readString in interface com.informix.jdbc.SQLUDTInput
Parameters:
maxlen - The maximum size of data to be read in.
Returns:
The attribute as a String.
Throws:
java.sql.SQLException

readBytes

public byte[] readBytes(int maxlen)
                 throws java.sql.SQLException
Reads the next attribute in the stream as Java byte array. This method is similar to SQLOutput.readBytes(), except that it reads a fixed length of data. This method replaces SQLInput.readBytes() in the UDT implementation. Since the user-defined type is unknown to the driver, the user MUST supply a length in order for the driver to read in the next attribute properly.

Specified by:
readBytes in interface com.informix.jdbc.SQLUDTInput
Parameters:
maxlen - The maximum size of data to read in.
Returns:
The attribute as byte array.
Throws:
java.sql.SQLException

readInterval

public Interval readInterval()
                      throws java.sql.SQLException
Reads the next attribute in the stream as a Java Interval. This method is an Informix extension.

Specified by:
readInterval in interface com.informix.jdbc.SQLUDTInput
Returns:
The attribute as an Interval object.
Throws:
java.sql.SQLException

setAutoAlignment

public void setAutoAlignment(boolean value)
Enable or disable automatic alignment. The default is that the driver automatically handles alignment between data fields.

Parameters:
value - = true then alignment should be handles automatically. If value = false then no alignment is done. It's the user's respon- sibility to call skipBytes(int) to handle alignment.

getAutoAlignment

public boolean getAutoAlignment()
Returns true if auto alignment is enabled and false if auto alignment has been disabled.

Returns:
true if auto alignment is enabled.

skipBytes

public void skipBytes(int len)
               throws java.sql.SQLException
Skips over and discards len bytes of data from the input stream. alignment has been disabled.

Parameters:
len - Number of bytes to skip over and discard.
Throws:
java.sql.SQLException

getCurrentPosition

public int getCurrentPosition()
                       throws java.sql.SQLException
Returns the current position in the input stream.

Returns:
Returns the current position.
Throws:
java.sql.SQLException

setCurrentPosition

public void setCurrentPosition(int position)
                        throws java.sql.SQLException
Resets the current position.

Parameters:
position -
Throws:
java.sql.SQLException

available

public int available()
Returns the number of bytes remaining in this input stream

Returns:
Returns the number of bytes remaining in this input stream.

getUDTInfo

public IfxUDTInfo getUDTInfo(int xid)
                      throws java.sql.SQLException
Get general information about opaque and distinct types and detailed information for complex types. Calls IfmxConnection.getUDTInfo(int)

Parameters:
xid - Is the extended id found in sysxtdtype system catalog.
Returns:
Object of type IfxUDTInfo which contains all information about a user defined datatype
Throws:
java.sql.SQLException

getUDTInfo

public IfxUDTInfo getUDTInfo(java.lang.String name,
                             java.lang.String owner)
                      throws java.sql.SQLException
Get general information about opaque and distinct types and detailed information for complex types. Calls IfmxConnection.getUDTInfo(String name, String owner)

Parameters:
name - The data type name.
owner - The owner of the data type (can be null).
Returns:
The detailed type information as an Informix IfxUDTInfo.
Throws:
java.sql.SQLException