Server Reference Guide : Java Interface : Java Classes : com.ca.openroad.ParameterData
 
Share this page          
com.ca.openroad.ParameterData
The Java ParameterData class wraps a corresponding instance of the OpenROAD.ParameterData COM class. This class has the following characteristics:
All methods are synchronized and final.
All methods throw COMException, except the release method.
The default constructor takes no arguments and creates an empty underlying COM PDO with no defined attributes.
An optional convenience constructor takes a string of attribute declarations and implicitly does the declareAttr calls. The declaration string is simply a whitespace-delimited list of attrName attrType pairs. For human readability, "=" and ";" characters are also treated as whitespace.
Because Java is a strongly-typed language, the generic SetAttribute and GetAttribute methods of the COM ParameterData class are impractical. Instead, Ingres provides a collection of type-specific accessor methods.
Clients must explicitly call “release” on every OpenROAD Java object instance they create. Otherwise, the underlying COM resources may not get freed. This is why the example code shows the release calls in the "finally" block, to ensure that they will be executed even in case an exception is thrown.
Java ParameterData Accessor Methods
All the Java ParameterData accessor methods attempt to convert between the method signature type and the declared type of the specified ParameterData attribute. Despite this, we recommend that attributes be accessed using the Java method that is a best match for the declared attribute. For example, we recommend the following pairings:
ATTRTYPE
Recommended Accessor Methods
STRING
getString/setString
INTEGER
getInt/setInt (or getInteger/setInteger)
LONG
getLong/setLong (or getLongint/setLongint)
SMALLINT
getInt/setInt (or getInteger/setInteger)
FLOAT
getDbl/setDbl (or getDouble/setDouble)
DECIMAL
getBigDecimal/setBigDecimal
MONEY
getBigDecimal/setBigDecimal
DATE
getDate/setDate/setDateWithoutTime
BINARY
getByteArray/setByteArray
Notes:
ParameterData data values, except for primitive integer or double scalars, are represented in Java as Java object instances. For example, String, Integer, Double, Date, BigDecimal, and Byte array.
Null object references correspond to NULL 4GL data values.
You can use the null object references as a convenient alternative to the setNull and isNull methods.
The full range of Ingres MONEY values (-999,999,999,999,999 to +999,999,999,999.99) is supported.
The maximum precision and scale of the COM DECIMAL type is 28. Therefore, although the Ingres DECIMAL type supports up to 31 digits of precision or scale, only 28 digits can be used effectively.
getBigDecimal
Because of the idiosyncrasies of COM DECIMAL conversions, the values returned by getBigDecimal have variable scale. That is, trailing zeros after the decimal point are always truncated and not reflected in the scale of the BigDecimal instance returned.
To ensure a more consistent handling of scale, Ingres provides an overloaded getBigDecimal method. This method takes an additional integer parameter (between 0 and 28) that specifies the desired minimum scale of the BigDecimal result. This parameter represents only the minimum scale, and the result is zero-padded to achieve at least that requested scale. If a value already contains non-zero digits beyond the requested minimum scale, they will not be truncated.
If you want to reduce the scale for a particular application, you can use the Java BigDecimal methods that provide options to apply whatever type of rounding or truncation you want.
The following table describes COM PDO wrappers:
Wrappers
Description
void release(); // does not throw
Releases the underlying COM PDO instance. After the release method is called, the Java object instance becomes essentially useless and should be discarded.
void declareAttr(String attrName, String attrType);
Wraps the DeclareAttribute method of the underlying COM PDO
void setString(String attrName, String attrValue);
void setInteger(String attrName, Integer attrValue);
void setDouble(String attrName, Double attrValue);
void setBigDecimal(String attrName, BigDecimal attrValue);
void setByteArray(String attrName, byte[] attrValue);
void setDate(String attrName, Date attrValue)
void setInt(String attrName, int attrValue);
void setDbl(String attrName, double attrValue);
void setLongint(String attrName, long attrValue);
void setLong(String attrName, long attrValue);
Wrap the SetAttribute method of the COM PDO, with implied conversion of the input type
String getString(String attrName);
Integer getInteger(String attrName);
Double getDouble(String attrName);
BigDecicmal getBigDecimal(String attrName);
BigDecicmal getBigDecimal(String attrName, int minScale);
byte[] getByteArray(String attrName);
Date getDate(String attrName)
int getInt(String attrName);
double getDbl(String attrName);
long getLongint(String attrName);
long getLong(String attrName);
Wrap the GetAttribute method of the COM PDO, and attempt to convert the result into the requested return type
int lastRow(String attrName);
Wraps the LastRow method of the underlying COM PDO
void setEmpty(String attrName);
void setNull(String attrName);
void setBlankDate(String attrName);
void setDateWithoutTime(String attrName, Date attrValue);
Wrap the SetEmpty, SetNull, SetBlankDate, and SetDateWithoutTime methods of the COM PDO
boolean isEmpty(String attrName);
boolean isNull(String attrName);
boolean isBlankDate(String attrName);
boolean isDateWithoutTime(String attrName);
Wrap the IsEmpty, IsNull, IsBlankDate, and IsDateWithoutTime methods of the COM PDO, and convert the result from an integer to a Boolean