8 * The iODBC driver manager.
10 * Copyright (C) 1995 Ke Jin <kejin@empress.com>
11 * Copyright (C) 1996-2021 OpenLink Software <iodbc@openlinksw.com>
12 * All Rights Reserved.
14 * This software is released under the terms of either of the following
17 * - GNU Library General Public License (see LICENSE.LGPL)
18 * - The BSD License (see LICENSE.BSD).
20 * Note that the only valid version of the LGPL license as far as this
21 * project is concerned is the original GNU Library General Public License
22 * Version 2, dated June 1991.
24 * While not mandated by the BSD license, any patches you make to the
25 * iODBC source code may be contributed back into the iODBC project
26 * at your discretion. Contributions will benefit the Open Source and
27 * Data Access community as a whole. Submissions may be made at:
29 * http://www.iodbc.org
32 * GNU Library Generic Public License Version 2
33 * ============================================
34 * This library is free software; you can redistribute it and/or
35 * modify it under the terms of the GNU Library General Public
36 * License as published by the Free Software Foundation; only
37 * Version 2 of the License dated June 1991.
39 * This library is distributed in the hope that it will be useful,
40 * but WITHOUT ANY WARRANTY; without even the implied warranty of
41 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
42 * Library General Public License for more details.
44 * You should have received a copy of the GNU Library General Public
45 * License along with this library; if not, write to the Free
46 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
51 * Redistribution and use in source and binary forms, with or without
52 * modification, are permitted provided that the following conditions
55 * 1. Redistributions of source code must retain the above copyright
56 * notice, this list of conditions and the following disclaimer.
57 * 2. Redistributions in binary form must reproduce the above copyright
58 * notice, this list of conditions and the following disclaimer in
59 * the documentation and/or other materials provided with the
61 * 3. Neither the name of OpenLink Software Inc. nor the names of its
62 * contributors may be used to endorse or promote products derived
63 * from this software without specific prior written permission.
65 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
66 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
67 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
68 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OPENLINK OR
69 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
70 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
71 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
72 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
73 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
74 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
75 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
82 * Set default specification to ODBC 3.51
85 #define ODBCVER 0x0351
89 * Include Windows style defines and typedefs on Unix
92 #include "iodbcunix.h"
101 * Environment specific definitions
108 #define SQL_API __stdcall
115 * API declaration data types
117 typedef unsigned char SQLCHAR
;
118 typedef signed short SQLSMALLINT
;
119 typedef unsigned short SQLUSMALLINT
;
120 #if (SIZEOF_LONG == 8)
121 typedef signed int SQLINTEGER
;
122 typedef unsigned int SQLUINTEGER
;
124 typedef signed long SQLINTEGER
;
125 typedef unsigned long SQLUINTEGER
;
127 typedef void * SQLPOINTER
;
129 #if (ODBCVER >= 0x0300)
130 typedef signed char SQLSCHAR
;
131 typedef unsigned char SQLDATE
;
132 typedef unsigned char SQLDECIMAL
;
133 typedef unsigned char SQLNUMERIC
;
134 typedef double SQLDOUBLE
;
135 typedef double SQLFLOAT
;
136 typedef float SQLREAL
;
137 typedef unsigned char SQLTIME
;
138 typedef unsigned char SQLTIMESTAMP
;
139 typedef unsigned char SQLVARCHAR
;
140 #endif /* ODBCVER >= 0x0300 */
144 * New Win64 datatypes
147 typedef INT64 SQLLEN
;
148 typedef UINT64 SQLULEN
;
149 typedef UINT64 SQLSETPOSIROW
;
150 #elif defined(STRICT_ODBC_TYPES)
152 typedef unsigned long SQLULEN
;
153 typedef unsigned short SQLSETPOSIROW
;
156 #define SQLULEN unsigned long
157 #define SQLSETPOSIROW unsigned short
162 * Backward compatibility with older platform sdks
164 typedef SQLULEN SQLROWCOUNT
;
165 typedef SQLULEN SQLROWSETSIZE
;
166 typedef SQLULEN SQLTRANSID
;
167 typedef SQLLEN SQLROWOFFSET
;
171 * Generic pointer types
174 typedef void * SQLHANDLE
;
182 typedef void * HSTMT
;
184 typedef SQLHANDLE SQLHENV
;
185 typedef SQLHANDLE SQLHDBC
;
186 typedef SQLHANDLE SQLHSTMT
;
187 #if (ODBCVER >= 0x0300)
188 typedef SQLHANDLE SQLHDESC
;
189 #endif /* ODBCVER >= 0x0300 */
195 #if defined(WIN32) || defined (_WIN64) || defined(OS2)
196 typedef HWND SQLHWND
;
197 #elif defined(macintosh)
199 typedef WindowPtr HWND
;
200 typedef HWND SQLHWND
;
202 typedef SQLPOINTER HWND
;
203 typedef SQLPOINTER SQLHWND
;
208 * SQL portable types for C
210 typedef unsigned char UCHAR
;
211 typedef signed char SCHAR
;
212 typedef short int SWORD
;
213 typedef unsigned short int UWORD
;
214 typedef long int SDWORD
;
215 typedef unsigned long int UDWORD
;
217 typedef signed short SSHORT
;
218 typedef unsigned short USHORT
;
219 typedef signed long SLONG
;
220 typedef unsigned long ULONG
;
221 typedef float SFLOAT
;
222 typedef double SDOUBLE
;
223 typedef double LDOUBLE
;
227 * Return type for functions
229 typedef signed short RETCODE
;
230 typedef SQLSMALLINT SQLRETURN
;
234 * SQL portable types for C - DATA, TIME, TIMESTAMP, and BOOKMARK
236 typedef SQLULEN BOOKMARK
;
239 typedef struct tagDATE_STRUCT
247 #if (ODBCVER >= 0x0300)
248 typedef DATE_STRUCT SQL_DATE_STRUCT
;
249 #endif /* ODBCVER >= 0x0300 */
252 typedef struct tagTIME_STRUCT
260 #if (ODBCVER >= 0x0300)
261 typedef TIME_STRUCT SQL_TIME_STRUCT
;
262 #endif /* ODBCVER >= 0x0300 */
265 typedef struct tagTIMESTAMP_STRUCT
273 SQLUINTEGER fraction
;
277 #if (ODBCVER >= 0x0300)
278 typedef TIMESTAMP_STRUCT SQL_TIMESTAMP_STRUCT
;
279 #endif /* ODBCVER >= 0x0300 */
283 * Enumeration for DATETIME_INTERVAL_SUBCODE values for interval data types
285 * These values are from SQL-92
287 #if (ODBCVER >= 0x0300)
296 SQL_IS_YEAR_TO_MONTH
= 7,
297 SQL_IS_DAY_TO_HOUR
= 8,
298 SQL_IS_DAY_TO_MINUTE
= 9,
299 SQL_IS_DAY_TO_SECOND
= 10,
300 SQL_IS_HOUR_TO_MINUTE
= 11,
301 SQL_IS_HOUR_TO_SECOND
= 12,
302 SQL_IS_MINUTE_TO_SECOND
= 13
307 typedef struct tagSQL_YEAR_MONTH
312 SQL_YEAR_MONTH_STRUCT
;
315 typedef struct tagSQL_DAY_SECOND
321 SQLUINTEGER fraction
;
323 SQL_DAY_SECOND_STRUCT
;
326 typedef struct tagSQL_INTERVAL_STRUCT
328 SQLINTERVAL interval_type
;
329 SQLSMALLINT interval_sign
;
332 SQL_YEAR_MONTH_STRUCT year_month
;
333 SQL_DAY_SECOND_STRUCT day_second
;
338 #endif /* ODBCVER >= 0x0300 */
342 * The ODBC C types for SQL_C_SBIGINT and SQL_C_UBIGINT
344 #if (ODBCVER >= 0x0300)
346 #if defined(_MSC_VER) && (_MSC_VER >= 900)
347 # define ODBCINT64 __int64
351 # if (SIZEOF_LONG == 8)
352 # define ODBCINT64 long
354 # define ODBCINT64 long long
356 #endif /* ODBCINT64 */
358 #if defined (ODBCINT64)
359 typedef signed ODBCINT64 SQLBIGINT
;
360 typedef unsigned ODBCINT64 SQLUBIGINT
;
361 #endif /* ODBCINT64 */
363 #endif /* ODBCVER >= 0x0300 */
367 * The internal representation of the numeric data type
369 #if (ODBCVER >= 0x0300)
370 #define SQL_MAX_NUMERIC_LEN 16
371 typedef struct tagSQL_NUMERIC_STRUCT
375 SQLCHAR sign
; /* 0 for negative, 1 for positive */
376 SQLCHAR val
[SQL_MAX_NUMERIC_LEN
];
379 #endif /* ODBCVER >= 0x0300 */
382 #if (ODBCVER >= 0x0350)
384 typedef GUID SQLGUID
;
386 typedef struct tagSQLGUID
389 unsigned short Data2
;
390 unsigned short Data3
;
391 unsigned char Data4
[8]; /* BYTE */
394 #endif /* GUID_DEFINED */
395 #endif /* ODBCVER >= 0x0350 */
399 typedef unsigned short SQLWCHAR
;
403 # if defined(__cplusplus) || \
404 defined(_WCHAR_T) || \
405 defined(_WCHAR_T_DEFINED) || \
406 defined(_WCHAR_T_DEFINED_) || \
407 defined(_WCHAR_T_DECLARED) || \
408 defined(_BSD_WCHAR_T_DEFINED_) || \
409 defined(_BSD_WCHAR_T_) || \
410 defined(_BSD_CT_RUNE_T_) || \
411 defined(__DEFINED_wchar_t)
412 typedef wchar_t SQLWCHAR
;
414 # error Please make sure your system supports the wchar_t type
420 typedef SQLWCHAR SQLTCHAR
;
422 typedef SQLCHAR SQLTCHAR
;
429 #endif /* _SQLTYPES_H */