1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
|
/*************************************************************
* sqltypes.h
*
* This is the lowest level include in unixODBC. It defines
* the basic types required by unixODBC and is heavily based
* upon the MS include of the same name (it has to be for
* binary compatability between drivers developed under different
* packages).
*
* You can include this file directly but it is almost always
* included indirectly, by including.. for example sqlext.h
*
* This include makes no effort to be usefull on any platforms other
* than Linux (with some exceptions for UNIX in general).
*
* !!!DO NOT CONTAMINATE THIS FILE WITH NON-Linux CODE!!!
*
*************************************************************/
#ifndef __SQLTYPES_H
#define __SQLTYPES_H
/****************************
* default to the 3.51 definitions. should define ODBCVER before here if you want an older set of defines
***************************/
#ifndef ODBCVER
#define ODBCVER 0x0351
#endif
#ifdef __cplusplus
extern "C" {
#endif
/****************************
* These make up for having no windows.h
***************************/
#define FAR
#define CALLBACK
#define SQL_API
#define BOOL int
typedef void* HWND;
#ifndef CHAR
typedef char* GUID;
#endif
#define GUID_DEFINED
typedef char CHAR;
#ifndef DONT_TD_VOID
typedef void VOID;
#endif
typedef unsigned short WORD;
typedef unsigned long DWORD;
typedef unsigned char BYTE;
typedef unsigned short WCHAR;
typedef WCHAR* LPWSTR;
typedef const char* LPCSTR;
typedef char* LPSTR;
typedef DWORD* LPDWORD;
/****************************
* standard SQL* data types. use these as much as possible when using ODBC calls/vars
***************************/
typedef unsigned char SQLCHAR;
#if (ODBCVER >= 0x0300)
typedef unsigned char SQLDATE;
typedef unsigned char SQLDECIMAL;
typedef double SQLDOUBLE;
typedef double SQLFLOAT;
#endif
typedef long SQLINTEGER;
#if (ODBCVER >= 0x0300)
typedef unsigned char SQLNUMERIC;
#endif
typedef void * SQLPOINTER;
#if (ODBCVER >= 0x0300)
typedef float SQLREAL;
#endif
typedef signed short int SQLSMALLINT;
typedef unsigned short SQLUSMALLINT;
#if (ODBCVER >= 0x0300)
typedef unsigned char SQLTIME;
typedef unsigned char SQLTIMESTAMP;
typedef unsigned char SQLVARCHAR;
#endif
typedef SQLSMALLINT SQLRETURN;
/* typedef void * SQLHANDLE; */
typedef SQLINTEGER SQLHANDLE;
#if (ODBCVER >= 0x0300)
typedef SQLHANDLE SQLHENV;
typedef SQLHANDLE SQLHDBC;
typedef SQLHANDLE SQLHSTMT;
typedef SQLHANDLE SQLHDESC;
#else
typedef SQLINTEGER SQLHENV;
typedef SQLINTEGER SQLHDBC;
typedef SQLINTEGER SQLHSTMT;
#endif
/****************************
* more basic data types to augment what windows.h provides
***************************/
typedef unsigned char UCHAR;
typedef signed char SCHAR;
typedef SCHAR SQLSCHAR;
typedef long int SDWORD;
typedef signed short int SWORD;
typedef unsigned long int UDWORD;
typedef unsigned short int UWORD;
typedef UDWORD SQLUINTEGER;
typedef signed long SLONG;
typedef signed short SSHORT;
typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef double SDOUBLE;
typedef double LDOUBLE;
typedef float SFLOAT;
typedef void* PTR;
typedef signed short RETCODE;
typedef void* SQLHWND;
/****************************
* These are cast into the actual struct that is being passed around. The
* DriverManager knows what its structs look like and the Driver knows about its
* structs... the app knows nothing about them... just void*
* These are deprecated in favour of SQLHENV, SQLHDBC, SQLHSTMT
***************************/
/*
typedef void* HENV;
typedef void* HDBC;
typedef void* HSTMT;
*/
typedef SQLHANDLE HENV;
typedef SQLHANDLE HDBC;
typedef SQLHANDLE HSTMT;
/****************************
* standard structs for working with date/times
***************************/
#ifndef __SQLDATE
#define __SQLDATE
typedef struct tagDATE_STRUCT
{
SQLSMALLINT year;
SQLUSMALLINT month;
SQLUSMALLINT day;
} DATE_STRUCT;
#if (ODBCVER >= 0x0300)
typedef DATE_STRUCT SQL_DATE_STRUCT;
#endif
typedef struct tagTIME_STRUCT
{
SQLUSMALLINT hour;
SQLUSMALLINT minute;
SQLUSMALLINT second;
} TIME_STRUCT;
#if (ODBCVER >= 0x0300)
typedef TIME_STRUCT SQL_TIME_STRUCT;
#endif
typedef struct tagTIMESTAMP_STRUCT
{
SQLSMALLINT year;
SQLUSMALLINT month;
SQLUSMALLINT day;
SQLUSMALLINT hour;
SQLUSMALLINT minute;
SQLUSMALLINT second;
SQLUINTEGER fraction;
} TIMESTAMP_STRUCT;
#if (ODBCVER >= 0x0300)
typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
#endif
#if (ODBCVER >= 0x0300)
typedef enum
{
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,
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,
SQL_IS_MINUTE_TO_SECOND = 13
} SQLINTERVAL;
#endif
#if (ODBCVER >= 0x0300)
typedef struct tagSQL_YEAR_MONTH
{
SQLUINTEGER year;
SQLUINTEGER month;
} SQL_YEAR_MONTH_STRUCT;
typedef struct tagSQL_DAY_SECOND
{
SQLUINTEGER day;
SQLUINTEGER hour;
SQLUINTEGER minute;
SQLUINTEGER second;
SQLUINTEGER fraction;
} SQL_DAY_SECOND_STRUCT;
typedef struct tagSQL_INTERVAL_STRUCT
{
SQLINTERVAL interval_type;
SQLSMALLINT interval_sign;
union {
SQL_YEAR_MONTH_STRUCT year_month;
SQL_DAY_SECOND_STRUCT day_second;
} intval;
} SQL_INTERVAL_STRUCT;
#endif
#endif
/****************************
*
***************************/
#if (ODBCVER >= 0x0300)
#define ODBCINT64 long
#ifdef ODBCINT64
typedef ODBCINT64 SQLBIGINT;
typedef unsigned ODBCINT64 SQLUBIGINT;
#endif
#endif
/****************************
* cursor and bookmark
***************************/
#if (ODBCVER >= 0x0300)
#define SQL_MAX_NUMERIC_LEN 16
typedef struct tagSQL_NUMERIC_STRUCT
{
SQLCHAR precision;
SQLSCHAR scale;
SQLCHAR sign; /* 1=pos 0=neg */
SQLCHAR val[SQL_MAX_NUMERIC_LEN];
} SQL_NUMERIC_STRUCT;
#endif
#if (ODBCVER >= 0x0350)
#ifdef GUID_DEFINED
typedef GUID SQLGUID;
#else
typedef struct tagSQLGUID
{
DWORD Data1;
WORD Data2;
WORD Data3;
BYTE Data4[ 8 ];
} SQLGUID;
#endif
#endif
typedef unsigned long int BOOKMARK;
#ifdef _WCHAR_T_DEFINED
typedef wchar_t SQLWCHAR;
#else
typedef unsigned short SQLWCHAR;
#endif
#ifdef UNICODE
typedef SQLWCHAR SQLTCHAR;
#else
typedef SQLCHAR SQLTCHAR;
#endif
#ifdef __cplusplus
}
#endif
#endif
|