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