Datatypes and symbolic constants for datatypes used by DB-Library.
#include <sybfront.h> #include <sybdb.h>
Table 2-35 lists the symbolic constants for server datatypes. dbconvert and dbwillconvert use these constants. In addition, the routines dbcoltype, dbalttype, and dbrettype will return one of these types.
Symbolic constant |
Represents |
---|---|
SYBDATETIME |
datetime type. |
SYBDATETIME4 |
4-byte datetime type. |
SYBMONEY4 |
4-byte money type. |
SYBMONEY |
money type. |
SYBFLT8 |
8-byte float type. |
SYBDECIMAL |
decimal type. |
SYBNUMERIC |
numeric type. |
SYBREAL |
4-byte float type. |
SYBINT4 |
4-byte integer. |
SYBINT2 |
2-byte integer. |
SYBINT1 |
1-byte integer. |
SYBIMAGE |
image type. |
SYBTEXT |
text type. |
SYBCHAR |
char type. |
SYBBIT |
bit type. |
SYBBINARY |
binary type. |
SYBBOUNDARY |
Security sensitivity_boundary type. Use DBCHAR as the type for program variables. |
SYBSENSITIVITY |
Security sensitivity type. Use DBCHAR as the type for program variables. |
See the Adaptive Server Enterprise Transact-SQL Users Guide.
Here is a list of C datatypes used by DB-Library functions. These types are useful for defining program variables, particularly variables used with dbbind, dbaltbind, dbconvert, and dbdatecrack.
/* char, text, boundary, and sensitivity types */
typedef char DBCHAR;
/* binary and image type */
typedef unsigned char DBBINARY;
/* 1-byte integer */
typedef unsigned char DBTINYINT;
/* 2-byte integer */
typedef short DBSMALLINT;
/ unsigned 2-byte integer */
typedef unsigned short DBUSMALLINT;
/* 4-byte integer */
typedef long DBINT;
/* 4-byte float type */
typedef float DBREAL;
typedef struct dbnumeric
{
char precision;
char scale;
unsigned char val[MAXNUMLEN];
} DBNUMERIC;
typedef DBNUMERIC DBDECIMAL;
/* 8-byte float type */
typedef double DBFLT8;
/* bit type */
typedef unsigned char DBBIT;
/* SUCCEED or FAIL */
typedef int RETCODE;
/* datetime type */
typedef struct datetime
{
/* number of days since 1/1/1900 */
long dtdays;
/* 300ths of a second since midnight */
unsigned long dttime;
} DBDATETIME;
/* 4-byte datetime type */
typedef struct datetime4
{
/* number of days since 1/1/1900 */
unsigned short numdays;
/* number of minutes since midnight */
unsigned short nummins;
} DBDATETIME4;
typedef struct dbdaterec
{
/* 1900 to the future */
long dateyear;
/* 0 - 11 */
long datemonth;
/* 1 - 31 */
long datedmonth;
/* 1 - 366 */
long datedyear;
/* 0 - 6 (day names depend on language */
long datedweek;
/* 0 - 23 */
long datehour;
/* 0 - 59 */
long dateminute;
/* 0 - 59 */
long datesecond;
/* 0 - 997 */
long datemsecond;
/* 0 - 127 -- NOTE: Currently unused.*/
long datetzone;
} DBDATEREC;
/* money type */
typedef struct money
{
long mnyhigh;
unsigned long mnylow;
} DBMONEY;
/* 4-byte money type */
typedef signed long DBMONEY4;
/* Pascal-type string */
typedef struct dbvarychar
{
/* character count */
DBSMALLINT len;
/* non-terminated string */
DBCHAR str[DBMAXCHAR];
} DBVARYCHAR;
/* Pascal-type binary array */
typedef struct dbvarybin
{
/* byte count */
DBSMALLINT len;
/* non-terminated array */
BYTE array[DBMAXCHAR];
} DBVARYBIN;
/* Used by DB-Library for indicator variables */
typedef DBSMALLINT DBINDICATOR;
The SYBBOUNDARY and SYBSENSITIVITY symbolic constants correspond to the program variable type DBCHAR.
dbaltbind, dbalttype, dbbind, dbcoltype, dbconvert, dbprtype, dbrettype, dbwillconvert, Options