SQL/MX Programming Manual for C and COBOL (G06.24+, H06.03+)
Host Variables in C/C++ Programs
HP NonStop SQL/MX Programming Manual for C and COBOL—523627-004
3-9
Extended Host Variable Data Types and Generated
C Data Types
Extended Host Variable Data Types and Generated C Data Types
Table 3-4 on page 3-10 lists the embedded SQL/C host variable "a[100]" with all its
legal SQL/MX modifiers, the equivalent data types in NonStop SQL/MX, and the
translated C declarations. The assumed wchar_t size is 2 characters.
Table 3-2. Corresponding SQL, C Host Variable Data Types, and Translated C
Declarations for Float Data Types
SQL Data Type
C Host Variable
Data Type
Translated C
Declaration
REAL
FLOAT (1 to 22 bits)
float
* float (Tandem format)
FLOAT (23 to 54 bits)
DOUBLE PRECISION
double
*
double (Tandem format)
REAL float
**
float (IEEE format)
FLOAT (1 to 52 bits)
DOUBLE PRECISION
double
**
double (IEEE format)
* Tandem floating point is specified during compilation.
** IEEE floating point is specified during compilation.
Table 3-3. Corresponding SQL, C Host Variable Data Types, and Translated C
Declarations for Date-Time Data Types
SQL Data Type
C Host Variable
Data Type
Translated C
Declaration
DATE DATE
*
char [l + 1]
TIME (time-precision) TIME[(n)]
*
char [l + 1]
TIMESTAMP (timestamp-
precision)
TIMESTAMP[(n)]
*
char [l + 1]
INTERVAL {start-field TO
end-field | single-field
}
INTERVAL
[period1[(n)] |
SECOND [(n[,m])]]
[TO period2[(m)]]
**
char [l + 1]
* An extra character is generated for a null terminator. For DATE, the value of the length l is 10. For TIME(6), the
value of the length l is 15. For TIMESTAMP(6), the value of the length l is 26.
** The INTERVAL data type has an extra character for a null terminator. The sign is included in the length l.