Package oracle.sql

Class TypeDescriptor

  • All Implemented Interfaces:
    java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, oracle.jdbc.diagnostics.Diagnosable, oracle.jdbc.internal.ACProxyable, oracle.jdbc.internal.ObjectData, oracle.jdbc.internal.OracleTypeMetaData, OracleData, OracleTypeMetaData, ORAData
    Direct Known Subclasses:
    ArrayDescriptor, OpaqueDescriptor, StructDescriptor

    public class TypeDescriptor
    extends java.lang.Object
    implements oracle.jdbc.internal.OracleTypeMetaData, java.io.Serializable, ORAData, OracleData, oracle.jdbc.diagnostics.Diagnosable
    The descriptor of pre-defined types.
    See Also:
    Serialized Form
    • Constructor Detail

      • TypeDescriptor

        protected TypeDescriptor​(short _typeCode)
      • TypeDescriptor

        protected TypeDescriptor​(short _typeCode,
                                 java.lang.String name,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • TypeDescriptor

        protected TypeDescriptor​(short _typeCode,
                                 oracle.sql.SQLName name,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • TypeDescriptor

        protected TypeDescriptor​(short _typeCode,
                                 oracle.sql.SQLName name,
                                 oracle.jdbc.oracore.OracleTypeADT type,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • TypeDescriptor

        protected TypeDescriptor​(short _typeCode,
                                 oracle.jdbc.oracore.OracleTypeADT type,
                                 java.sql.Connection conn)
                          throws java.sql.SQLException
        Throws:
        java.sql.SQLException
    • Method Detail

      • getName

        public java.lang.String getName()
                                 throws java.sql.SQLException
        Return fully qualified type name.
        Specified by:
        getName in interface OracleTypeMetaData
        Throws:
        java.sql.SQLException
      • getTypeCode

        public int getTypeCode()
                        throws java.sql.SQLException
        Returns type code.
        Specified by:
        getTypeCode in interface OracleTypeMetaData
        Throws:
        java.sql.SQLException
      • getTypeCodeName

        public java.lang.String getTypeCodeName()
                                         throws java.sql.SQLException
        Returns the type code name.
        Specified by:
        getTypeCodeName in interface OracleTypeMetaData
        Throws:
        java.sql.SQLException
      • getInternalTypeCode

        public short getInternalTypeCode()
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • isV2available

        public static boolean isV2available​(byte[] toid)
      • getTypeDescriptor

        public static TypeDescriptor getTypeDescriptor​(java.lang.String qualifiedName,
                                                       OracleConnection conn,
                                                       byte[] image,
                                                       long offset)
                                                throws java.sql.SQLException
        Obtain the type descriptor associated with the specified type name.
        Parameters:
        name - specifies the type name.
        conn - specifies the associated connection.
        Returns:
        the appropriate descriptor for Array or Struct depending on the type name.
        Throws:
        java.sql.SQLException - if the specified type does not exist, or if an error occurred.
      • toDatum

        public Datum toDatum​(java.sql.Connection c)
                      throws java.sql.SQLException
        Description copied from interface: ORAData
        Extract an oracle.sql.Datum object.

        This method is invoked by setORAData() to extract a Datum. The implementation of this method must return the correct type of Datum.

        Although most implementation will ignore the connection, it is occassionally needed. For example, if the class embeds CHAR attributes, connection may be needed to determine the database character set.

        Specified by:
        toDatum in interface ORAData
        Parameters:
        c - The connection into which the value is being sent.
        Returns:
        a Datum contaning the value to be sent into the connection.
        Throws:
        java.sql.SQLException - if an error occurred.
      • toJDBCObject

        public java.lang.Object toJDBCObject​(java.sql.Connection c)
                                      throws java.sql.SQLException
        Description copied from interface: OracleData
        Extract a jdbc Object.

        This method is invoked by setObject() to extract the jdbc Object. The implementation must return the jdbc Object that correctly represents the underlying SQLType.

        Although most implementation will ignore the connection, it is occassionally needed. for example, if the class embeds CHAR attributes, connection may be needed to determine the database character set.

        Specified by:
        toJDBCObject in interface OracleData
        Parameters:
        c - The connection into which the value is being sent.
        Returns:
        a jdbc Object containing the value to be sent into the connection.
        Throws:
        java.sql.SQLException - if an error occurred.
      • isTransient

        public boolean isTransient()
      • setPrecision

        public void setPrecision​(long _precision)
      • getPrecision

        public long getPrecision()
      • setScale

        public void setScale​(byte _scale)
      • getScale

        public byte getScale()
      • setConnection

        public void setConnection​(java.sql.Connection connection)
                           throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • getSubtypeName

        public static java.lang.String getSubtypeName​(OracleConnection conn,
                                                      byte[] image,
                                                      long offset)
                                               throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • initMetadataRecursively

        public void initMetadataRecursively()
                                     throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • initNamesRecursively

        public void initNamesRecursively()
                                  throws java.sql.SQLException
        Throws:
        java.sql.SQLException
      • toXMLString

        public java.lang.String toXMLString()
                                     throws java.sql.SQLException
        Creates a String which is an XML representation of this type and all OracleTypes within. Metadata for object types and collections is relatively expensive to get from the server. Not all of it is necessary depending on how the TypeDescriptor is used. In normal operation it is fetched as needed. This method will provide a representation of this type in its current state without fetching additional data
        Throws:
        java.sql.SQLException
      • toXMLString

        public java.lang.String toXMLString​(boolean fetchAllMetaDataAsNeeded)
                                     throws java.sql.SQLException
        Creates a String which is an XML representation of this type and all OracleTypes within. Optionally causes any metadata which has not been previously fetched from the server to be obtained so as to provide a complete representation. See toXMLString()
        Parameters:
        fetchAllMetaDataAsNeeded - if set to true and if necessary the driver will fetch the metadata from the server
        Throws:
        java.sql.SQLException
      • printXML

        public void printXML​(java.io.PrintStream s)
                      throws java.sql.SQLException
        Print an XML representation of this type and all OracleTypes within.
        Parameters:
        s - a PrintStream upon which to write
        Throws:
        java.sql.SQLException
      • printXML

        public void printXML​(java.io.PrintStream stream,
                             boolean fetchAllMetaDataAsNeeded)
                      throws java.sql.SQLException
        Print an XML representation of this type and all OracleTypes within.
        Parameters:
        stream - a PrintStream upon which to write
        fetchAllMetaDataAsNeeded - if set to true and if necessary the driver will fetch the metadata from the server
        Throws:
        java.sql.SQLException
      • getConnectionDuringExceptionHandling

        protected oracle.jdbc.internal.OracleConnection getConnectionDuringExceptionHandling()
      • convToUpperCase

        public static java.lang.String convToUpperCase​(java.lang.String str)
        Convert the String to UpperCase character by character
        Parameters:
        String -
        Returns:
        String converted to Uppercase
      • getDiagnosable

        public oracle.jdbc.diagnostics.Diagnosable getDiagnosable()
        Specified by:
        getDiagnosable in interface oracle.jdbc.diagnostics.Diagnosable