Oracle10g JDBC

oracle.sql
Class STRUCT

java.lang.Object
  extended byoracle.sql.Datum
      extended byoracle.sql.DatumWithConnection
          extended byoracle.sql.STRUCT
All Implemented Interfaces:
java.sql.Struct
Direct Known Subclasses:
JAVA_STRUCT

public class STRUCT
extends DatumWithConnection
implements java.sql.Struct

This class has two roles.

Like other classes in oracle.sql. it is a value class. That is, once it is constructed the user should not change its contents.


Field Summary
static java.lang.String BUILD_DATE
           
static boolean PRIVATE_TRACE
           
static boolean TRACE
           
 
Constructor Summary
STRUCT(StructDescriptor type, java.sql.Connection conn, java.util.Map attrList)
           
STRUCT(StructDescriptor type, java.sql.Connection conn, java.lang.Object[] attributes)
          Constructor.
 
Method Summary
 java.lang.Object[] getAttributes()
          Implements the Struct interface function.
 java.lang.Object[] getAttributes(java.util.Map map)
          Implements the Struct interface function.
 boolean getAutoBuffering()
          Performance hint.
 StructDescriptor getDescriptor()
          Oracle extension.
 java.sql.Connection getJavaSqlConnection()
          Oracle extension Return the java.sql.Connection associated with the receiver.
 Datum[] getOracleAttributes()
          Oracle extension.
 java.lang.String getSQLTypeName()
          Implements the Struct interface function Retrieves the SQL type name of the SQL structured type that this Struct object represents.
 boolean isConvertibleTo(java.lang.Class jClass)
          Determines if datum object can be converted to a particular class
 void setAutoBuffering(boolean enable)
          Performance hint.
 java.lang.Object toJdbc()
          Oracle extension.
 java.lang.Object toJdbc(java.util.Map map)
          Oracle extension.
 
Methods inherited from class oracle.sql.DatumWithConnection
assertNotNull, assertNotNull, getConnection, getOracleConnection
 
Methods inherited from class oracle.sql.Datum
asciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, byteValue, characterStreamValue, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, longValue, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timeValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TRACE

public static final boolean TRACE
See Also:
Constant Field Values

PRIVATE_TRACE

public static final boolean PRIVATE_TRACE
See Also:
Constant Field Values

BUILD_DATE

public static final java.lang.String BUILD_DATE
See Also:
Constant Field Values
Constructor Detail

STRUCT

public STRUCT(StructDescriptor type,
              java.sql.Connection conn,
              java.lang.Object[] attributes)
       throws java.sql.SQLException
Constructor. The raw bytes are computed at this time or a copy of attributes is made. In any event the caller is free to modify the array without affecting the values held in the STRUCT. For inherited object types we must check that the descriptor indicates that the type is instantiable. That database does not check on e.g. insertion but only on PL/SQL object creation. So we have to check here, too. There is an argument to be made that there is a good use for the STRUCT instance to carry data around and that the error ought to be when an insertion or udpate is attempted. But this keeps the "not instantiable" rather than "not storable" notion. And is is much more simple.

Parameters:
type - the SQLStructType used to convert the type to
attributes - the array specifying the attributes to be converted to raw bytes.
See Also:
oracle.sql.SQLStructType

STRUCT

public STRUCT(StructDescriptor type,
              java.sql.Connection conn,
              java.util.Map attrList)
       throws java.sql.SQLException
Method Detail

getSQLTypeName

public java.lang.String getSQLTypeName()
                                throws java.sql.SQLException
Implements the Struct interface function Retrieves the SQL type name of the SQL structured type that this Struct object represents.

Specified by:
getSQLTypeName in interface java.sql.Struct
Throws:
java.sql.SQLException - if a database access error occurs

getAttributes

public java.lang.Object[] getAttributes()
                                 throws java.sql.SQLException
Implements the Struct interface function. Produces the ordered values of the attributes of the SQL structurec type that this Struct object represents. Each call returns a fresh array. This method uses the type map associated with the connection for customizations of the type mappings. If there is no entry in the connection's type map that matches the structured type that this Struct object represents, the driver uses the standard mapping.

Conceptually, this method calls the method getObject on each attribute of the structured type and returns a Java array containing the result.

Specified by:
getAttributes in interface java.sql.Struct
Returns:
an array containing the ordered attribute values
Throws:
java.sql.SQLException - if a database access error occurs

getAttributes

public java.lang.Object[] getAttributes(java.util.Map map)
                                 throws java.sql.SQLException
Implements the Struct interface function. Produces the ordered values of the attributes of the SQL structurec type that this Struct object represents. Each call returns a fresh array. This method uses the given type map for customizations of the type mappings. If there is no entry in the given type map that matches the structured type that this Struct object represents, the driver uses the standard mapping.

Conceptually, this method calls the method getObject on each attribute of the structured type and returns a Java array containing the result.

Specified by:
getAttributes in interface java.sql.Struct
Parameters:
map - a mapping of SQL type names to Java classes
Returns:
an array containing the ordered attribute values
Throws:
java.sql.SQLException - if a database access error occurs

getDescriptor

public StructDescriptor getDescriptor()
                               throws java.sql.SQLException
Oracle extension. Return the StructDescriptor object that contains the type information.

Returns:
the type descriptor
Throws:
java.sql.SQLException

getOracleAttributes

public Datum[] getOracleAttributes()
                            throws java.sql.SQLException
Oracle extension. Retrun the array of Attributes as oracle.sql.XXX's. A fresh array is returned each time getOracleAttributes is called.

Returns:
datum array that containing the ordered attribute values as oracle.sql.Datum objects.
Throws:
java.sql.SQLException

toJdbc

public java.lang.Object toJdbc()
                        throws java.sql.SQLException
Oracle extension. Returns the JDBC representation of the datum object

Specified by:
toJdbc in class Datum
Returns:
an object containing the JDBC value
Throws:
java.sql.SQLException - if conversion to JDBC representation results in an error

toJdbc

public java.lang.Object toJdbc(java.util.Map map)
                        throws java.sql.SQLException
Oracle extension. Consults the map to determine what class to convert to, and then uses toClass

Throws:
java.sql.SQLException

isConvertibleTo

public boolean isConvertibleTo(java.lang.Class jClass)
Determines if datum object can be converted to a particular class

Specified by:
isConvertibleTo in class Datum
Parameters:
jClass - Class to convert to
Returns:
true, if conversion to cls is permitted false, if conversion to cls is not permitted

setAutoBuffering

public void setAutoBuffering(boolean enable)
                      throws java.sql.SQLException
Performance hint. Sets this struct's auto-buffering mode. If a struct is in auto-buffering mode, then the struct will keep a local copy of all its attributes. Then the next access to the same attributes will return a cloned copy. Otherwise, type conversion for each element is required. By default, a STRUCT is NOT in auto-buffering mode.

Parameters:
enable - - true enables auto-buffering; false disables auto-buffering
Throws:
java.sql.SQLException
Since:
8.1.7
See Also:
getAutoBuffering()

getAutoBuffering

public boolean getAutoBuffering()
                         throws java.sql.SQLException
Performance hint. Get the current auto-buffering state.

Returns:
the current state of auto-buffering
Throws:
java.sql.SQLException
Since:
8.1.7
See Also:
setAutoBuffering(boolean)

getJavaSqlConnection

public java.sql.Connection getJavaSqlConnection()
                                         throws java.sql.SQLException
Description copied from class: DatumWithConnection
Oracle extension Return the java.sql.Connection associated with the receiver. Since 9.0.0 not all Oracle JDBC connection objects are assignment compatible with oracle.jdbc.driver.OracleConnection. If the connection is wrapped, return the outermost wrapper.

Overrides:
getJavaSqlConnection in class DatumWithConnection
Returns:
the connection
Throws:
java.sql.SQLException - if an error occurs

Oracle10g JDBC

Copyright © 1998,2004, Oracle. All rights reserved