Column and Parameter Descriptors
This section presents application and implementation descriptors as implemented by DB Link. It is divided as follows:
Notion of Descriptors
CLI Definition
The CLI standard defines descriptors at implementation- and application- levels.
-
At implementation level —that is, from the database server point of view— the descriptors are called IRD (Implementation Row Descriptor) and IPD (Implementation Parameter Descriptor).
-
At application level, the descriptors are called ARD (Application Row Descriptor) and APD (Application Parameter Descriptor).
Likewise, DB Link also differentiates between implementation level and application level, but refers to row descriptors as column descriptors and uses the same classes for column and parameter descriptors.
Implementation Within DB Link
DB Link uses two classes to describe the properties of a column or parameter:
-
IldDescriptor: Declared in the file ildent.h, this class is used to describe a column or parameter type on the server side.
-
IldAppDescriptor: A subclass of IldDescriptor declared in the file ildtuple.h, this class is used to hold the type descriptor and the column or parameter values and indicators on the application side.
Implementation Descriptors
An instance of IldDescriptor holds the following information about the column or parameter. IldDescriptor Member Functions shows the corresponding member functions:
|
Use this Member Function |
To get |
|
IldDescriptor::getType |
DB Link type |
|
IldDescriptor::getSqlType |
SQL data type code |
|
IldDescriptor::getName |
Column name |
|
IldDescriptor::getSize |
Maximum data size (in bytes) |
|
IldDescriptor::getPrecision |
Precision (for columns of a numeric type) - 0 if irrelevant |
|
IldDescriptor::getScale |
Scale (for columns of a numeric type) - 0 if irrelevant |
|
IldDescriptor::getSqlTypeName |
SQL type name in the server |
|
IldDescriptor::isNullable |
Nullability flag |
|
IldDescriptor::getADTDescriptor |
Abstract type descriptor (for columns of DB Link type) - null otherwise |
Type Codes
SQL data type codes are defined as constants in the section Type Codes of the ildconst.h header file. Most of them have a name that is very similar to their CLI name but a few of them differ. The names are prefixed with IldSQL.
Their values are the ones defined in the CLI standard.
The CLI specification has been extended to negative values so as to provide support for all types of all supported RDBMSs.
Application Descriptors
An instance of IldAppDescriptor adds the following information to its base class IldDescriptor:
|
Information |
Member Function |
|
Size of one element in the value buffer (in bytes) |
|
|
Value buffer |
|
|
Indicator buffer |
In addition:
-
The member function isExtValue lets you know whether the value buffer was allocated by DB Link or is bound to some application memory space. This function returns IlFalse in the first case or IlTrue in the second.
-
The member function isExtNulls lets you know whether the null-indicator buffer was allocated by DB Link or is bound to some application memory space. This function returns IlFalse in the first case or IlTrue in the second.
Simple IldDescriptor objects exist only for user-defined data-type attribute descriptors of type IldADTDescriptor. All other accesses to descriptors return instances of derived classes:
-
The functions getColDescriptor and getParamDescriptor return instances of the derived class IldAppDescriptor.