Configuration Features
This section describes the way date-and-time values and numeric values are handled. It also discusses the array modes whereby Rogue Wave DB Link sends or fetches several rows at a time. The following items are described:
Date As String
Date-and-time related values can be sent and retrieved as strings. This entails a dependence on the RDBMS configuration parameters and LOCALE settings. The behavior with date-and-time column data types can be changed. The default behavior ensures compatibility with older versions, but the new behavior allows you to use objects to handle date-and-time values.
To turn off the default behavior for all
IldRequest objects created from a specific
IldDbms object or to set a specific
IldRequest object to handle date-and-time related values as objects, use the member function
IldIldBase::setStringDateUse, with its argument set to
IlFalse.
To find the current setting, use the member function
IldIldBase::useStringDate, which returns a Boolean value.
Both functions are inherited from the common base class
IldIldBase.
The error ILD_TYPE_MISMATCH is raised when an application tries to send or retrieve a date-and-time value as an object when the date as string feature is turned on. Likewise, the same error is raised if an application tries to send or retrieve a date-and-time value as a string —instead of as an object—when the date as string feature is turned off.
Numeric As String
Numeric data values (and decimal values when applicable) can be sent and retrieved as double values. However, this causes a loss in precision. The behavior with respect to exact numeric column data types can be changed.
The default behavior ensures compatibility with older versions, but you can change it to preserve exact precision for very large numbers by handling these values as strings.
To turn off the default behavior for all
IldRequest objects created from a specific
IldDbms object or to set a specific
IldRequest object to handle numeric values as strings, use the member function
IldIldBase::setStringNumericUse with its argument set to
IlTrue. To handle numeric values as numeric objects, use the member function with its argument set to
IlFalse, as shown below:
{
// Data selection using numeric objects
request->setStringNumericUse(IlFalse);
}
To find the current setting, use the member function
IldIldBase::useStringNumeric. It returns a Boolean value.
Both member functions are inherited from the common base class
IldIldBase. No error is raised if an application retrieves a numeric value as
double when the
numeric as string feature is turned on, but the returned value is irrelevant.
It is possible to bind a database numeric type variable as an Rogue Wave DB Link string variable. The conversion is handled silently.
Numeric As Object
The numeric as string feature has a drawback: since the application depends upon the current LOCALE, the fractional-part and thousands separators may change from one session to another.
To avoid that external dependency, Rogue Wave DB Link allows you to send and retrieve numeric and decimal values under object form. The class
IlNumeric is intended for that purpose.
To turn off the default behavior for all
IldRequest objects created from a specific
IldDbms object or to set a specific
IldRequest object to handle numeric values as objects, use the member function
IldIldBase::setNumericUse with its argument set to
IlTrue.
To find the current setting, use the member function
IldIldBase::useNumeric, which returns a Boolean value.
Both member functions are inherited from the common base class
IldIldBase.
To retrieve the numeric value of a select-list column in object form, use the function
IldRequest::getColNumericValue. The error
ILD_TYPE_MISMATCH is raised when this function is used and the
numeric as object feature has not been turned on. Conversely, it is also an error to try to retrieve the value in string form if the feature is turned on.
Array Bind
Array bind means that Rogue Wave DB Link sends several rows of parameter values each time a prepared query is executed.
To set the
array bind mode, pass the number of rows you want to be sent at a time.
This number can be set as a default value for all
IldRequest objects requested from one
IldDbms object but it can be changed for any particular instance of
IldRequest whenever needed.
To set the default value for all newly created
IldRequest objects, use the member function
IldDbms::setDefaultParamArraySize, passing it a positive integer value as its argument. The new value is set to all cursors requested after that setting, but it is not changed for cursors already held by the application. The current default array bind size can be retrieved using the function
IldDbms::getDefaultParamArraySize.
For RDBMS whose API does not support this feature, Rogue Wave DB Link emulates it. This is the case of Informix, which supports the array bind mode only for insert statements within a transaction.
Array Fetch
Array fetch means that Rogue Wave DB Link fetches several rows at a time from the current result set and buffer the returned values. This optimizes network traffic by reducing the number of messages exchanged between the client application and the database server.
To set the default value for all
IldRequest objects requested from an
IldDbms object, use the function
IldDbms::setDefaultColArraySize with a positive integer as its argument. The cursors already held by the application are not affected by the setting.
With ODBC, the array fetch feature is available only if the driver has level 2 compliance.
For RDBMS whose API does not support this feature, Rogue Wave DB Link emulates it, but with no optimization effect on the network load.
Version 5.8
Copyright © 2014, Rogue Wave Software, Inc. All Rights Reserved.