Package oracle.sql

Class ARRAY

All Implemented Interfaces:
Serializable, Array, oracle.jdbc.internal.ACProxyable, oracle.jdbc.internal.OracleArray, oracle.jdbc.internal.OracleConcreteProxy, oracle.jdbc.internal.OracleDatumWithConnection, OracleArray

public class ARRAY extends DatumWithConnection implements oracle.jdbc.internal.OracleArray, oracle.jdbc.internal.OracleConcreteProxy
Deprecated.
Use java.sql.Array interface for declaration instead of using concrete class oracle.sql.ARRAY.
This class has two roles.
  • It is the Oracle implementation class for the generic JDBC Array interface.
  • It wraps the "raw bytes" of an Oracle Collection.
Like other classes in oracle.sql. it is a value class. That is, once it is constructed the user should not change its contents. The type of the array elements is called the "Base Type" An Oracle implementation for generic JDBC Array interface. Use Array interface for declaration instead of using concrete class oracle.sql.ARRAY. java.sql.Array has methods declared for all opertions. For Oracle specific methods use the interface OracleArray.

Obtaining java.sql.Array from the ResultSet

java.sql.Array array = resultSet.getArray(...);

Creating a new java.sql.Array using factory method. OracleConnection.createOracleArray(java.lang.String, java.lang.Object) should be used to create java.sql.Array. Connection.createArrayOf(java.lang.String, java.lang.Object[]) throws an exception since Oracle does not support creation of anonymous array type.

java.sql.Array array = ((oracle.jdbc.OracleConnection)connection).createOracleArray((...);
See Also:
  • Field Details

    • ACCESS_FORWARD

      public static final int ACCESS_FORWARD
      Deprecated.
      See Also:
    • ACCESS_REVERSE

      public static final int ACCESS_REVERSE
      Deprecated.
      See Also:
    • ACCESS_UNKNOWN

      public static final int ACCESS_UNKNOWN
      Deprecated.
      See Also:
    • target

      protected oracle.jdbc.driver.OracleArray target
      Deprecated.
  • Constructor Details

    • ARRAY

      public ARRAY(ArrayDescriptor type, Connection conn, Object elements) throws SQLException
      Deprecated.
      Constructor.
      Parameters:
      type - an ArrayDescriptor describing the SQL Type
      elements - the contents of the array. These objects will be converted to raw bytes of the appropriate SQL Type
      Throws:
      SQLException
  • Method Details

    • getTarget

      public oracle.jdbc.driver.OracleArray getTarget()
      Deprecated.
    • getBaseTypeName

      public String getBaseTypeName() throws SQLException
      Deprecated.
      Implements Array interface method Returns the SQL type name of the elements in the array designated by this Array object. If the elements are a built-in type, it returns the database-specific type name of the elements. If the elements are a user-defined type (UDT), this method returns the fully-qualified SQL type name.
      Specified by:
      getBaseTypeName in interface Array
      Returns:
      a String that is the database-specific name for a built-in base type or the fully-qualified SQL type name for a base type that is a UDT
      Throws:
      SQLException - if an error occurs while attempting to access the type name
    • getBaseType

      public int getBaseType() throws SQLException
      Deprecated.
      Implements Array interface method Determine the code, from java.sql.Types, of the type of the elements of the array.
      Specified by:
      getBaseType in interface Array
      Returns:
      the type code of the elements of the array.
      Throws:
      SQLException
      See Also:
    • getArray

      public Object getArray() throws SQLException
      Deprecated.
      Implements Array interface method Retrieve the contents of the SQL array designated by the object. Use the type-map associated with the connection for customizations of the type-mappings.
      Specified by:
      getArray in interface Array
      Returns:
      a Java array containing the ordered elements of the SQL array designated by this object.
      Throws:
      SQLException
    • getJavaMap

      public Map<?,?> getJavaMap() throws SQLException
      Deprecated.
      Implements Array interface method Retrieves the contents of the SQL associative array designated by the object.
      Specified by:
      getJavaMap in interface OracleArray
      Returns:
      a Java Map containing the ordered elements of the SQL associative array designated by this object.
      Throws:
      SQLException
    • getArray

      public Object getArray(Map map) throws SQLException
      Deprecated.
      Implements Array interface method Retrieve the contents of the SQL array designated by this object. Use the given map for type-map customizations.
      Specified by:
      getArray in interface Array
      Parameters:
      map - contains mapping of SQL type names to Java classes
      Returns:
      a Java array containing the ordered elements of the SQL array designated by this object.
      Throws:
      SQLException
    • getArray

      public Object getArray(long index, int count) throws SQLException
      Deprecated.
      Implements Array interface method Like getArray() above, but returns an array containing a slice of the SQL array, beginning with the given index and containing up to count successive elements of the SQL array. Use the type-map associated with the connection for customizations of the type-mappings.
      Specified by:
      getArray in interface Array
      Parameters:
      index - the array-index of the first element to retrieve
      count - the number of successive SQL array elements to retrieve
      Returns:
      an array containing up to count elements of the SQL array, beginning with element index.
      Throws:
      SQLException
    • getArray

      public Object getArray(long index, int count, Map map) throws SQLException
      Deprecated.
      Implements Array interface method Like getArray() above, but returns an array containing a slice of the SQL array, beginning with the given index and containing up to count successive elements of the SQL array. Use the given map for type-map customizations.
      Specified by:
      getArray in interface Array
      Parameters:
      index - the array-index of the first element to retrieve
      count - the number of successive SQL array elements to retrieve
      map - contains mapping of SQL user-defined types to classes
      Returns:
      an array containing up to count elements of the SQL array, beginning with element index.
      Throws:
      SQLException
    • getResultSet

      public ResultSet getResultSet() throws SQLException
      Deprecated.
      Implements Array interface method Returns a result set that contains the elements of the array designated by this Array object. If appropriate, the elements of the array are mapped using the connection's type map; otherwise, the standard mapping is used.

      The result set contains one row for each array element, with two columns in each row. The second column stores the element value; the first column stores the index into the array for that element (with the first array element being at index 1). The rows are in ascending order corresponding to the order of the indices.

      Specified by:
      getResultSet in interface Array
      Returns:
      a ResultSet object containing one row for each of the elements in the array designated by this Array object, with the rows in ascending order based on the indices.
      Throws:
      SQLException - if an error occurs while attempting to access the array
    • getResultSet

      public ResultSet getResultSet(Map map) throws SQLException
      Deprecated.
      Implements Array interface method Returns a result set that contains the elements of the array designated by this Array object and uses the given map to map the array elements. If the base type of the array does not match a user-defined type in map, the standard mapping is used instead.

      The result set contains one row for each array element, with two columns in each row. The second column stores the element value; the first column stores the index into the array for that element (with the first array element being at index 1). The rows are in ascending order corresponding to the order of the indices.

      Specified by:
      getResultSet in interface Array
      Parameters:
      map - contains mapping of SQL user-defined types to classes in the Java(tm) programming language
      Returns:
      a ResultSet object containing one row for each of the elements in the array designated by this Array object, with the rows in ascending order based on the indices.
      Throws:
      SQLException - if an error occurs while attempting to access the array
    • getResultSet

      public ResultSet getResultSet(long index, int count) throws SQLException
      Deprecated.
      Implements Array interface method Returns a result set holding the elements of the subarray that starts at index index and contains up to count successive elements. This method uses the connection's type map to map the elements of the array if the map contains an entry for the base type. Otherwise, the standard mapping is used.

      The result set has one row for each element of the SQL array designated by this object, with the first row containing the element at index index. The result set has up to count rows in ascending order based on the indices. Each row has two columns: The second column stores the element value; the first column stroes the index into the array for that element.

      Specified by:
      getResultSet in interface Array
      Parameters:
      index - the array index of the first element to retrieve; the first element is at index 1
      count - the number of successive SQL array elements to retrieve
      Returns:
      a ResultSet object containing up to count consecutive elements of the SQL array designated by this Array object, starting at index index.
      Throws:
      SQLException - if an error occurs while attempting to access the array
    • getResultSet

      public ResultSet getResultSet(long index, int count, Map map) throws SQLException
      Deprecated.
      Implements Array interface method Returns a result set holding the elements of the subarray that starts at index index and contains up to count successive elements. This method uses the Map object map to map the elements of the array unless the base type of the array does not match a user-defined type in map, in which case it uses the standard mapping.

      The result set has one row for each element of the SQL array designated by this object, with the first row containing the element at index index. The result set has up to count rows in ascending order based on the indices. Each row has two columns: The second column stores the element value; the first column stroes the index into the array for that element.

      Specified by:
      getResultSet in interface Array
      Parameters:
      index - the array index of the first element to retrieve; the first element is at index 1
      count - the number of successive SQL array elements to retrieve
      map - the Map object that contains the mapping of SQL type names to classes in the Java(tm) programming language
      Returns:
      a ResultSet object containing up to count consecutive elements of the SQL array designated by this Array object, starting at index index.
      Throws:
      SQLException - if an error occurs while attempting to access the array
    • getOracleArray

      public Datum[] getOracleArray() throws SQLException
      Deprecated.
      Oracle extension. Analogous to getArray except that it always returns an oracle.sql.XXX instead of whatever result.getObject would have returned.
      Specified by:
      getOracleArray in interface oracle.jdbc.internal.OracleArray
      Returns:
      an array of Datum.
      Throws:
      SQLException
    • length

      public int length() throws SQLException
      Deprecated.
      Oracle extension. Get array size.
      Specified by:
      length in interface OracleArray
      Returns:
      the number of elements in the array.
      Throws:
      SQLException
    • getOracleArray

      public Datum[] getOracleArray(long index, int count) throws SQLException
      Deprecated.
      Oracle extension. Like getOracleArray, but returns a slice.
      Specified by:
      getOracleArray in interface oracle.jdbc.internal.OracleArray
      Parameters:
      index - the index of the first element to be returned
      count - the number of elements to be returned.
      Returns:
      an array containing count elements starting at index
      Throws:
      SQLException
    • getSQLTypeName

      public String getSQLTypeName() throws SQLException
      Deprecated.
      Oracle extension. Retrieves the SQL type name of the SQL structured type that this Struct object represents.
      Specified by:
      getSQLTypeName in interface OracleArray
      Returns:
      the fully-qualified type name of the SQL collection type for which this Array object is the generic representation
      Throws:
      SQLException - if a database access error occurs
    • getOracleMetaData

      public OracleTypeMetaData getOracleMetaData() throws SQLException
      Deprecated.
      Return the type data for this object
      Specified by:
      getOracleMetaData in interface OracleArray
      Returns:
      type metadata
      Throws:
      SQLException - if an error occurs
      Since:
      11.2.0.3.0
    • getDescriptor

      public ArrayDescriptor getDescriptor() throws SQLException
      Deprecated.
      Oracle extension. Return the ArrayDescriptor object that contains the type information.
      Specified by:
      getDescriptor in interface oracle.jdbc.internal.OracleArray
      Returns:
      the type descriptor
      Throws:
      SQLException
    • toJdbc

      public Object toJdbc() throws SQLException
      Deprecated.
      Oracle extension. Returns the JDBC representation of the datum object
      Specified by:
      toJdbc in interface OracleArray
      Specified by:
      toJdbc in interface oracle.jdbc.internal.OracleDatumWithConnection
      Specified by:
      toJdbc in class Datum
      Returns:
      an object containing the JDBC value
      Throws:
      SQLException - if conversion to JDBC representation results in an error
    • toJdbc

      public Object toJdbc(Map map) throws SQLException
      Deprecated.
      Oracle extension. Consults the map to determine what class to convert to, and then uses toClass
      Throws:
      SQLException
    • isConvertibleTo

      public boolean isConvertibleTo(Class<?> jClass)
      Deprecated.
      Oracle extension. Determines if datum object can be converted to a particular class
      Specified by:
      isConvertibleTo in interface oracle.jdbc.internal.OracleArray
      Specified by:
      isConvertibleTo in interface oracle.jdbc.internal.OracleDatumWithConnection
      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
    • getIntArray

      public int[] getIntArray() throws SQLException
      Deprecated.
      Oracle extension. Analogous to getArray except that it always returns a int[].
      Specified by:
      getIntArray in interface OracleArray
      Returns:
      an array of int.
      Throws:
      SQLException
    • getIntArray

      public int[] getIntArray(long index, int count) throws SQLException
      Deprecated.
      Oracle extension. Like getIntArray, but returns a slice.
      Specified by:
      getIntArray in interface OracleArray
      Parameters:
      index - the index of the first element to be returned
      count - the number of elements to be returned.
      Returns:
      an array containing count elements starting at index
      Throws:
      SQLException
    • getDoubleArray

      public double[] getDoubleArray() throws SQLException
      Deprecated.
      Oracle extension. Analogous to getArray except that it always returns a double[].
      Specified by:
      getDoubleArray in interface OracleArray
      Returns:
      an array of double.
      Throws:
      SQLException
    • getDoubleArray

      public double[] getDoubleArray(long index, int count) throws SQLException
      Deprecated.
      Oracle extension. Like getDoubleArray, but returns a slice.
      Specified by:
      getDoubleArray in interface OracleArray
      Parameters:
      index - the index of the first element to be returned
      count - the number of elements to be returned.
      Returns:
      an array containing count elements starting at index
      Throws:
      SQLException
    • getShortArray

      public short[] getShortArray() throws SQLException
      Deprecated.
      Oracle extension. Analogous to getArray except that it always returns a short[].
      Specified by:
      getShortArray in interface OracleArray
      Returns:
      an array of short.
      Throws:
      SQLException
    • getShortArray

      public short[] getShortArray(long index, int count) throws SQLException
      Deprecated.
      Specified by:
      getShortArray in interface OracleArray
      Throws:
      SQLException
    • getLongArray

      public long[] getLongArray() throws SQLException
      Deprecated.
      Oracle extension. Analogous to getArray except that it always returns a long[].
      Specified by:
      getLongArray in interface OracleArray
      Returns:
      an array of long.
      Throws:
      SQLException
    • getLongArray

      public long[] getLongArray(long index, int count) throws SQLException
      Deprecated.
      Oracle extension. Like getLongArray, but returns a slice.
      Specified by:
      getLongArray in interface OracleArray
      Parameters:
      index - the index of the first element to be returned
      count - the number of elements to be returned.
      Returns:
      an array containing count elements starting at index
      Throws:
      SQLException
    • getFloatArray

      public float[] getFloatArray() throws SQLException
      Deprecated.
      Oracle extension. Analogous to getArray except that it always returns a float[].
      Specified by:
      getFloatArray in interface OracleArray
      Returns:
      an array of float.
      Throws:
      SQLException
    • getFloatArray

      public float[] getFloatArray(long index, int count) throws SQLException
      Deprecated.
      Oracle extension. Like getFloatArray, but returns a slice.
      Specified by:
      getFloatArray in interface OracleArray
      Parameters:
      index - the index of the first element to be returned
      count - the number of elements to be returned.
      Returns:
      an array containing count elements starting at index
      Throws:
      SQLException
    • setAutoBuffering

      public void setAutoBuffering(boolean enable) throws SQLException
      Deprecated.
      Performance hint. Sets this array's auto-buffering mode. If a array is in auto-buffering mode, then the array will keep a local copy of all its elements. Then the next access to the same elements will return a cloned copy. Otherwise, type conversion for each element is required. By default, a ARRAY is NOT in auto-buffering mode.
      Specified by:
      setAutoBuffering in interface oracle.jdbc.internal.OracleArray
      Parameters:
      enable - - true enables auto-buffering; false disables auto-buffering
      Throws:
      SQLException
      Since:
      8.1.7
      See Also:
    • getAutoBuffering

      public boolean getAutoBuffering() throws SQLException
      Deprecated.
      Performance hint. Get the current auto-buffering state.
      Specified by:
      getAutoBuffering in interface oracle.jdbc.internal.OracleArray
      Returns:
      the current state of auto-buffering
      Throws:
      SQLException
      Since:
      8.1.7
      See Also:
    • setAutoIndexing

      public void setAutoIndexing(boolean enable, int direction) throws SQLException
      Deprecated.
      Performance hint. Sets this array's auto-indexing mode. If a array is in auto-indexing mode, then the array will maintain a index table for array elements to fasten repeatedly access to the same elements or different elementes in the ARRAY. The second argument gives this array a hint as to the direction in which the elements will be accessed. Available direction values are ARRAY.ACCESS_FORWARD, ARRAY.ACCESS_REVERSE, and ARRAY.ACCESS_UNKNOWN.
      Specified by:
      setAutoIndexing in interface oracle.jdbc.internal.OracleArray
      Parameters:
      enable - - true enables auto-indexing; false disables auto-indexing
      direction - - overwrite default access direction.
      Throws:
      SQLException
      Since:
      8.1.7
    • setAutoIndexing

      public void setAutoIndexing(boolean enable) throws SQLException
      Deprecated.
      Performance hint. Sets this array's auto-indexing mode. If a array is in auto-indexing mode, then the array will maintain a index table for array elements to fasten repeatedly access to the same elements or different elementes in the ARRAY. By default, access direction is set to ARRAY.ACCESS_UNKNOWN.
      Specified by:
      setAutoIndexing in interface oracle.jdbc.internal.OracleArray
      Parameters:
      enable - - true enables auto-indexing; false disables auto-indexing
      Throws:
      SQLException
      Since:
      8.1.7
    • getAutoIndexing

      public boolean getAutoIndexing() throws SQLException
      Deprecated.
      Performance hint. Get the current auto-indexing state.
      Specified by:
      getAutoIndexing in interface oracle.jdbc.internal.OracleArray
      Returns:
      the current state of auto-indexing
      Throws:
      SQLException
      Since:
      8.1.7
      See Also:
      • oracle.sql.ARRAY#setAutoIndexinging(boolean)
      • oracle.sql.ARRAY#setAutoIndexinging(boolean, int)
    • getAccessDirection

      public int getAccessDirection() throws SQLException
      Deprecated.
      Performance hint. Get the access direction value.
      Specified by:
      getAccessDirection in interface oracle.jdbc.internal.OracleArray
      Returns:
      the current access direction
      Throws:
      SQLException
      Since:
      8.1.7
      See Also:
      • oracle.sql.ARRAY#setAutoIndexinging(boolean)
      • oracle.sql.ARRAY#setAutoIndexinging(boolean, int)
    • dump

      public String dump() throws SQLException
      Deprecated.
      Create a string which show the contents of this Array and of all its component parts.
      Throws:
      SQLException
    • stringValue

      public String stringValue() throws SQLException
      Deprecated.
      Description copied from class: Datum
      Convert to a String representation of the datum object
      Specified by:
      stringValue in interface oracle.jdbc.internal.OracleDatumWithConnection
      Overrides:
      stringValue in class Datum
      Returns:
      String representation of the datum object
      Throws:
      SQLException
    • free

      public void free() throws SQLException
      Deprecated.
      Currently does nothing.
      Specified by:
      free in interface Array
      Throws:
      SQLException
    • getNumElems

      public int getNumElems()
      Deprecated.
      Specified by:
      getNumElems in interface oracle.jdbc.internal.OracleArray
    • getDatumArray

      public Datum[] getDatumArray()
      Deprecated.
      Specified by:
      getDatumArray in interface oracle.jdbc.internal.OracleArray
    • getObjArray

      public Object getObjArray()
      Deprecated.
      Specified by:
      getObjArray in interface oracle.jdbc.internal.OracleArray
    • setNullObjArray

      public void setNullObjArray()
      Deprecated.
      Specified by:
      setNullObjArray in interface oracle.jdbc.internal.OracleArray