Was this helpful?
SQLDA Record Usage
The SQLDA (SQL Descriptor Area) is used to pass type and size information about an SQL statement, an Ingres form, or Ingres table field, between Ingres and your program.
In order to use the SQLDA, you should issue the include sqlda statement at the proper scope of the source file, from where the SQLDA will be referenced. The include sqlda statement generates a Pascal include directive to a file that defines the SQLDA record type. The file does not declare an SQLDA variable; your program must declare a variable of the specified type.
You can also code this record variable directly instead of using the include sqlda statement. You can choose any name for the record. The definition of the SQLDA (as specified in the include file) is:
                                    { Sizes }
    IISQ_MAX_COLS = 1024;           { Maximum number of columns }
    IISQ_DTE_LEN = 25;              { Date length }
                                    { Data type codes }
    IISQ_DTE_TYPE = 3;              { Date - Output }
    IISQ_MNY_TYPE = 5;              { Money - Output }
    IISQ_DEC_TYPE = 10;             { Decimal - Output)
    IISQ_CHA_TYPE = 20;             { Char - Input, Output }
    IISQ_VCH_TYPE = 21;             { Varchar - Input, Output }
    IISQ_INT_TYPE = 30;             { Integer - Input, Output }
    IISQ_FLT_TYPE = 31;             { Float - Input, Output }
    IISQ_TBL_TYPE = 52;             { Table field - Output }

    II_int2 = [word] -32768..32767; { 2-byte integer }
    IIsqlvar = record               { Single SQLVAR element }
        sqltype:     II_int2;
        sqllen:      II_int2;
        sqldata:     Integer;       { Address of any type }
        sqlind:      Integer;       { Address of 2-byte integer }
        sqlname:     Varying[34] of Char;

IIsqlda = record             { Full SQLDA definition }
        sqldaid:   packed array[1..8] of Char;
        sqldabc:   Integer;
        sqln:      II_int2;
        sqld:      II_int2;
        sqlvar:    array[1..IISQ_MAX_COLS] of IIsqlvar;
Record Definition and Usage Notes:
The record type definition of the SQLDA is called IISQLDA. This is done so that an SQLDA variable can be called "SQLDA" without causing a Pascal compile-time conflict.
The sqlvar array is an array of IISQ_MAX_COLS (1024) elements. If an SQLDA record variable of type IISQLDA is declared, then the program will have a record with IISQ_MAX_COLS elements.
Note that the sqlvar array begins at subscript 1.
The sqldata and sqlind record components are declared as 4-byte integers. These integers actually contain addresses and must be set to point at other global or dynamically allocated variables using the address or iaddress built-in Pascal functions.
If your program defines its own SQLDA type, you must verify that the internal record layout is identical to that of the IISQLDA record type, although you can declare a different number of sqlvar elements.
The sqlname component is a varying length character string consisting of a length and data area. This varying length name contains the name of a result field or column after a describe (or prepare into) statement. The length of the name is implicit with varying length data type. The varying length name can also be set by the program using Dynamic FRS.
The list of type codes represents the types that will be returned by the describe statement, and the types used by the program when retrieving or setting data using an SQLDA. The type code IISQ_TBL_TYPE indicates a table field and is set by the FRS when describing a form that contains a table field.
Last modified date: 06/10/2024