Entering content frame

 Basic Data Types 

In the declare section, you can use the C/C++ basic data types to declare host variables. A corresponding MaxDB data type exists for each basic data type.

The precompiler performs the following tasks:

·        When the precompiler runs, it checks whether the memory of the host variables and the corresponding table column is large enough for the maximum possible value to be sent between the database instance and the application program. If this is not the case, the precompiler writes a warning in the precompiler log.

·        If necessary, the precompiler converts the data types at runtime.

The following table shows the corresponding MaxDB data types for the basic data types:

Description

C/C++ Data Type

MaxDB Data Type

Alphanumeric character

char

CHAR (1)

Character string with closing NULL byte

char*
char [n+1], n
£ 8000
char [n+1], n > 8000

CHAR (n)
VARCHAR (n)
LONG

Integer

[unsigned] int, short int, long int

SMALLINT, INTEGER (2 or 4 bytes), FIXED (5), FIXED (10)

Fixed point number

float, double

FIXED (n,m)

Floating point number

float
double

FLOAT (6)
FLOAT (15)

Date

char [9]

DATE

Time

char [9]

TIME

Timestamp with closing NULL byte

char [21]

TIMESTAMP

Boolean

All numeric data types (null or not null)

BOOLEAN

Byte

char [n], n  £  8000
char [n], n > 8000

[VAR]CHAR (n) BYTE
LONG BYTE

When you specify dates, times, and timestamps, stick to the correct date and time format.

 

Leaving content frame