oracle.sql
Class ARRAY

java.lang.Object
  |
  +--oracle.sql.Datum
        |
        +--oracle.sql.ARRAY

public class ARRAY
extends Datum
implements java.sql.Array


Field Summary
static int ACCESS_FORWARD
           
static int ACCESS_REVERSE
           
static int ACCESS_UNKNOWN
           
 
Constructor Summary
ARRAY(ArrayDescriptor type, java.sql.Connection conn, java.lang.Object elements)
          Constructor.
 
Method Summary
 int getAccessDirection()
          Performance hint.
 java.lang.Object getArray()
          Implements Array interface method Retrieve the contents of the SQL array designated by the object.
 java.lang.Object getArray(long index, int count)
          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.
 java.lang.Object getArray(long index, int count, java.util.Map map)
          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.
 java.lang.Object getArray(java.util.Map map)
          Implements Array interface method Retrieve the contents of the SQL array designated by this object.
 boolean getAutoBuffering()
          Performance hint.
 boolean getAutoIndexing()
          Performance hint.
 int getBaseType()
          Implements Array interface method Determine the code, from java.sql.Types, of the type of the elements of the array.
 java.lang.String getBaseTypeName()
          Implements Array interface method Returns the SQL type name of the elements in the array designated by this Array object.
 OracleConnection getConnection()
          Deprecated. since 9.0.0. Use getJavaSqlConnection() instead.
 ArrayDescriptor getDescriptor()
          Oracle extension.
 double[] getDoubleArray()
          Oracle extension.
 double[] getDoubleArray(long index, int count)
          Oracle extension.
 float[] getFloatArray()
          Oracle extension.
 float[] getFloatArray(long index, int count)
          Oracle extension.
 int[] getIntArray()
          Oracle extension.
 int[] getIntArray(long index, int count)
          Oracle extension.
 java.sql.Connection getJavaSqlConnection()
          Oracle extension Return the java.sql.Connection associated with the receiver.
 long[] getLongArray()
          Oracle extension.
 long[] getLongArray(long index, int count)
          Oracle extension.
 Datum[] getOracleArray()
          Oracle extension.
 Datum[] getOracleArray(long index, int count)
          Oracle extension.
 java.sql.ResultSet getResultSet()
          Implements Array interface method Returns a result set that contains the elements of the array designated by this Array object.
 java.sql.ResultSet getResultSet(long index, int count)
          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.
 java.sql.ResultSet getResultSet(long index, int count, java.util.Map map)
          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.
 java.sql.ResultSet getResultSet(java.util.Map map)
          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.
 short[] getShortArray()
          Oracle extension.
 short[] getShortArray(long index, int count)
           
 java.lang.String getSQLTypeName()
          Oracle extension.
 boolean isConvertibleTo(java.lang.Class jClass)
          Oracle extension.
 int length()
          Oracle extension.
 void setAutoBuffering(boolean enable)
          Performance hint.
 void setAutoIndexing(boolean enable)
          Performance hint.
 void setAutoIndexing(boolean enable, int direction)
          Performance hint.
 java.lang.Object toJdbc()
          Oracle extension.
 
Methods inherited from class oracle.sql.Datum
asciiStreamValue, bigDecimalValue, binaryStreamValue, booleanValue, byteValue, characterStreamValue, dateValue, doubleValue, equals, floatValue, getBytes, getLength, getStream, intValue, longValue, makeJdbcArray, setBytes, setShareBytes, shareBytes, stringValue, timestampValue, timeValue
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ACCESS_FORWARD

public static final int ACCESS_FORWARD

ACCESS_REVERSE

public static final int ACCESS_REVERSE

ACCESS_UNKNOWN

public static final int ACCESS_UNKNOWN
Constructor Detail

ARRAY

public ARRAY(ArrayDescriptor type,
             java.sql.Connection conn,
             java.lang.Object elements)
      throws java.sql.SQLException
Constructor.
Parameters:
descriptor - 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
Method Detail

getBaseTypeName

public java.lang.String getBaseTypeName()
                                 throws java.sql.SQLException
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 java.sql.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:
java.sql.SQLException - if an error occurs while attempting to access the type name

getBaseType

public int getBaseType()
                throws java.sql.SQLException
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 java.sql.Array
Returns:
the type code of the elements of the array.
See Also:
java.sql.Types, OracleTypes

getArray

public java.lang.Object getArray()
                          throws java.sql.SQLException
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 java.sql.Array
Returns:
a Java array containing the ordered elements of the SQL array designated by this object.

getArray

public java.lang.Object getArray(java.util.Map map)
                          throws java.sql.SQLException
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 java.sql.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.

getArray

public java.lang.Object getArray(long index,
                                 int count)
                          throws java.sql.SQLException
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 java.sql.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.

getArray

public java.lang.Object getArray(long index,
                                 int count,
                                 java.util.Map map)
                          throws java.sql.SQLException
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 java.sql.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.

getResultSet

public java.sql.ResultSet getResultSet()
                                throws java.sql.SQLException
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 java.sql.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:
java.sql.SQLException - if an error occurs while attempting to access the array

getResultSet

public java.sql.ResultSet getResultSet(java.util.Map map)
                                throws java.sql.SQLException
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 java.sql.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:
java.sql.SQLException - if an error occurs while attempting to access the array

getResultSet

public java.sql.ResultSet getResultSet(long index,
                                       int count)
                                throws java.sql.SQLException
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 java.sql.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:
java.sql.SQLException - if an error occurs while attempting to access the array

getResultSet

public java.sql.ResultSet getResultSet(long index,
                                       int count,
                                       java.util.Map map)
                                throws java.sql.SQLException
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 java.sql.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:
java.sql.SQLException - if an error occurs while attempting to access the array

getOracleArray

public Datum[] getOracleArray()
                       throws java.sql.SQLException
Oracle extension. Analogous to getArray except that it always returns an oracle.sql.XXX instead of whatever result.getObject would have returned.
Returns:
an array of Datum.

length

public int length()
           throws java.sql.SQLException
Oracle extension. Get array size.
Returns:
the number of elements in the array.

getOracleArray

public Datum[] getOracleArray(long index,
                              int count)
                       throws java.sql.SQLException
Oracle extension. Like getOracleArray, but returns a slice.
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

getSQLTypeName

public java.lang.String getSQLTypeName()
                                throws java.sql.SQLException
Oracle extension. Retrieves the SQL type name of the SQL structured type that this Struct object represents.
Throws:
java.sql.SQLException - if a database access error occurs

getDescriptor

public ArrayDescriptor getDescriptor()
                              throws java.sql.SQLException
Oracle extension. Return the ArrayDescriptor object that contains the type information.
Returns:
the type descriptor

getJavaSqlConnection

public java.sql.Connection getJavaSqlConnection()
                                         throws java.sql.SQLException
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.
Returns:
the connection
Throws:
java.sql.SQLException - if an error occurs
Since:
9.0.0

getConnection

public OracleConnection getConnection()
                               throws java.sql.SQLException
Deprecated. since 9.0.0. Use getJavaSqlConnection() instead.
Oracle extension. The OracleConnection object associated with the array.
Returns:
the connection if it is assignment compatible with oracle.jdbc.driver.OracleConnection
Throws:
java.sql.SQLException - if the connection is not assignment compatible

toJdbc

public java.lang.Object toJdbc()
                        throws java.sql.SQLException
Oracle extension. Returns the JDBC representation of the datum object
Returns:
an object containing the JDBC value
Throws:
java.sql.SQLException - if conversion to JDBC representation results in an error
Overrides:
toJdbc in class Datum

isConvertibleTo

public boolean isConvertibleTo(java.lang.Class jClass)
Oracle extension. Determines if datum object can be converted to a particular class
Parameters:
cls - Class to convert to
Returns:
true, if conversion to cls is permitted false, if conversion to cls is not permitted
Overrides:
isConvertibleTo in class Datum

getIntArray

public int[] getIntArray()
                  throws java.sql.SQLException
Oracle extension. Analogous to getArray except that it always returns a int[].
Returns:
an array of int.

getIntArray

public int[] getIntArray(long index,
                         int count)
                  throws java.sql.SQLException
Oracle extension. Like getIntArray, but returns a slice.
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

getDoubleArray

public double[] getDoubleArray()
                        throws java.sql.SQLException
Oracle extension. Analogous to getArray except that it always returns a double[].
Returns:
an array of double.

getDoubleArray

public double[] getDoubleArray(long index,
                               int count)
                        throws java.sql.SQLException
Oracle extension. Like getDoubleArray, but returns a slice.
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

getShortArray

public short[] getShortArray()
                      throws java.sql.SQLException
Oracle extension. Analogous to getArray except that it always returns a short[].
Returns:
an array of short.

getShortArray

public short[] getShortArray(long index,
                             int count)
                      throws java.sql.SQLException

getLongArray

public long[] getLongArray()
                    throws java.sql.SQLException
Oracle extension. Analogous to getArray except that it always returns a long[].
Returns:
an array of long.

getLongArray

public long[] getLongArray(long index,
                           int count)
                    throws java.sql.SQLException
Oracle extension. Like getLongArray, but returns a slice.
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

getFloatArray

public float[] getFloatArray()
                      throws java.sql.SQLException
Oracle extension. Analogous to getArray except that it always returns a float[].
Returns:
an array of float.

getFloatArray

public float[] getFloatArray(long index,
                             int count)
                      throws java.sql.SQLException
Oracle extension. Like getFloatArray, but returns a slice.
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

setAutoBuffering

public void setAutoBuffering(boolean enable)
                      throws java.sql.SQLException
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.
Parameters:
enable - - true enables auto-buffering; false disables auto-buffering
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
Since:
8.1.7
See Also:
setAutoBuffering(boolean)

setAutoIndexing

public void setAutoIndexing(boolean enable,
                            int direction)
                     throws java.sql.SQLException
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.
Parameters:
enable - - true enables auto-indexing; false disables auto-indexing
direction - - overwrite default access direction.
Since:
8.1.7

setAutoIndexing

public void setAutoIndexing(boolean enable)
                     throws java.sql.SQLException
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.
Parameters:
enable - - true enables auto-indexing; false disables auto-indexing
Since:
8.1.7

getAutoIndexing

public boolean getAutoIndexing()
                        throws java.sql.SQLException
Performance hint. Get the current auto-indexing state.
Returns:
the current state of auto-indexing
Since:
8.1.7
See Also:
oracle.sql.ARRAY#setAutoIndexinging(boolean), oracle.sql.ARRAY#setAutoIndexinging(boolean, int)

getAccessDirection

public int getAccessDirection()
                       throws java.sql.SQLException
Performance hint. Get the access direction value.
Returns:
the current access direction
Since:
8.1.7
See Also:
oracle.sql.ARRAY#setAutoIndexinging(boolean), oracle.sql.ARRAY#setAutoIndexinging(boolean, int)