7. Embedded SQL for Pascal : Dynamic Programming for Pascal : SQLVAR Array Usage : Pascal Variable Type Codes
 
Share this page                  
Pascal Variable Type Codes
The type codes shown in (see page SQLDA Record Usage in this chapter are the types that describe Ingres result fields or columns. For example, the SQL types date and money do not describe a program variable, but rather data types that are compatible with the Pascal character and numeric types. IISQ_LVCH_TYPE is SQL only character compatible too. When these types are returned by the describe statement, the type code must be a change to a compatible Pascal or ESQL/Pascal type.
The following table describes the type codes to use with Pascal variables that will be pointed at by the sqldata pointers.
Pascal Type
SQL Type Codes (sqltype)
SQL Length
(sqllen)
[byte] -128..127
30 (integer)
1
[word] -32768..32767
30 (integer)
2
Integer
30 (integer)
4
Real
31 (float)
4
Double
31 (float)
8
Packed array[1..LEN] of Char
20 (char)
LEN
Varying[LEN] of Char
21 (varchar)
LEN
Real
31 (float)
10
Nullable data types (those variables that are associated with a null indicator) are specified by assigning the negative of the type code to the sqltype component. If the type is negative, a null indicator must be pointed at by the sqlind component. The type of the null indicator must be a 2-byte integer (or the SQL-defined indicator type). For information on how to declare and use a null indicator variable in Pascal, see Pascal Variables and Data Types in this chapter.
Character data and the SQLDA have the exact same rules as character data in regular Embedded SQL statements. For details of character string processing in SQL, see Pascal Variables and Data Types in this chapter.