Warning: That file was not part of the compilation database. It may have many parsing errors.
1 | /************************************************************* |
---|---|
2 | * sqltypes.h |
3 | * |
4 | * This is the lowest level include in unixODBC. It defines |
5 | * the basic types required by unixODBC and is heavily based |
6 | * upon the MS include of the same name (it has to be for |
7 | * binary compatability between drivers developed under different |
8 | * packages). |
9 | * |
10 | * You can include this file directly but it is almost always |
11 | * included indirectly, by including.. for example sqlext.h |
12 | * |
13 | * This include makes no effort to be usefull on any platforms other |
14 | * than Linux (with some exceptions for UNIX in general). |
15 | * |
16 | * !!!DO NOT CONTAMINATE THIS FILE WITH NON-Linux CODE!!! |
17 | * |
18 | *************************************************************/ |
19 | #ifndef __SQLTYPES_H |
20 | #define __SQLTYPES_H |
21 | |
22 | /**************************** |
23 | * default to the 3.80 definitions. should define ODBCVER before here if you want an older set of defines |
24 | ***************************/ |
25 | #ifndef ODBCVER |
26 | #define ODBCVER 0x0380 |
27 | #endif |
28 | |
29 | /* |
30 | * if thi sis set, then use a 4 byte unicode definition, insteead of the 2 bye that MS use |
31 | */ |
32 | |
33 | #ifdef SQL_WCHART_CONVERT |
34 | /* |
35 | * Use this if you want to use the C/C++ portable definition of a wide char, wchar_t |
36 | * Microsoft hardcoded a definition of unsigned short which may not be compatible with |
37 | * your platform specific wide char definition. |
38 | */ |
39 | #include <wchar.h> |
40 | #endif |
41 | |
42 | #ifdef __cplusplus |
43 | extern "C"{ |
44 | #endif |
45 | |
46 | /* |
47 | * this is defined by configure, but will not be on a normal application build |
48 | * the install creates a unixodbc_conf.h file that contains the current build settings |
49 | */ |
50 | |
51 | #ifndef SIZEOF_LONG_INT |
52 | #include "unixodbc_conf.h" |
53 | #endif |
54 | |
55 | #ifndef SIZEOF_LONG_INT |
56 | #error "Needs to know how big a long int is to continue!!!" |
57 | #endif |
58 | |
59 | /**************************** |
60 | * These make up for having no windows.h |
61 | ***************************/ |
62 | #ifndef ALLREADY_HAVE_WINDOWS_TYPE |
63 | |
64 | #define FAR |
65 | #define CALLBACK |
66 | #ifdef __OS2__ |
67 | #define SQL_API _System |
68 | #else |
69 | #define SQL_API |
70 | #endif |
71 | #define BOOL int |
72 | #ifndef _WINDOWS_ |
73 | typedef void* HWND; |
74 | #endif |
75 | typedef char CHAR; |
76 | #ifdef UNICODE |
77 | |
78 | /* |
79 | * NOTE: The Microsoft unicode define is only for apps that want to use TCHARs and |
80 | * be able to compile for both unicode and non-unicode with the same source. |
81 | * This is not recommanded for linux applications and is not supported |
82 | * by the standard linux string header files. |
83 | */ |
84 | #ifdef SQL_WCHART_CONVERT |
85 | typedef wchar_t TCHAR; |
86 | #else |
87 | typedef signed short TCHAR; |
88 | #endif |
89 | |
90 | #else |
91 | typedef char TCHAR; |
92 | #endif |
93 | |
94 | typedef unsigned short WORD; |
95 | #if (SIZEOF_LONG_INT == 4) |
96 | typedef unsigned long DWORD; |
97 | #else |
98 | typedef unsigned int DWORD; |
99 | #endif |
100 | typedef unsigned char BYTE; |
101 | |
102 | #ifdef SQL_WCHART_CONVERT |
103 | typedef wchar_t WCHAR; |
104 | #else |
105 | typedef unsigned short WCHAR; |
106 | #endif |
107 | |
108 | typedef WCHAR* LPWSTR; |
109 | typedef const char* LPCSTR; |
110 | typedef const WCHAR* LPCWSTR; |
111 | typedef TCHAR* LPTSTR; |
112 | typedef char* LPSTR; |
113 | typedef DWORD* LPDWORD; |
114 | |
115 | #ifndef _WINDOWS_ |
116 | typedef void* HINSTANCE; |
117 | #endif |
118 | |
119 | #endif |
120 | |
121 | |
122 | /**************************** |
123 | * standard SQL* data types. use these as much as possible when using ODBC calls/vars |
124 | ***************************/ |
125 | typedef unsigned char SQLCHAR; |
126 | |
127 | #if (ODBCVER >= 0x0300) |
128 | typedef unsigned char SQLDATE; |
129 | typedef unsigned char SQLDECIMAL; |
130 | typedef double SQLDOUBLE; |
131 | typedef double SQLFLOAT; |
132 | #endif |
133 | |
134 | /* |
135 | * can't use a long it fails on 64 platforms |
136 | */ |
137 | |
138 | /* |
139 | * Hopefully by now it should be safe to assume most drivers know about SQLLEN now |
140 | * and the defaukt is now sizeof( SQLLEN ) = 8 on 64 bit platforms |
141 | * |
142 | */ |
143 | |
144 | #if (SIZEOF_LONG_INT == 8) |
145 | #ifdef BUILD_LEGACY_64_BIT_MODE |
146 | typedef int SQLINTEGER; |
147 | typedef unsigned int SQLUINTEGER; |
148 | #define SQLLEN SQLINTEGER |
149 | #define SQLULEN SQLUINTEGER |
150 | #define SQLSETPOSIROW SQLUSMALLINT |
151 | /* |
152 | * These are not supprted on 64bit ODBC according to MS, removed, so use at your peril |
153 | * |
154 | typedef SQLULEN SQLROWCOUNT; |
155 | typedef SQLULEN SQLROWSETSIZE; |
156 | typedef SQLULEN SQLTRANSID; |
157 | typedef SQLLEN SQLROWOFFSET; |
158 | */ |
159 | #else |
160 | typedef int SQLINTEGER; |
161 | typedef unsigned int SQLUINTEGER; |
162 | typedef long SQLLEN; |
163 | typedef unsigned long SQLULEN; |
164 | typedef unsigned long SQLSETPOSIROW; |
165 | /* |
166 | * These are not supprted on 64bit ODBC according to MS, removed, so use at your peril |
167 | * |
168 | typedef SQLULEN SQLTRANSID; |
169 | typedef SQLULEN SQLROWCOUNT; |
170 | typedef SQLUINTEGER SQLROWSETSIZE; |
171 | typedef SQLLEN SQLROWOFFSET; |
172 | */ |
173 | #endif |
174 | #else |
175 | typedef long SQLINTEGER; |
176 | typedef unsigned long SQLUINTEGER; |
177 | #define SQLLEN SQLINTEGER |
178 | #define SQLULEN SQLUINTEGER |
179 | #define SQLSETPOSIROW SQLUSMALLINT |
180 | typedef SQLULEN SQLROWCOUNT; |
181 | typedef SQLULEN SQLROWSETSIZE; |
182 | typedef SQLULEN SQLTRANSID; |
183 | typedef SQLLEN SQLROWOFFSET; |
184 | #endif |
185 | |
186 | #if (ODBCVER >= 0x0300) |
187 | typedef unsigned char SQLNUMERIC; |
188 | #endif |
189 | |
190 | typedef void * SQLPOINTER; |
191 | |
192 | #if (ODBCVER >= 0x0300) |
193 | typedef float SQLREAL; |
194 | #endif |
195 | |
196 | typedef signed short int SQLSMALLINT; |
197 | typedef unsigned short SQLUSMALLINT; |
198 | |
199 | #if (ODBCVER >= 0x0300) |
200 | typedef unsigned char SQLTIME; |
201 | typedef unsigned char SQLTIMESTAMP; |
202 | typedef unsigned char SQLVARCHAR; |
203 | #endif |
204 | |
205 | typedef SQLSMALLINT SQLRETURN; |
206 | |
207 | #if (ODBCVER >= 0x0300) |
208 | typedef void * SQLHANDLE; |
209 | typedef SQLHANDLE SQLHENV; |
210 | typedef SQLHANDLE SQLHDBC; |
211 | typedef SQLHANDLE SQLHSTMT; |
212 | typedef SQLHANDLE SQLHDESC; |
213 | #else |
214 | typedef void * SQLHENV; |
215 | typedef void * SQLHDBC; |
216 | typedef void * SQLHSTMT; |
217 | /* |
218 | * some things like PHP won't build without this |
219 | */ |
220 | typedef void * SQLHANDLE; |
221 | #endif |
222 | |
223 | /**************************** |
224 | * These are cast into the actual struct that is being passed around. The |
225 | * DriverManager knows what its structs look like and the Driver knows about its |
226 | * structs... the app knows nothing about them... just void* |
227 | * These are deprecated in favour of SQLHENV, SQLHDBC, SQLHSTMT |
228 | ***************************/ |
229 | |
230 | #if (ODBCVER >= 0x0300) |
231 | typedef SQLHANDLE HENV; |
232 | typedef SQLHANDLE HDBC; |
233 | typedef SQLHANDLE HSTMT; |
234 | #else |
235 | typedef void * HENV; |
236 | typedef void * HDBC; |
237 | typedef void * HSTMT; |
238 | #endif |
239 | |
240 | |
241 | /**************************** |
242 | * more basic data types to augment what windows.h provides |
243 | ***************************/ |
244 | #ifndef ALLREADY_HAVE_WINDOWS_TYPE |
245 | |
246 | typedef unsigned char UCHAR; |
247 | typedef signed char SCHAR; |
248 | typedef SCHAR SQLSCHAR; |
249 | #if (SIZEOF_LONG_INT == 4) |
250 | typedef long int SDWORD; |
251 | typedef unsigned long int UDWORD; |
252 | #else |
253 | typedef int SDWORD; |
254 | typedef unsigned int UDWORD; |
255 | #endif |
256 | typedef signed short int SWORD; |
257 | typedef unsigned short int UWORD; |
258 | typedef unsigned int UINT; |
259 | typedef signed long SLONG; |
260 | typedef signed short SSHORT; |
261 | typedef unsigned long ULONG; |
262 | typedef unsigned short USHORT; |
263 | typedef double SDOUBLE; |
264 | typedef double LDOUBLE; |
265 | typedef float SFLOAT; |
266 | typedef void* PTR; |
267 | typedef signed short RETCODE; |
268 | typedef void* SQLHWND; |
269 | |
270 | #endif |
271 | |
272 | /**************************** |
273 | * standard structs for working with date/times |
274 | ***************************/ |
275 | #ifndef __SQLDATE |
276 | #define __SQLDATE |
277 | typedef struct tagDATE_STRUCT |
278 | { |
279 | SQLSMALLINT year; |
280 | SQLUSMALLINT month; |
281 | SQLUSMALLINT day; |
282 | } DATE_STRUCT; |
283 | |
284 | #if (ODBCVER >= 0x0300) |
285 | typedef DATE_STRUCT SQL_DATE_STRUCT; |
286 | #endif |
287 | |
288 | typedef struct tagTIME_STRUCT |
289 | { |
290 | SQLUSMALLINT hour; |
291 | SQLUSMALLINT minute; |
292 | SQLUSMALLINT second; |
293 | } TIME_STRUCT; |
294 | |
295 | #if (ODBCVER >= 0x0300) |
296 | typedef TIME_STRUCT SQL_TIME_STRUCT; |
297 | #endif |
298 | |
299 | typedef struct tagTIMESTAMP_STRUCT |
300 | { |
301 | SQLSMALLINT year; |
302 | SQLUSMALLINT month; |
303 | SQLUSMALLINT day; |
304 | SQLUSMALLINT hour; |
305 | SQLUSMALLINT minute; |
306 | SQLUSMALLINT second; |
307 | SQLUINTEGER fraction; |
308 | } TIMESTAMP_STRUCT; |
309 | |
310 | #if (ODBCVER >= 0x0300) |
311 | typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT; |
312 | #endif |
313 | |
314 | |
315 | #if (ODBCVER >= 0x0300) |
316 | typedef enum |
317 | { |
318 | SQL_IS_YEAR = 1, |
319 | SQL_IS_MONTH = 2, |
320 | SQL_IS_DAY = 3, |
321 | SQL_IS_HOUR = 4, |
322 | SQL_IS_MINUTE = 5, |
323 | SQL_IS_SECOND = 6, |
324 | SQL_IS_YEAR_TO_MONTH = 7, |
325 | SQL_IS_DAY_TO_HOUR = 8, |
326 | SQL_IS_DAY_TO_MINUTE = 9, |
327 | SQL_IS_DAY_TO_SECOND = 10, |
328 | SQL_IS_HOUR_TO_MINUTE = 11, |
329 | SQL_IS_HOUR_TO_SECOND = 12, |
330 | SQL_IS_MINUTE_TO_SECOND = 13 |
331 | } SQLINTERVAL; |
332 | |
333 | #endif |
334 | |
335 | #if (ODBCVER >= 0x0300) |
336 | typedef struct tagSQL_YEAR_MONTH |
337 | { |
338 | SQLUINTEGER year; |
339 | SQLUINTEGER month; |
340 | } SQL_YEAR_MONTH_STRUCT; |
341 | |
342 | typedef struct tagSQL_DAY_SECOND |
343 | { |
344 | SQLUINTEGER day; |
345 | SQLUINTEGER hour; |
346 | SQLUINTEGER minute; |
347 | SQLUINTEGER second; |
348 | SQLUINTEGER fraction; |
349 | } SQL_DAY_SECOND_STRUCT; |
350 | |
351 | typedef struct tagSQL_INTERVAL_STRUCT |
352 | { |
353 | SQLINTERVAL interval_type; |
354 | SQLSMALLINT interval_sign; |
355 | union { |
356 | SQL_YEAR_MONTH_STRUCT year_month; |
357 | SQL_DAY_SECOND_STRUCT day_second; |
358 | } intval; |
359 | |
360 | } SQL_INTERVAL_STRUCT; |
361 | |
362 | #endif |
363 | |
364 | #endif |
365 | |
366 | /**************************** |
367 | * |
368 | ***************************/ |
369 | #ifndef ODBCINT64 |
370 | # if (ODBCVER >= 0x0300) |
371 | # if (SIZEOF_LONG_INT == 8) |
372 | # define ODBCINT64 long |
373 | # define UODBCINT64 unsigned long |
374 | # define ODBCINT64_TYPE "long" |
375 | # define UODBCINT64_TYPE "unsigned long" |
376 | # else |
377 | # ifdef HAVE_LONG_LONG |
378 | # define ODBCINT64 long long |
379 | # define UODBCINT64 unsigned long long |
380 | # define ODBCINT64_TYPE "long long" |
381 | # define UODBCINT64_TYPE "unsigned long long" |
382 | # else |
383 | /* |
384 | * may fail in some cases, but what else can we do ? |
385 | */ |
386 | struct __bigint_struct |
387 | { |
388 | int hiword; |
389 | unsigned int loword; |
390 | }; |
391 | struct __bigint_struct_u |
392 | { |
393 | unsigned int hiword; |
394 | unsigned int loword; |
395 | }; |
396 | # define ODBCINT64 struct __bigint_struct |
397 | # define UODBCINT64 struct __bigint_struct_u |
398 | # define ODBCINT64_TYPE "struct __bigint_struct" |
399 | # define UODBCINT64_TYPE "struct __bigint_struct_u" |
400 | # endif |
401 | # endif |
402 | #endif |
403 | #endif |
404 | |
405 | #ifdef ODBCINT64 |
406 | typedef ODBCINT64 SQLBIGINT; |
407 | #endif |
408 | #ifdef UODBCINT64 |
409 | typedef UODBCINT64 SQLUBIGINT; |
410 | #endif |
411 | |
412 | |
413 | /**************************** |
414 | * cursor and bookmark |
415 | ***************************/ |
416 | #if (ODBCVER >= 0x0300) |
417 | #define SQL_MAX_NUMERIC_LEN 16 |
418 | typedef struct tagSQL_NUMERIC_STRUCT |
419 | { |
420 | SQLCHAR precision; |
421 | SQLSCHAR scale; |
422 | SQLCHAR sign; /* 1=pos 0=neg */ |
423 | SQLCHAR val[SQL_MAX_NUMERIC_LEN]; |
424 | } SQL_NUMERIC_STRUCT; |
425 | #endif |
426 | |
427 | #if (ODBCVER >= 0x0350) |
428 | #ifdef GUID_DEFINED |
429 | #ifndef ALLREADY_HAVE_WINDOWS_TYPE |
430 | typedef GUID SQLGUID; |
431 | #else |
432 | typedef struct tagSQLGUID |
433 | { |
434 | DWORD Data1; |
435 | WORD Data2; |
436 | WORD Data3; |
437 | BYTE Data4[ 8 ]; |
438 | } SQLGUID; |
439 | #endif |
440 | #else |
441 | typedef struct tagSQLGUID |
442 | { |
443 | DWORD Data1; |
444 | WORD Data2; |
445 | WORD Data3; |
446 | BYTE Data4[ 8 ]; |
447 | } SQLGUID; |
448 | #endif |
449 | #endif |
450 | |
451 | typedef SQLULEN BOOKMARK; |
452 | |
453 | typedef WCHAR SQLWCHAR; |
454 | |
455 | #ifdef UNICODE |
456 | typedef SQLWCHAR SQLTCHAR; |
457 | #else |
458 | typedef SQLCHAR SQLTCHAR; |
459 | #endif |
460 | |
461 | #ifdef __cplusplus |
462 | } |
463 | #endif |
464 | |
465 | #endif |
466 | |
467 | |
468 | |
469 |
Warning: That file was not part of the compilation database. It may have many parsing errors.