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
43extern "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_
73typedef void* HWND;
74#endif
75typedef 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
85typedef wchar_t TCHAR;
86#else
87typedef signed short TCHAR;
88#endif
89
90#else
91typedef char TCHAR;
92#endif
93
94typedef unsigned short WORD;
95#if (SIZEOF_LONG_INT == 4)
96typedef unsigned long DWORD;
97#else
98typedef unsigned int DWORD;
99#endif
100typedef unsigned char BYTE;
101
102#ifdef SQL_WCHART_CONVERT
103typedef wchar_t WCHAR;
104#else
105typedef unsigned short WCHAR;
106#endif
107
108typedef WCHAR* LPWSTR;
109typedef const char* LPCSTR;
110typedef const WCHAR* LPCWSTR;
111typedef TCHAR* LPTSTR;
112typedef char* LPSTR;
113typedef DWORD* LPDWORD;
114
115#ifndef _WINDOWS_
116typedef 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 ***************************/
125typedef unsigned char SQLCHAR;
126
127#if (ODBCVER >= 0x0300)
128typedef unsigned char SQLDATE;
129typedef unsigned char SQLDECIMAL;
130typedef double SQLDOUBLE;
131typedef 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
146typedef int SQLINTEGER;
147typedef 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
160typedef int SQLINTEGER;
161typedef unsigned int SQLUINTEGER;
162typedef long SQLLEN;
163typedef unsigned long SQLULEN;
164typedef 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
175typedef long SQLINTEGER;
176typedef unsigned long SQLUINTEGER;
177#define SQLLEN SQLINTEGER
178#define SQLULEN SQLUINTEGER
179#define SQLSETPOSIROW SQLUSMALLINT
180typedef SQLULEN SQLROWCOUNT;
181typedef SQLULEN SQLROWSETSIZE;
182typedef SQLULEN SQLTRANSID;
183typedef SQLLEN SQLROWOFFSET;
184#endif
185
186#if (ODBCVER >= 0x0300)
187typedef unsigned char SQLNUMERIC;
188#endif
189
190typedef void * SQLPOINTER;
191
192#if (ODBCVER >= 0x0300)
193typedef float SQLREAL;
194#endif
195
196typedef signed short int SQLSMALLINT;
197typedef unsigned short SQLUSMALLINT;
198
199#if (ODBCVER >= 0x0300)
200typedef unsigned char SQLTIME;
201typedef unsigned char SQLTIMESTAMP;
202typedef unsigned char SQLVARCHAR;
203#endif
204
205typedef SQLSMALLINT SQLRETURN;
206
207#if (ODBCVER >= 0x0300)
208typedef void * SQLHANDLE;
209typedef SQLHANDLE SQLHENV;
210typedef SQLHANDLE SQLHDBC;
211typedef SQLHANDLE SQLHSTMT;
212typedef SQLHANDLE SQLHDESC;
213#else
214typedef void * SQLHENV;
215typedef void * SQLHDBC;
216typedef void * SQLHSTMT;
217/*
218 * some things like PHP won't build without this
219 */
220typedef 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)
231typedef SQLHANDLE HENV;
232typedef SQLHANDLE HDBC;
233typedef SQLHANDLE HSTMT;
234#else
235typedef void * HENV;
236typedef void * HDBC;
237typedef 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
246typedef unsigned char UCHAR;
247typedef signed char SCHAR;
248typedef SCHAR SQLSCHAR;
249#if (SIZEOF_LONG_INT == 4)
250typedef long int SDWORD;
251typedef unsigned long int UDWORD;
252#else
253typedef int SDWORD;
254typedef unsigned int UDWORD;
255#endif
256typedef signed short int SWORD;
257typedef unsigned short int UWORD;
258typedef unsigned int UINT;
259typedef signed long SLONG;
260typedef signed short SSHORT;
261typedef unsigned long ULONG;
262typedef unsigned short USHORT;
263typedef double SDOUBLE;
264typedef double LDOUBLE;
265typedef float SFLOAT;
266typedef void* PTR;
267typedef signed short RETCODE;
268typedef void* SQLHWND;
269
270#endif
271
272/****************************
273 * standard structs for working with date/times
274 ***************************/
275#ifndef __SQLDATE
276#define __SQLDATE
277typedef struct tagDATE_STRUCT
278{
279 SQLSMALLINT year;
280 SQLUSMALLINT month;
281 SQLUSMALLINT day;
282} DATE_STRUCT;
283
284#if (ODBCVER >= 0x0300)
285typedef DATE_STRUCT SQL_DATE_STRUCT;
286#endif
287
288typedef struct tagTIME_STRUCT
289{
290 SQLUSMALLINT hour;
291 SQLUSMALLINT minute;
292 SQLUSMALLINT second;
293} TIME_STRUCT;
294
295#if (ODBCVER >= 0x0300)
296typedef TIME_STRUCT SQL_TIME_STRUCT;
297#endif
298
299typedef 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)
311typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT;
312#endif
313
314
315#if (ODBCVER >= 0x0300)
316typedef 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)
336typedef struct tagSQL_YEAR_MONTH
337{
338 SQLUINTEGER year;
339 SQLUINTEGER month;
340} SQL_YEAR_MONTH_STRUCT;
341
342typedef 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
351typedef 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 */
386struct __bigint_struct
387{
388 int hiword;
389 unsigned int loword;
390};
391struct __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
406typedef ODBCINT64 SQLBIGINT;
407#endif
408#ifdef UODBCINT64
409typedef UODBCINT64 SQLUBIGINT;
410#endif
411
412
413/****************************
414 * cursor and bookmark
415 ***************************/
416#if (ODBCVER >= 0x0300)
417#define SQL_MAX_NUMERIC_LEN 16
418typedef 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
430typedef GUID SQLGUID;
431#else
432typedef struct tagSQLGUID
433{
434 DWORD Data1;
435 WORD Data2;
436 WORD Data3;
437 BYTE Data4[ 8 ];
438} SQLGUID;
439#endif
440#else
441typedef struct tagSQLGUID
442{
443 DWORD Data1;
444 WORD Data2;
445 WORD Data3;
446 BYTE Data4[ 8 ];
447} SQLGUID;
448#endif
449#endif
450
451typedef SQLULEN BOOKMARK;
452
453typedef WCHAR SQLWCHAR;
454
455#ifdef UNICODE
456typedef SQLWCHAR SQLTCHAR;
457#else
458typedef 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.