tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / external / unixODBC / inc / odbc / sqltypes.h
blob939c5d29bd604084630134a70df81f6b9fc7e4f4
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 CALLBACK
77 #define SQL_API
78 #define BOOL int
79 typedef void* HWND;
80 typedef char CHAR;
81 #ifdef UNICODE
84 * NOTE: The Microsoft unicode define is only for apps that want to use TCHARs and
85 * be able to compile for both unicode and non-unicode with the same source.
86 * This is not recommended for linux applications and is not supported
87 * by the standard linux string header files.
89 #ifdef SQL_WCHART_CONVERT
90 typedef wchar_t TCHAR;
91 #else
92 typedef signed short TCHAR;
93 #endif
95 #else
96 typedef char TCHAR;
97 #endif
99 #ifndef DONT_TD_VOID
100 typedef void VOID;
101 #endif
103 typedef unsigned short WORD;
104 #if (SIZEOF_LONG_INT == 4)
105 typedef unsigned long DWORD;
106 #else
107 typedef unsigned int DWORD;
108 #endif
109 typedef unsigned char BYTE;
111 #ifdef SQL_WCHART_CONVERT
112 typedef wchar_t WCHAR;
113 #else
114 typedef unsigned short WCHAR;
115 #endif
117 typedef WCHAR* LPWSTR;
118 typedef const char* LPCSTR;
119 typedef const WCHAR* LPCWSTR;
120 typedef TCHAR* LPTSTR;
121 typedef char* LPSTR;
122 typedef DWORD* LPDWORD;
124 typedef void* HINSTANCE;
126 #endif
129 /****************************
130 * standard SQL* data types. use these as much as possible when using ODBC calls/vars
131 ***************************/
132 typedef unsigned char SQLCHAR;
134 #if (ODBCVER >= 0x0300)
135 typedef unsigned char SQLDATE;
136 typedef unsigned char SQLDECIMAL;
137 typedef double SQLDOUBLE;
138 typedef double SQLFLOAT;
139 #endif
142 * can't use a long it fails on 64 platforms
146 * Hopefully by now it should be safe to assume most drivers know about SQLLEN now
147 * and the default is now sizeof( SQLLEN ) = 8 on 64 bit platforms
151 #if (SIZEOF_LONG_INT == 8)
152 #ifdef BUILD_LEGACY_64_BIT_MODE
153 typedef int SQLINTEGER;
154 typedef unsigned int SQLUINTEGER;
155 #define SQLLEN SQLINTEGER
156 #define SQLULEN SQLUINTEGER
157 #define SQLSETPOSIROW SQLUSMALLINT
159 * These are not supported on 64bit ODBC according to MS, removed, so use at your peril
161 typedef SQLULEN SQLROWCOUNT;
162 typedef SQLULEN SQLROWSETSIZE;
163 typedef SQLULEN SQLTRANSID;
164 typedef SQLLEN SQLROWOFFSET;
166 #else
167 typedef int SQLINTEGER;
168 typedef unsigned int SQLUINTEGER;
169 typedef long SQLLEN;
170 typedef unsigned long SQLULEN;
171 typedef unsigned long SQLSETPOSIROW;
173 * These are not supported on 64bit ODBC according to MS, removed, so use at your peril
175 typedef SQLULEN SQLTRANSID;
176 typedef SQLULEN SQLROWCOUNT;
177 typedef SQLUINTEGER SQLROWSETSIZE;
178 typedef SQLLEN SQLROWOFFSET;
180 typedef SQLULEN SQLROWCOUNT;
181 typedef SQLULEN SQLROWSETSIZE;
182 typedef SQLULEN SQLTRANSID;
183 typedef SQLLEN SQLROWOFFSET;
184 #endif
185 #else
186 typedef long SQLINTEGER;
187 typedef unsigned long SQLUINTEGER;
188 #define SQLLEN SQLINTEGER
189 #define SQLULEN SQLUINTEGER
190 #define SQLSETPOSIROW SQLUSMALLINT
191 typedef SQLULEN SQLROWCOUNT;
192 typedef SQLULEN SQLROWSETSIZE;
193 typedef SQLULEN SQLTRANSID;
194 typedef SQLLEN SQLROWOFFSET;
195 #endif
197 #if (ODBCVER >= 0x0300)
198 typedef unsigned char SQLNUMERIC;
199 #endif
201 typedef void * SQLPOINTER;
203 #if (ODBCVER >= 0x0300)
204 typedef float SQLREAL;
205 #endif
207 typedef signed short int SQLSMALLINT;
208 typedef unsigned short SQLUSMALLINT;
210 #if (ODBCVER >= 0x0300)
211 typedef unsigned char SQLTIME;
212 typedef unsigned char SQLTIMESTAMP;
213 typedef unsigned char SQLVARCHAR;
214 #endif
216 typedef SQLSMALLINT SQLRETURN;
218 #if (ODBCVER >= 0x0300)
219 typedef void * SQLHANDLE;
220 typedef SQLHANDLE SQLHENV;
221 typedef SQLHANDLE SQLHDBC;
222 typedef SQLHANDLE SQLHSTMT;
223 typedef SQLHANDLE SQLHDESC;
224 #else
225 typedef void * SQLHENV;
226 typedef void * SQLHDBC;
227 typedef void * SQLHSTMT;
229 * some things like PHP won't build without this
231 typedef void * SQLHANDLE;
232 #endif
234 /****************************
235 * These are cast into the actual struct that is being passed around. The
236 * DriverManager knows what its structs look like and the Driver knows about its
237 * structs... the app knows nothing about them... just void*
238 * These are deprecated in favour of SQLHENV, SQLHDBC, SQLHSTMT
239 ***************************/
241 #if (ODBCVER >= 0x0300)
242 typedef SQLHANDLE HENV;
243 typedef SQLHANDLE HDBC;
244 typedef SQLHANDLE HSTMT;
245 #else
246 typedef void * HENV;
247 typedef void * HDBC;
248 typedef void * HSTMT;
249 #endif
252 /****************************
253 * more basic data types to augment what windows.h provides
254 ***************************/
255 #ifndef ALLREADY_HAVE_WINDOWS_TYPE
257 typedef unsigned char UCHAR;
258 typedef signed char SCHAR;
259 typedef SCHAR SQLSCHAR;
260 #if (SIZEOF_LONG_INT == 4)
261 typedef long int SDWORD;
262 typedef unsigned long int UDWORD;
263 #else
264 typedef int SDWORD;
265 typedef unsigned int UDWORD;
266 #endif
267 typedef signed short int SWORD;
268 typedef unsigned short int UWORD;
269 typedef unsigned int UINT;
270 typedef signed long SLONG;
271 typedef signed short SSHORT;
272 typedef unsigned long ULONG;
273 typedef unsigned short USHORT;
274 typedef double SDOUBLE;
275 typedef double LDOUBLE;
276 typedef float SFLOAT;
277 typedef void* PTR;
278 typedef signed short RETCODE;
279 typedef void* SQLHWND;
281 #endif
283 /****************************
284 * standard structs for working with date/times
285 ***************************/
286 #ifndef __SQLDATE
287 #define __SQLDATE
288 typedef struct tagDATE_STRUCT
290 SQLSMALLINT year;
291 SQLUSMALLINT month;
292 SQLUSMALLINT day;
293 } DATE_STRUCT;
295 #if (ODBCVER >= 0x0300)
296 typedef DATE_STRUCT SQL_DATE_STRUCT;
297 #endif
299 typedef struct tagTIME_STRUCT
301 SQLUSMALLINT hour;
302 SQLUSMALLINT minute;
303 SQLUSMALLINT second;
304 } TIME_STRUCT;
306 #if (ODBCVER >= 0x0300)
307 typedef TIME_STRUCT SQL_TIME_STRUCT;
308 #endif
310 typedef struct tagTIMESTAMP_STRUCT
312 SQLSMALLINT year;
313 SQLUSMALLINT month;
314 SQLUSMALLINT day;
315 SQLUSMALLINT hour;
316 SQLUSMALLINT minute;
317 SQLUSMALLINT second;
318 SQLUINTEGER fraction;
319 } TIMESTAMP_STRUCT;
321 #if (ODBCVER >= 0x0300)
322 typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
323 #endif
326 #if (ODBCVER >= 0x0300)
327 typedef enum
329 SQL_IS_YEAR = 1,
330 SQL_IS_MONTH = 2,
331 SQL_IS_DAY = 3,
332 SQL_IS_HOUR = 4,
333 SQL_IS_MINUTE = 5,
334 SQL_IS_SECOND = 6,
335 SQL_IS_YEAR_TO_MONTH = 7,
336 SQL_IS_DAY_TO_HOUR = 8,
337 SQL_IS_DAY_TO_MINUTE = 9,
338 SQL_IS_DAY_TO_SECOND = 10,
339 SQL_IS_HOUR_TO_MINUTE = 11,
340 SQL_IS_HOUR_TO_SECOND = 12,
341 SQL_IS_MINUTE_TO_SECOND = 13
342 } SQLINTERVAL;
344 #endif
346 #if (ODBCVER >= 0x0300)
347 typedef struct tagSQL_YEAR_MONTH
349 SQLUINTEGER year;
350 SQLUINTEGER month;
351 } SQL_YEAR_MONTH_STRUCT;
353 typedef struct tagSQL_DAY_SECOND
355 SQLUINTEGER day;
356 SQLUINTEGER hour;
357 SQLUINTEGER minute;
358 SQLUINTEGER second;
359 SQLUINTEGER fraction;
360 } SQL_DAY_SECOND_STRUCT;
362 typedef struct tagSQL_INTERVAL_STRUCT
364 SQLINTERVAL interval_type;
365 SQLSMALLINT interval_sign;
366 union {
367 SQL_YEAR_MONTH_STRUCT year_month;
368 SQL_DAY_SECOND_STRUCT day_second;
369 } intval;
371 } SQL_INTERVAL_STRUCT;
373 #endif
375 #endif
377 #ifndef ODBCINT64
378 # if (ODBCVER >= 0x0300)
379 # if (SIZEOF_LONG_INT == 8)
380 # define ODBCINT64 long
381 # define UODBCINT64 unsigned long
382 # else
383 # ifdef HAVE_LONG_LONG
384 # define ODBCINT64 long long
385 # define UODBCINT64 unsigned long long
386 # else
388 * may fail in some cases, but what else can we do ?
390 struct __bigint_struct
392 int hiword;
393 unsigned int loword;
395 struct __bigint_struct_u
397 unsigned int hiword;
398 unsigned int loword;
400 # define ODBCINT64 struct __bigint_struct
401 # define UODBCINT64 struct __bigint_struct_u
402 # endif
403 # endif
404 #endif
405 #endif
407 #ifdef ODBCINT64
408 typedef ODBCINT64 SQLBIGINT;
409 #endif
410 #ifdef UODBCINT64
411 typedef UODBCINT64 SQLUBIGINT;
412 #endif
415 /****************************
416 * cursor and bookmark
417 ***************************/
418 #if (ODBCVER >= 0x0300)
419 #define SQL_MAX_NUMERIC_LEN 16
420 typedef struct tagSQL_NUMERIC_STRUCT
422 SQLCHAR precision;
423 SQLSCHAR scale;
424 SQLCHAR sign; /* 1=pos 0=neg */
425 SQLCHAR val[SQL_MAX_NUMERIC_LEN];
426 } SQL_NUMERIC_STRUCT;
427 #endif
429 #if (ODBCVER >= 0x0350)
430 #ifdef GUID_DEFINED
431 #ifndef ALLREADY_HAVE_WINDOWS_TYPE
432 typedef GUID SQLGUID;
433 #else
434 typedef struct tagSQLGUID
436 DWORD Data1;
437 WORD Data2;
438 WORD Data3;
439 BYTE Data4[ 8 ];
440 } SQLGUID;
441 #endif
442 #else
443 typedef struct tagSQLGUID
445 DWORD Data1;
446 WORD Data2;
447 WORD Data3;
448 BYTE Data4[ 8 ];
449 } SQLGUID;
450 #endif
451 #endif
453 typedef SQLULEN BOOKMARK;
455 typedef WCHAR SQLWCHAR;
457 #ifdef UNICODE
458 typedef SQLWCHAR SQLTCHAR;
459 #else
460 typedef SQLCHAR SQLTCHAR;
461 #endif
463 #ifdef __cplusplus
465 #endif
467 #endif