DB-Library functions use the following type definitions. Use these when defining C program variables, particularly those in dbbind, dbaltbind, dbconvert, and dbdata.
typedef char DBCHAR; // char and text
typedef unsigned char DBBINARY; // binary and image
typedef unsigned char DBTINYINT; // 1-byte tinyint
typedef short DBSMALLINT; // 2-byte smallint
typedef unsigned short DBUSMALLINT; // Unsigned 2-byte integer
typedef long DBINT; // 4-byte int
typedef float DBFLT4; // 4-byte real
typedef double DBFLT8; // 8-byte float
typedef unsigned char DBBIT; // bit
typedef unsigned char DBBOOL; // Boolean
typedef long DBMONEY4; // 4-byte smallmoney
typedef struct dbmoney // 8-byte money
{
DBINT mnyhigh;
ULONG mnylow;
} DBMONEY;
typedef struct dbdatetime4 // 4-byte smalldatetime
{
USHORT numdays; // Days since Jan 1, 1900
USHORT nummins; // Minutes since midnight
} DBDATETIM4;
typedef struct dbdatetime // 8-byte datetime
{
DBINT dtdays; // Days since Jan 1, 1900
ULONG dttime; // 300ths of a second since midnight
} DBDATETIME;
#define MAXNUMERICLEN 16
typedef struct dbnumeric // Numeric (and decimal)
{
BYTE precision; // Precision
BYTE scale; // Scale
BYTE sign; // 1 = Positive, 0 = Negative
BYTE val[MAXNUMERICLEN]; // Padded little-endian value
} DBNUMERIC;
typedef DBNUMERIC DBDECIMAL; // Decimal
#define DBMAXCHAR 256
typedef struct dbvarychar // Pascal-type string
{
DBSMALLINT len; // Character count
DBCHAR str[DBMAXCHAR]; // Nonterminated string
} DBVARYCHAR;
typedef struct dbvarybin // Pascal-type byte array
{
DBSMALLINT len; // Byte count
BYTE array[DBMAXCHAR]; // Nonterminated array
} DBVARYBIN;