Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef __SQLTYPES
      7 #define __SQLTYPES
      8 
      9 #ifndef ODBCVER
     10 #define ODBCVER 0x0351
     11 #endif
     12 
     13 #ifdef __cplusplus
     14 extern "C" {
     15 #endif
     16 
     17 #ifndef EXPORT
     18 #define EXPORT
     19 #endif
     20 
     21 #define SQL_API __stdcall
     22 
     23 #ifndef RC_INVOKED
     24 
     25   typedef unsigned char SQLCHAR;
     26 #if (ODBCVER >= 0x0300)
     27   typedef signed char SQLSCHAR;
     28   typedef unsigned char SQLDATE;
     29   typedef unsigned char SQLDECIMAL;
     30   typedef double SQLDOUBLE;
     31   typedef double SQLFLOAT;
     32 #endif
     33   typedef __LONG32 SQLINTEGER;
     34   typedef unsigned __LONG32 SQLUINTEGER;
     35 
     36 #ifdef _WIN64
     37   typedef INT64 SQLLEN;
     38   typedef UINT64 SQLULEN;
     39   typedef UINT64 SQLSETPOSIROW;
     40 #else
     41 #define SQLLEN SQLINTEGER
     42 #define SQLULEN SQLUINTEGER
     43 #define SQLSETPOSIROW SQLUSMALLINT
     44 #endif
     45 
     46   typedef SQLULEN SQLROWCOUNT;
     47   typedef SQLULEN SQLROWSETSIZE;
     48   typedef SQLULEN SQLTRANSID;
     49   typedef SQLLEN SQLROWOFFSET;
     50 
     51 #if (ODBCVER >= 0x0300)
     52   typedef unsigned char SQLNUMERIC;
     53 #endif
     54   typedef void *SQLPOINTER;
     55 #if (ODBCVER >= 0x0300)
     56   typedef float SQLREAL;
     57 #endif
     58   typedef short SQLSMALLINT;
     59   typedef unsigned short SQLUSMALLINT;
     60 #if (ODBCVER >= 0x0300)
     61   typedef unsigned char SQLTIME;
     62   typedef unsigned char SQLTIMESTAMP;
     63   typedef unsigned char SQLVARCHAR;
     64 #endif
     65 
     66   typedef SQLSMALLINT SQLRETURN;
     67 
     68 #if (ODBCVER >= 0x0300)
     69   typedef void *SQLHANDLE;
     70   typedef SQLHANDLE SQLHENV;
     71   typedef SQLHANDLE SQLHDBC;
     72   typedef SQLHANDLE SQLHSTMT;
     73   typedef SQLHANDLE SQLHDESC;
     74 #else
     75   typedef void *SQLHENV;
     76   typedef void *SQLHDBC;
     77   typedef void *SQLHSTMT;
     78 #endif
     79 
     80 #ifndef BASETYPES
     81 #define BASETYPES
     82   typedef unsigned __LONG32 ULONG;
     83   typedef ULONG *PULONG;
     84   typedef unsigned short USHORT;
     85   typedef USHORT *PUSHORT;
     86   typedef unsigned char UCHAR;
     87   typedef UCHAR *PUCHAR;
     88   typedef char *PSZ;
     89 #endif
     90 
     91   typedef signed char SCHAR;
     92 #if (ODBCVER < 0x0300)
     93   typedef SCHAR SQLSCHAR;
     94 #endif
     95   typedef __LONG32 SDWORD;
     96   typedef short int SWORD;
     97   typedef unsigned __LONG32 UDWORD;
     98   typedef unsigned short int UWORD;
     99 
    100   typedef signed __LONG32 SLONG;
    101   typedef signed short SSHORT;
    102   typedef double SDOUBLE;
    103   typedef double LDOUBLE;
    104   typedef float SFLOAT;
    105   typedef void *PTR;
    106   typedef void *HENV;
    107   typedef void *HDBC;
    108   typedef void *HSTMT;
    109   typedef signed short RETCODE;
    110   typedef HWND SQLHWND;
    111 
    112 #ifndef __SQLDATE
    113 #define __SQLDATE
    114 
    115   typedef struct tagDATE_STRUCT {
    116     SQLSMALLINT year;
    117     SQLUSMALLINT month;
    118     SQLUSMALLINT day;
    119   } DATE_STRUCT;
    120 
    121 #if (ODBCVER >= 0x0300)
    122   typedef DATE_STRUCT SQL_DATE_STRUCT;
    123 #endif
    124 
    125   typedef struct tagTIME_STRUCT {
    126     SQLUSMALLINT hour;
    127     SQLUSMALLINT minute;
    128     SQLUSMALLINT second;
    129   } TIME_STRUCT;
    130 
    131 #if (ODBCVER >= 0x0300)
    132   typedef TIME_STRUCT SQL_TIME_STRUCT;
    133 #endif
    134 
    135   typedef struct tagTIMESTAMP_STRUCT {
    136     SQLSMALLINT year;
    137     SQLUSMALLINT month;
    138     SQLUSMALLINT day;
    139     SQLUSMALLINT hour;
    140     SQLUSMALLINT minute;
    141     SQLUSMALLINT second;
    142     SQLUINTEGER fraction;
    143   } TIMESTAMP_STRUCT;
    144 
    145 #if (ODBCVER >= 0x0300)
    146   typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
    147 #endif
    148 
    149 #if (ODBCVER >= 0x0300)
    150   typedef enum {
    151     SQL_IS_YEAR = 1,SQL_IS_MONTH = 2,SQL_IS_DAY = 3,SQL_IS_HOUR = 4,SQL_IS_MINUTE = 5,SQL_IS_SECOND = 6,SQL_IS_YEAR_TO_MONTH = 7,
    152     SQL_IS_DAY_TO_HOUR = 8,SQL_IS_DAY_TO_MINUTE = 9,SQL_IS_DAY_TO_SECOND = 10,SQL_IS_HOUR_TO_MINUTE = 11,SQL_IS_HOUR_TO_SECOND = 12,
    153     SQL_IS_MINUTE_TO_SECOND = 13
    154   } SQLINTERVAL;
    155 #endif
    156 
    157 #if (ODBCVER >= 0x0300)
    158   typedef struct tagSQL_YEAR_MONTH {
    159     SQLUINTEGER year;
    160     SQLUINTEGER month;
    161   } SQL_YEAR_MONTH_STRUCT;
    162 
    163   typedef struct tagSQL_DAY_SECOND {
    164     SQLUINTEGER day;
    165     SQLUINTEGER hour;
    166     SQLUINTEGER minute;
    167     SQLUINTEGER second;
    168     SQLUINTEGER fraction;
    169   } SQL_DAY_SECOND_STRUCT;
    170 
    171   typedef struct tagSQL_INTERVAL_STRUCT {
    172     SQLINTERVAL interval_type;
    173     SQLSMALLINT interval_sign;
    174     union {
    175       SQL_YEAR_MONTH_STRUCT year_month;
    176       SQL_DAY_SECOND_STRUCT day_second;
    177     } intval;
    178   } SQL_INTERVAL_STRUCT;
    179 #endif
    180 #endif
    181 
    182 #if (ODBCVER >= 0x0300)
    183 #define ODBCINT64 /* __MINGW_EXTENSION */ __int64
    184   __MINGW_EXTENSION typedef ODBCINT64 SQLBIGINT;
    185   __MINGW_EXTENSION typedef unsigned ODBCINT64 SQLUBIGINT;
    186 #endif
    187 
    188 #if (ODBCVER >= 0x0300)
    189 #define SQL_MAX_NUMERIC_LEN 16
    190   typedef struct tagSQL_NUMERIC_STRUCT {
    191     SQLCHAR precision;
    192     SQLSCHAR scale;
    193     SQLCHAR sign;
    194     SQLCHAR val[SQL_MAX_NUMERIC_LEN];
    195   } SQL_NUMERIC_STRUCT;
    196 #endif
    197 
    198 #if (ODBCVER >= 0x0350)
    199 #ifdef GUID_DEFINED
    200   typedef GUID SQLGUID;
    201 #else
    202 
    203   typedef struct tagSQLGUID {
    204     DWORD Data1;
    205     WORD Data2;
    206     WORD Data3;
    207     BYTE Data4[8 ];
    208   } SQLGUID;
    209 #endif
    210 #endif
    211 
    212   typedef SQLULEN BOOKMARK;
    213 
    214 #ifdef _WCHAR_T_DEFINED
    215   typedef wchar_t SQLWCHAR;
    216 #else
    217   typedef unsigned short SQLWCHAR;
    218 #endif
    219 
    220 #if defined(UNICODE)
    221   typedef SQLWCHAR SQLTCHAR;
    222 #else
    223   typedef SQLCHAR SQLTCHAR;
    224 #endif
    225 #endif
    226 
    227 #ifdef __cplusplus
    228 }
    229 #endif
    230 #endif
    231