Embedded SQL declare section

This section contains all definitions of host variables. Note, that not all data types are allowed for a variable in this section.

Syntax:
         <embedded SQL declare section> ::=
                <embedded SQL begin declare> 
                  [ <embedded character set declaration>  ]
                  [ <host variable definition> ... ]
                <embedded SQL end declare> 

         <embedded character set declaration>  ::=
              SQL NAMES ARE <character set specification> 

         <embedded SQL begin declare>  ::=
              <SQL prefix>  BEGIN DECLARE SECTION [ <SQL terminator>  ]

         <embedded SQL end declare>  ::=
              <SQL prefix>  END DECLARE SECTION [ <SQL terminator>  ]

         <host variable definition>  ::=
                <Host Identifiers> ':' <Ada type specification>
                [ ':=' <Ada initial values> ';' ]

         <embedded variable name>  ::=
              ':' <host identifier> 

         <host identifier>  ::=
                <Ada host identifier> 

         <Host identifiers> ::= 
                <host identifier>
              | <host identifier> ',' <host identifiers>
   
         <Ada type specification>  ::=
                <Ada qualified type specification> 
              | <Ada unqualified type specification> 

         <Ada qualified type specification>  ::=
              'SQL_STANDARD.' <Ada unqualified type specification>

         <Ada unqualified type specification>  ::=
                CHAR 
                   [ CHARACTER SET [ IS ] <character set specification>  ]
                   '(' 1..<length>')'  
              | BIT '(' 1 .. <length> ')'
              | SMALLINT
              | INT
              | REAL
              | DOUBLE_PRECISION
              | SQLCODE_TYPE
              | SQLSTATE_TYPE
              | INDICATOR_TYPE
              | GNADE.<GNADE specific type>

   

Character set declaration is not supported. If the pedantic option (-pedantic) has been set, a warning will be issued and every thing will be skipped until the next semicolon.

Ada support host variable definitions in the scope of a subprogram. The current implementation of esql does not follow the scope of Ada. This will cause warning, that the type of a host variable is changed.

The translator will issue an Error if the -pedantic has been set if the type is not one of the ones listed above. If the -pedantic switch is not used only a warning is issued. The context clauses regarding the SQL_STANDARD and other packages has to be added to the source by the developer. The translator will add only those packages which are needed to interface with ODBC. The correctness of the identifier will not be checked by the translator except for lexical rules which are needed to parse the code. The Ada compiler has to verify the validity of the identifier.

Implementation Note: The Character set modifier is not supported. It is simply discarded and a warning is issued, that the construct is not supported.