xref: /reactos/sdk/include/psdk/sqltypes.h (revision c2c66aff)
1 #ifndef __SQLTYPES
2 #define __SQLTYPES
3 
4 #ifdef __cplusplus
5 extern "C" {
6 #endif
7 
8 #define SQL_API __stdcall
9 
10 #ifndef RC_INVOKED
11 #define __need_wchar_t
12 #include <stddef.h>
13 
14 typedef signed char SCHAR;
15 typedef long SDWORD;
16 typedef short SWORD;
17 typedef ULONG UDWORD;
18 typedef USHORT UWORD;
19 typedef signed long SLONG;
20 typedef signed short SSHORT;
21 typedef double SDOUBLE;
22 typedef double LDOUBLE;
23 typedef float SFLOAT;
24 typedef PVOID PTR;
25 typedef PVOID HENV;
26 typedef PVOID HDBC;
27 typedef PVOID HSTMT;
28 typedef short RETCODE;
29 typedef UCHAR SQLCHAR;
30 typedef SDWORD SQLINTEGER;
31 typedef SWORD SQLSMALLINT;
32 typedef UDWORD SQLUINTEGER;
33 typedef UWORD SQLUSMALLINT;
34 typedef PVOID SQLPOINTER;
35 typedef void* SQLHENV;
36 typedef void* SQLHDBC;
37 typedef void* SQLHSTMT;
38 typedef SQLSMALLINT SQLRETURN;
39 typedef HWND SQLHWND;
40 
41 #ifdef _WIN64
42 typedef INT64 SQLLEN;
43 typedef UINT64 SQLULEN;
44 typedef UINT64 SQLSETPOSIROW;
45 #else
46 #define SQLLEN SQLINTEGER
47 #define SQLULEN SQLUINTEGER
48 #define SQLSETPOSIROW SQLUSMALLINT
49 #endif /* _WIN64 */
50 
51 typedef SQLULEN BOOKMARK;
52 typedef SQLLEN SQLROWOFFSET;
53 typedef SQLULEN SQLROWCOUNT;
54 typedef SQLULEN SQLTRANSID;
55 
56 typedef wchar_t SQLWCHAR;
57 #ifdef UNICODE
58 typedef SQLWCHAR        SQLTCHAR;
59 #else
60 typedef SQLCHAR         SQLTCHAR;
61 #endif  /* UNICODE */
62 
63 typedef struct tagDATE_STRUCT {
64 	SQLSMALLINT year;
65 	SQLUSMALLINT month;
66 	SQLUSMALLINT day;
67 } DATE_STRUCT;
68 typedef struct tagTIME_STRUCT {
69 	SQLUSMALLINT hour;
70 	SQLUSMALLINT minute;
71 	SQLUSMALLINT second;
72 } TIME_STRUCT;
73 typedef struct tagTIMESTAMP_STRUCT {
74 	SQLSMALLINT year;
75 	SQLUSMALLINT month;
76 	SQLUSMALLINT day;
77 	SQLUSMALLINT hour;
78 	SQLUSMALLINT minute;
79 	SQLUSMALLINT second;
80 	SQLUINTEGER fraction;
81 } TIMESTAMP_STRUCT;
82 
83 #if (ODBCVER >= 0x0300)
84 typedef SCHAR SQLSCHAR;
85 typedef void* SQLHANDLE;
86 typedef void* SQLHDESC;
87 typedef unsigned char   SQLDATE;
88 typedef unsigned char   SQLDECIMAL;
89 typedef double          SQLDOUBLE;
90 typedef double          SQLFLOAT;
91 typedef unsigned char   SQLNUMERIC;
92 typedef float           SQLREAL;
93 typedef unsigned char   SQLTIME;
94 typedef unsigned char   SQLTIMESTAMP;
95 typedef unsigned char   SQLVARCHAR;
96 #define ODBCINT64	__int64
97 typedef __int64 SQLBIGINT;
98 typedef unsigned __int64 SQLUBIGINT;
99 typedef DATE_STRUCT	SQL_DATE_STRUCT;
100 typedef TIME_STRUCT	SQL_TIME_STRUCT;
101 typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
102 typedef enum {
103 	SQL_IS_YEAR = 1,SQL_IS_MONTH,SQL_IS_DAY,SQL_IS_HOUR,
104 	SQL_IS_MINUTE,SQL_IS_SECOND,SQL_IS_YEAR_TO_MONTH,SQL_IS_DAY_TO_HOUR,
105 	SQL_IS_DAY_TO_MINUTE,SQL_IS_DAY_TO_SECOND,SQL_IS_HOUR_TO_MINUTE,
106 	SQL_IS_HOUR_TO_SECOND,SQL_IS_MINUTE_TO_SECOND
107 } SQLINTERVAL;
108 typedef struct tagSQL_YEAR_MONTH {
109 	SQLUINTEGER year;
110 	SQLUINTEGER month;
111 } SQL_YEAR_MONTH_STRUCT;
112 typedef struct tagSQL_DAY_SECOND {
113 	SQLUINTEGER day;
114 	SQLUINTEGER	hour;
115 	SQLUINTEGER minute;
116 	SQLUINTEGER second;
117 	SQLUINTEGER fraction;
118 } SQL_DAY_SECOND_STRUCT;
119 typedef struct tagSQL_INTERVAL_STRUCT {
120 	SQLINTERVAL interval_type;
121 	SQLSMALLINT interval_sign;
122 	union {
123 		SQL_YEAR_MONTH_STRUCT year_month;
124 		SQL_DAY_SECOND_STRUCT day_second;
125 	} intval;
126 } SQL_INTERVAL_STRUCT;
127 #define SQL_MAX_NUMERIC_LEN 16
128 typedef struct tagSQL_NUMERIC_STRUCT {
129 	SQLCHAR precision;
130 	SQLSCHAR scale;
131 	SQLCHAR sign;
132 	SQLCHAR val[SQL_MAX_NUMERIC_LEN];
133 } SQL_NUMERIC_STRUCT;
134 #endif  /* ODBCVER >= 0x0300 */
135 
136 #if (ODBCVER >= 0x0350)
137 
138 #ifdef _GUID_DEFINED
139 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
140 #endif
141 
142 #if defined _GUID_DEFINED || defined GUID_DEFINED
143 typedef GUID SQLGUID;
144 #else
145 typedef struct tagSQLGUID{
146     DWORD Data1;
147     WORD Data2;
148     WORD Data3;
149     BYTE Data4[ 8 ];
150 } SQLGUID;
151 #endif  /* GUID_DEFINED */
152 #endif  /* ODBCVER >= 0x0350 */
153 #endif     /* RC_INVOKED */
154 
155 #ifdef __cplusplus
156 }
157 #endif
158 
159 #endif /* __SQLTYPES */
160