Was this helpful?
SQLDA Structure Usage
You use the SQLDA (SQL Descriptor Area) to pass type and size information about an SQL statement, an Ingres form, or an Ingres table field, between Ingres and your program.
To use the SQLDA, issue the include sqlda statement in each subprogram of your source file that references the SQLDA. The include sqlda statement generates a Fortran include directive to a file that defines the SQLDA structure type. The file does not declare an SQLDA variable; your program must declare a variable of the specified type. You can also code this structure variable directly instead of using the include sqlda statement. You can choose any name for the structure.
The definition of the SQLDA (as specified in the include file) is:
Linux:
C
C Single element of SQLDA variable
C
          structure /IISQLVAR/
                    integer*2     sqltype
                    integer*2     sqllen
                    integer*4     sqldata
                    integer*4     sqlind
                    structure /IISQLNAME/ sqlname
                        integer*2             sqlname1
                        character*34          sqlnamec
                    end structure
          end structure
C
C Maximum number of columns returned from Ingres
C
          parameter (IISQ_MAX_COLS = 1024)


C IISQLDA - SQLDA with maximum number of entries 
C for variables.
C
          structure /IISQLDA/
                    character*8 sqldaid
                    integer*4   sqldabc
                    integer*2   sqln
                    integer*2   sqld
                    record /IISQLVAR/ sqlvar(IISQ_MAX_COLS)
          end structure
    structure /IISQLHDLR/
C     Optional argument to pass through
            integer*4   sqlarg
C     user-defined datahandler function
            integer*4   sqlhdlr
    end structure


C Allocation sizes
C
          parameter (IISQDA_HEAD_SIZE = 16,
   1                   IISQDA_VAR_SIZE = 48)
C
C Type and length codes
C
C
          parameter (IISQ_DTE_TYPE = 3, 
   1      IISQ_MNY_TYPE  = 5,
   2      IISQ_DEC_TYPE  = 10,  
   3      IISQ_CHA_TYPE  = 20, 
   4      IISQ_VCH_TYPE  = 21, 
   5      IISQ_LVCH_TYPE = 22,
   6      IISQ_INT_TYPE  = 30, 
   7      IISQ_FLT_TYPE  = 31, 
   8      IISQ_OBJ_TYPE  = 45,
   9      IISQ_HDLR_TYPE = 46,
   1      IISQ_TBL_TYPE  = 52, 
   2      IISQ_DTE_LEN   = 25)
    parameter (IISQ_LVCH_TYPE = 22,
   1          IISQ_HDLR_TYPE = 46) 
Windows:
    structure /IISQLVAR/
        integer*2    sqltype
        integer*2     sqllen
        integer*4    sqldata        ! Address of any type
        integer*4    sqlind        ! Address of 2-byte integer
        structure /IISQLNAME/ sqlname
            integer*2       sqlnamel
            character*34  sqlnamec
        end structure
    end structure
C
C IISQ_MAX_COLS - Maximum number of columns returned from INGRES
C
    parameter IISQ_MAX_COLS = 1024

C
C IISQLDA - SQLDA with maximum number of entries for variables.
C
    structure /IISQLDA/
        character*8        sqldaid
        integer*4        sqldabc
        integer*2        sqln
        integer*2        sqld
        record /IISQLVAR/     sqlvar(IISQ_MAX_COLS)
    end structure
C
C IISQLHDLR - Structure type with function pointer and function argument
C          for the DATAHANDLER.
C
    structure /IISQLHDLR/
        integer*4        sqlarg
        integer*4        sqlhdlr
    end structure

C
C Allocation sizes - When allocating an SQLDA for the size use:
C        IISQDA_HEAD_SIZE + (N * IISQDA_VAR_SIZE)
C
    parameter IISQDA_HEAD_SIZE = 16,
    1      IISQDA_VAR_SIZE  = 48

C
C Type and Length Codes
C
    parameter IISQ_DTE_TYPE = 3,    ! Date - Output
    1      IISQ_MNY_TYPE = 5,    ! Money - Output
    2      IISQ_DEC_TYPE = 10,    ! Decimal - Output
    3      IISQ_CHA_TYPE    = 20,    ! Char - Input, Output
    4      IISQ_VCH_TYPE    = 21,    ! Varchar - Input, Output
    5      IISQ_INT_TYPE    = 30,    ! Integer - Input, Output
    6      IISQ_FLT_TYPE = 31,    ! Float - Input, Output
    7      IISQ_TBL_TYPE = 52,    ! Table field - Output
    8      IISQ_DTE_LEN  = 25    ! Date length
    parameter IISQ_LVCH_TYPE = 22    ! Long varchar
    parameter IISQ_LBIT_TYPE = 16    ! Long bit
    parameter IISQ_HDLR_TYPE = 46    ! Datahandler
    parameter IISQ_BYTE_TYPE = 23    ! Byte - Input, Output
    parameter IISQ_VBYTE_TYPE = 24    ! Byte Varying - Input, Output
    parameter IISQ_LBYTE_TYPE = 25    ! Long Byte - Output
    parameter IISQ_OBJ_TYPE = 45        ! Object - Output
Structure Definition and Usage Notes:
The structure type definition of the SQLDA is called IISQLDA. This is done so that an SQLDA variable may be called "SQLDA" without causing a compile-time conflict.
The sqlvar array is an array of IISQ_MAX_COLS (1024) elements. If a variable of type IISQLDA is declared, the program will have a variable of IISQ_MAX_COLS elements.
The sqlvar array begins at subscript 1.
If your program defines its own SQLDA type, you must confirm that the structure layout is identical to that of the IISQLDA structure type, although you can declare a different number of sqlvar elements.
The nested structure sqlname is a varying length character string consisting of a length and data area. The sqlnamec field contains the name of a result field or column after the describe (or prepare into) statement. The length of the name is specified by sqlnamel. The characters in the sqlnamec field are blank padded. The sqlname structure can also be set by a program using Dynamic FRS. The program is not required to pad sqlname with blanks. see How to Set SQLNAME for Dynamic FRS in this chapter.
The list of type codes represents the types that are returned by the describe statement, and the types used by the program when using an SQLDA to retrieve or set data. 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: 11/09/2022