6. Embedded SQL for BASIC : Dynamic Programming for BASIC : SQLVAR Usage : SQLDA Type Codes
 
Share this page                  
SQLDA Type Codes
The following table lists the type codes to use with BASIC variables that are pointed at by the sqldata pointers.
BASIC Type
SQLType Code (sqltype)
SQL Length (sqllen)
byte
IISQ_INT_TYPE
1
word
IISQ_INT_TYPE
2
long
IISQ_INT_TYPE
4
real
IISQ_FLT_TYPE
4
double
IISQ_FLT_TYPE
8
string = LEN
IISQ_CHA_TYPE
LEN
string
IISQ_DEC_TYPE
10
As described in the section BASIC Variables and Data Types (see page BASIC Variables and Data Types), all other types are compatible with the above BASIC data types. For example, you can retrieve an SQL date into a string variable, while you can retrieve money into a double variable.
Nullable data types (those variables that are associated with a null indicator) are specified by assigning the negative of the type code to sqltype. If the type is negative, you must point at a null indicator by the sqlind variable. The type of the null indicator must be a 2-byte integer, a word variable. For information on how to declare and use a null indicator in BASIC, see BASIC Variables and Data Types (see page BASIC 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. Because string lengths must be assigned to sqllen before using the SQLDA, you cannot point at BASIC dynamic string variables (those declared without a length) if they have not yet been assigned any storage. For more details on character string processing in SQL, see BASIC Variables and Data Types (see page BASIC Variables and Data Types) in this chapter.