com.orindasoft.pub
Class PlsqlIndexByTable2

java.lang.Object
  |
  +--com.orindasoft.pub.PlsqlIndexByTable2

public class PlsqlIndexByTable2
extends java.lang.Object

Holds state variables for PL/SQL Index By Table parameters

This class represents an Oracle PL/SQL Index By Table. In addition to the table data it also holds information about the data type of the elements in the table, their maximum length and the maximum number of elements this table can have after an update or retrieval. For this reason this class is always instantiated even for OUT parameters. As of Oracle 10g INDEX BY tables can have two types of parameters - Numbers or Strings. Parameter types can not be mixed within the same table. JDBCWizard converts other data types to numbers or strings.

Under normal circumstances JDBCWizard users will have no reason to use this class directly - the generated code will use it.


(c) Copyright 2003 - 2011 Orinda Software Ltd

Since:
Oracle 10g/5.0.2556
Version:
6.0
Author:
Orinda Software

Field Summary
static java.lang.String JAVA_DATE_TO_CHAR_MASK
          Date format mask used by Java for converting Timestamp to String
static java.lang.String ORACLE_DATE_TO_CHAR_MASK
          Date format mask used by Oracle for converting date to String
static java.lang.String ORACLE_TIMESTAMP_TO_CHAR_MASK
          Date format mask used by Oracle for converting timestamp to String
 
Constructor Summary
PlsqlIndexByTable2(int realDataTypeCode, int realDataTypePrecision)
          Contruct an empty INDEX BY table
 
Method Summary
 java.lang.Object[] getArray()
          Get the array data
 java.math.BigDecimal[] getArrayAsBigDecimal()
          Get the array data as java.math.BigDecimal[] This convenience method returns the contents of the array as an array of BigDecimal.
 double[] getArrayAsDouble(double nullToken)
          Get the array data as double[] This convenience method returns the contents of the array as an array of double.
 java.lang.Double[] getArrayAsDoubleObject()
          Get the array data as Double[] This convenience method returns the contents of the array as an array of BigDecimal.
 float[] getArrayAsFloat(float nullToken)
          Get the array data as float[] This convenience method returns the contents of the array as an array of float.
 java.lang.Float[] getArrayAsFloatObject()
          Get the array data as Float[] This convenience method returns the contents of the array as an array of BigDecimal.
 int[] getArrayAsInt(int nullToken)
          Get the array data as int[] This convenience method returns the contents of the array as an array of int.
 java.lang.Integer[] getArrayAsIntegerObject()
          Get the array data as Integer[] This convenience method returns the contents of the array as an array of BigDecimal.
 long[] getArrayAsLong(long nullToken)
          Get the array data as long[] This convenience method returns the contents of the array as an array of long.
 java.lang.Long[] getArrayAsLongObject()
          Get the array data as Long[] This convenience method returns the contents of the array as an array of BigDecimal.
 byte[][] getArrayAsRaw()
          Get the array data as byte[] This convenience method returns the contents of the array as an array of byte[].
 java.lang.String[] getArrayAsString()
          Get the array data as String[] This convenience method returns the contents of the array as an array of String.
 java.sql.Timestamp[] getArrayAsTimestamp()
          Get the array data as java.sql.Timestamp This convenience method returns the contents of the array as an array of java.sql.Timestamp.
 int getArrayLength()
          Get the length of the array
 int getDataTypeCode()
          Get the official OracleType code for the array.
 int getElementMaxCount()
          Get the maximum size this table can be after an update or retrieval.
 int getElementMaxLength()
          Get the maximum length of an element in the table
 int getRealDataTypeCode()
          Get the actual OracleType code for the array.
 void setArray(byte[][] newArray)
          Set the array data using byte[][] This convenience method returns sets the array using an array of byte[][]
 void setArray(double[] newArray)
          Set the array data using double[] This convenience method returns sets the array using an array of double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
 void setArray(java.lang.Double[] newArray)
          Set the array data using Double[] This convenience method returns sets the array using an array of Double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
 void setArray(float[] newArray)
          Set the array data using float[] This convenience method returns sets the array using an array of float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
 void setArray(java.lang.Float[] newArray)
          Set the array data using Float[] This convenience method returns sets the array using an array of Float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
 void setArray(int[] newArray)
          Set the array data using int[] This convenience method sets the array using an array of int[]
 void setArray(java.lang.Integer[] newArray)
          Set the array data using Integer[] This convenience method returns sets the array using an array of Integer[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
 void setArray(long[] newArray)
          Set the array data using long[] This convenience method returns sets the array using an array of long[]
 void setArray(java.lang.Long[] newArray)
          Set the array data using Long[] This convenience method returns sets the array using an array of Long[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
 void setArray(java.lang.Object[] newDataArray)
          Set the contents of the Array.
 void setArray(java.sql.Timestamp[] newArray)
          Set the array data using java.sql.Timestamp[] This convenience method returns sets the array using an array of java.sql.Timestamp[]
 void setDataType(int dataTypeCode)
          Set the official Oracle data type
 void setElementMaxCount(int elementMaxCount)
          Set the maximum size this table can be after an update or retrieval.
 void setElementMaxLength(int elementMaxLength)
          Set the maximum length of an element in the table
 void setRealDataType(int realDataTypeCode)
          Set the actual Oracle data type
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ORACLE_TIMESTAMP_TO_CHAR_MASK

public static final java.lang.String ORACLE_TIMESTAMP_TO_CHAR_MASK
Date format mask used by Oracle for converting timestamp to String

ORACLE_DATE_TO_CHAR_MASK

public static final java.lang.String ORACLE_DATE_TO_CHAR_MASK
Date format mask used by Oracle for converting date to String

JAVA_DATE_TO_CHAR_MASK

public static final java.lang.String JAVA_DATE_TO_CHAR_MASK
Date format mask used by Java for converting Timestamp to String
Constructor Detail

PlsqlIndexByTable2

public PlsqlIndexByTable2(int realDataTypeCode,
                          int realDataTypePrecision)
Contruct an empty INDEX BY table
Parameters:
int - realDataTypeCode One of oracle.jdbc.OracleTypes.NUMBER or oracle.jdbc.OracleTypes.VARCHAR
int - realDataTypePrecision How many decimal places of precision.
Method Detail

getDataTypeCode

public int getDataTypeCode()
Get the official OracleType code for the array.

getRealDataTypeCode

public int getRealDataTypeCode()
Get the actual OracleType code for the array.

setDataType

public void setDataType(int dataTypeCode)
Set the official Oracle data type

setRealDataType

public void setRealDataType(int realDataTypeCode)
Set the actual Oracle data type

setElementMaxLength

public void setElementMaxLength(int elementMaxLength)
Set the maximum length of an element in the table

getElementMaxLength

public int getElementMaxLength()
Get the maximum length of an element in the table

setElementMaxCount

public void setElementMaxCount(int elementMaxCount)
Set the maximum size this table can be after an update or retrieval. This is used to decide how big the output array should be.

getElementMaxCount

public int getElementMaxCount()
Get the maximum size this table can be after an update or retrieval.

setArray

public void setArray(java.lang.Object[] newDataArray)
Set the contents of the Array. This method assumes that the user is providing a 1 dimensional array of numbers or strings. The values of elementMaxCount and elementMaxLength are updated by this method. If you are passing in an array that will be appended and returned to you you should call setElementMaxCount and setElementMaxLength after calling setArray. 'null' is not an acceptable value for dataArray and will be turned into Object[0]. This is so that getArrayLength works reliably.
Parameters:
Object[] - dataArray
See Also:
PlsqlIndexByTable.setElementMaxCount(int), PlsqlIndexByTable.setElementMaxLength(int)

getArray

public java.lang.Object[] getArray()
Get the array data

getArrayAsInt

public int[] getArrayAsInt(int nullToken)
                    throws CSNumberFormatException
Get the array data as int[] This convenience method returns the contents of the array as an array of int. Because the array can have null elements and an 'int' can never be null you need to say how nulls should be treated.
Parameters:
int - nullToken The int you will use to represent null. e.g. Integer.MIN_VALUE
Returns:
int[] An array of numbers. If the array is empty you will get int[0] back.
Throws:
ClassCastException - if the array isn't of numbers.
CSNumberFormatException - if the array cant be turned into int.

setArray

public void setArray(int[] newArray)
Set the array data using int[] This convenience method sets the array using an array of int[]
Parameters:
int[] - newArray

setArray

public void setArray(java.lang.Integer[] newArray)
Set the array data using Integer[] This convenience method returns sets the array using an array of Integer[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
Parameters:
Integer[] - newArray

getArrayAsLong

public long[] getArrayAsLong(long nullToken)
                      throws CSNumberFormatException
Get the array data as long[] This convenience method returns the contents of the array as an array of long. Because the array can have null elements and a 'long' can never be null you need to say how nulls should be treated.
Parameters:
long - nullToken The long you will use to represent null. e.g. Long.MIN_VALUE
Returns:
long[] An array of numbers. If the array is empty you will get long[0] back.
Throws:
ClassCastException - if the array isn't of numbers.

setArray

public void setArray(long[] newArray)
Set the array data using long[] This convenience method returns sets the array using an array of long[]
Parameters:
long[] - newArray

setArray

public void setArray(java.lang.Long[] newArray)
Set the array data using Long[] This convenience method returns sets the array using an array of Long[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
Parameters:
Long[] - newArray

getArrayAsFloat

public float[] getArrayAsFloat(float nullToken)
                        throws CSNumberFormatException
Get the array data as float[] This convenience method returns the contents of the array as an array of float. Because the array can have null elements and a 'float' can never be null you need to say how nulls should be treated.
Parameters:
float - nullToken The float you will use to represent null. e.g. Float.MIN_VALUE
Returns:
float[] An array of numbers. If the array is empty you will get float[0] back.
Throws:
ClassCastException - if the array isn't of numbers.

setArray

public void setArray(float[] newArray)
Set the array data using float[] This convenience method returns sets the array using an array of float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
Parameters:
float[] - newArray

setArray

public void setArray(java.lang.Float[] newArray)
Set the array data using Float[] This convenience method returns sets the array using an array of Float[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
Parameters:
Float[] - newArray

getArrayAsDouble

public double[] getArrayAsDouble(double nullToken)
                          throws CSNumberFormatException
Get the array data as double[] This convenience method returns the contents of the array as an array of double. Because the array can have null elements and a 'double' can never be null you need to say how nulls should be treated.
Parameters:
double - nullToken The double you will use to represent null. e.g. Double.MIN_VALUE
Returns:
double[] An array of numbers. If the array is empty you will get double[0] back.
Throws:
ClassCastException - if the array isn't of numbers.

setArray

public void setArray(double[] newArray)
Set the array data using double[] This convenience method returns sets the array using an array of double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
Parameters:
double[] - newArray

setArray

public void setArray(java.lang.Double[] newArray)
Set the array data using Double[] This convenience method returns sets the array using an array of Double[] WARNING: The precision of the value actually stored is limited to what the underlying Oracle object expects, so if you pass 1.00003f into a NUMBER(4,2) the '3' will be lost
Parameters:
Double[] - newArray

getArrayAsString

public java.lang.String[] getArrayAsString()
Get the array data as String[] This convenience method returns the contents of the array as an array of String. Because the array can have null elements and an 'double' can never be null you need to say how nulls should be treated.
Returns:
String[] An array of Strings. If the array is empty you will get double[0] back.

getArrayAsBigDecimal

public java.math.BigDecimal[] getArrayAsBigDecimal()
                                            throws CSNumberFormatException
Get the array data as java.math.BigDecimal[] This convenience method returns the contents of the array as an array of BigDecimal.
Returns:
BigDecimal[] An array of BigDecimal
Throws:
CSException - if this isn't an array of numbers
Since:
JDBCWizard 4.0.2108

getArrayAsDoubleObject

public java.lang.Double[] getArrayAsDoubleObject()
                                          throws CSNumberFormatException
Get the array data as Double[] This convenience method returns the contents of the array as an array of BigDecimal.
Returns:
Double[] An array Double
Throws:
CSException - if this isn't an array of numbers
Since:
JDBCWizard 4.0.2108

getArrayAsFloatObject

public java.lang.Float[] getArrayAsFloatObject()
                                        throws CSNumberFormatException
Get the array data as Float[] This convenience method returns the contents of the array as an array of BigDecimal.
Returns:
Float[] An array of Float
Throws:
CSException - if this isn't an array of numbers
Since:
JDBCWizard 4.0.2108

getArrayAsIntegerObject

public java.lang.Integer[] getArrayAsIntegerObject()
                                            throws CSNumberFormatException
Get the array data as Integer[] This convenience method returns the contents of the array as an array of BigDecimal.
Returns:
Integer[] An array of Integer
Throws:
CSException - if this isn't an array of numbers
Since:
JDBCWizard 4.0.2108

getArrayAsLongObject

public java.lang.Long[] getArrayAsLongObject()
                                      throws CSNumberFormatException
Get the array data as Long[] This convenience method returns the contents of the array as an array of BigDecimal.
Returns:
Long[] An array of Long
Throws:
CSException - if this isn't an array of numbers
Since:
JDBCWizard 4.0.2108

getArrayAsTimestamp

public java.sql.Timestamp[] getArrayAsTimestamp()
                                         throws CSException
Get the array data as java.sql.Timestamp This convenience method returns the contents of the array as an array of java.sql.Timestamp.
Parameters:
java.sql.Timestamp - nullToken The java.sql.Timestamp you will use to represent null. e.g. java.sql.Timestamp.MIN_VALUE
Returns:
java.sql.Timestamp[] An array of numbers. If the array is empty you will get java.sql.Timestamp[0] back.
Throws:
ClassCastException - if the array isn't of Strings.

setArray

public void setArray(java.sql.Timestamp[] newArray)
              throws CSNoNanosAllowedException
Set the array data using java.sql.Timestamp[] This convenience method returns sets the array using an array of java.sql.Timestamp[]
Parameters:
java.sql.Timestamp[] - newArray
Throws:
CSNoNanosAllowedException - when nanoseconds provided for an Oracle DATE field

getArrayAsRaw

public byte[][] getArrayAsRaw()
Get the array data as byte[] This convenience method returns the contents of the array as an array of byte[].
Parameters:
byte[] - nullToken The byte[] you will use to represent null. e.g. byte[].MIN_VALUE
Returns:
byte[][] An array of numbers. If the array is empty you will get byte[][0] back.
Throws:
ClassCastException - if the array isn't of numbers.

setArray

public void setArray(byte[][] newArray)
Set the array data using byte[][] This convenience method returns sets the array using an array of byte[][]
Parameters:
byte[][] - newArray

getArrayLength

public int getArrayLength()
Get the length of the array


Copyright © Orinda Software Ltd 2011Logo