1/*
2 *  iodbcext.h
3 *
4 *  $Id: iodbcext.h,v 1.5 2006/01/20 15:58:34 source Exp $
5 *
6 *  iODBC extensions and changes to the SAG specifications
7 *  for third party drivers
8 *
9 *  The iODBC driver manager.
10 *
11 *  Copyright (C) 1996-2006 by OpenLink Software <iodbc@openlinksw.com>
12 *  All Rights Reserved.
13 *
14 *  This software is released under the terms of either of the following
15 *  licenses:
16 *
17 *      - GNU Library General Public License (see LICENSE.LGPL)
18 *      - The BSD License (see LICENSE.BSD).
19 *
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.
23 *
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:
28 *
29 *      http://www.iodbc.org
30 *
31 *
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.
38 *
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.
43 *
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
47 *
48 *
49 *  The BSD License
50 *  ===============
51 *  Redistribution and use in source and binary forms, with or without
52 *  modification, are permitted provided that the following conditions
53 *  are met:
54 *
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
60 *     distribution.
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.
64 *
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.
76 *
77 */
78
79#ifndef _IODBCEXT_H
80#define _IODBCEXT_H
81
82
83/*
84 * OpenLink API Extensions
85 */
86#define SQL_GETLASTROWID		1048L
87#define SQL_GETLASTSERIAL		1049L
88#define SQL_CONCUR_VAL_EXTENT		1050L
89#define SQL_APPLICATION_NAME		1051L /* connect option */
90#define SQL_PARSE_FWD_ONLY_REQ		1052L
91#define SQL_DESC_KEY			1053L
92#define SQL_APPEND_KEYS			1054L
93#define SQL_DESC_EXPR			1055L
94#define SQL_ATTR_WCHAR_SIZE		1056L
95
96#define SQL_COLUMN_ROWVER 		SQL_DESC_ROWVER
97#define SQL_COLUMN_KEY 			SQL_DESC_KEY
98#define SQL_COLUMN_EXPR			SQL_DESC_EXPR
99#define SQL_ATTR_PARSE_FWD_ONLY_REQ  	SQL_PARSE_FWD_ONLY_REQ
100#define SQL_ATTR_APPEND_KEYS            SQL_APPEND_KEYS
101
102
103/*
104 *  Microsoft extensions for SQLServer
105 */
106
107/*
108 *  SQLSetConnectOption/SQLSetStmtOption driver specific defines.
109 *  Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server
110 *  driver usage.
111 */
112#define SQL_ATTR_ENLIST_IN_DTC		1207
113#define SQL_ATTR_ENLIST_IN_XA		1208
114#define SQL_ATTR_CONNECTION_DEAD	1209	/* GetConnectAttr only */
115#define SQL_COPT_SS_BASE		1200
116#define SQL_COPT_SS_REMOTE_PWD		(SQL_COPT_SS_BASE+1) /* dbrpwset SQLSetConnectOption only */
117#define SQL_COPT_SS_USE_PROC_FOR_PREP	(SQL_COPT_SS_BASE+2) /* Use create proc for SQLPrepare */
118#define SQL_COPT_SS_INTEGRATED_SECURITY	(SQL_COPT_SS_BASE+3) /* Force integrated security on login */
119#define SQL_COPT_SS_PRESERVE_CURSORS	(SQL_COPT_SS_BASE+4) /* Preserve server cursors after SQLTransact */
120#define SQL_COPT_SS_USER_DATA		(SQL_COPT_SS_BASE+5) /* dbgetuserdata/dbsetuserdata */
121#define SQL_COPT_SS_ANSI_OEM		(SQL_COPT_SS_BASE+6) /* dbsetopt/DBANSItoOEM/DBOEMtoANSI */
122#define SQL_COPT_SS_ENLIST_IN_DTC	SQL_ATTR_ENLIST_IN_DTC /* Enlist in a DTC transaction */
123#define SQL_COPT_SS_ENLIST_IN_XA	SQL_ATTR_ENLIST_IN_XA /* Enlist in a XA transaction */
124#define SQL_COPT_SS_CONNECTION_DEAD	SQL_ATTR_CONNECTION_DEAD /* dbdead SQLGetConnectOption only */
125#define SQL_COPT_SS_FALLBACK_CONNECT	(SQL_COPT_SS_BASE+10) /* Enables FallBack connections */
126#define SQL_COPT_SS_PERF_DATA		(SQL_COPT_SS_BASE+11) /* Used to access SQL Server ODBC driver performance data */
127#define SQL_COPT_SS_PERF_DATA_LOG	(SQL_COPT_SS_BASE+12) /* Used to set the logfile name for the Performance data */
128#define SQL_COPT_SS_PERF_QUERY_INTERVAL (SQL_COPT_SS_BASE+13) /* Used to set the query logging threshold in milliseconds. */
129#define SQL_COPT_SS_PERF_QUERY_LOG	(SQL_COPT_SS_BASE+14) /* Used to set the logfile name for saving queries. */
130#define SQL_COPT_SS_PERF_QUERY		(SQL_COPT_SS_BASE+15) /* Used to start and stop query logging. */
131#define SQL_COPT_SS_PERF_DATA_LOG_NOW	(SQL_COPT_SS_BASE+16) /* Used to make a statistics log entry to disk. */
132#define SQL_COPT_SS_QUOTED_IDENT	(SQL_COPT_SS_BASE+17) /* Enable/Disable Quoted Identifiers */
133#define SQL_COPT_SS_ANSI_NPW		(SQL_COPT_SS_BASE+18) /* Enable/Disable ANSI NULL, Padding and Warnings */
134#define SQL_COPT_SS_BCP			(SQL_COPT_SS_BASE+19) /* Allow BCP usage on connection */
135
136#define SQL_COPT_SS_MAX_USED		SQL_COPT_SS_BCP
137
138#define SQL_SOPT_SS_BASE		1225
139#define SQL_SOPT_SS_TEXTPTR_LOGGING	(SQL_SOPT_SS_BASE+0) /* Text pointer logging */
140#define SQL_SOPT_SS_CURRENT_COMMAND	(SQL_SOPT_SS_BASE+1) /* dbcurcmd SQLGetStmtOption only */
141#define SQL_SOPT_SS_HIDDEN_COLUMNS	(SQL_SOPT_SS_BASE+2) /* Expose FOR BROWSE hidden columns */
142#define SQL_SOPT_SS_NOBROWSETABLE	(SQL_SOPT_SS_BASE+3) /* Set NOBROWSETABLE option */
143#define SQL_SOPT_SS_REGIONALIZE		(SQL_SOPT_SS_BASE+4) /* Regionalize output character conversions */
144#define SQL_SOPT_SS_MAX_USED		SQL_SOPT_SS_REGIONALIZE
145
146
147/* Defines for use with SQL_COPT_SS_USE_PROC_FOR_PREP */
148#define SQL_UP_OFF		0L	/*Procedures won't be used for prepare*/
149#define SQL_UP_ON		1L	/*Procedures will be used for prepare*/
150#define SQL_UP_ON_DROP	2L		/*Temp procedures will be explicitly dropped*/
151#define SQL_UP_DEFAULT	SQL_UP_ON
152
153/* Defines for use with SQL_COPT_SS_INTEGRATED_SECURITY - Pre-Connect Option only */
154#define SQL_IS_OFF		0L	/* Integrated security isn't used */
155#define SQL_IS_ON		1L	/* Integrated security is used */
156#define SQL_IS_DEFAULT	SQL_IS_OFF
157
158/*	Defines for use with SQL_COPT_SS_PRESERVE_CURSORS */
159#define SQL_PC_OFF		0L	/* Cursors are closed on SQLTransact */
160#define SQL_PC_ON		1L	/* Cursors remain open on SQLTransact */
161#define SQL_PC_DEFAULT	SQL_PC_OFF
162
163/* Defines for use with SQL_COPT_SS_USER_DATA */
164#define SQL_UD_NOTSET	NULL		/* No user data pointer set */
165
166/* Defines for use with SQL_COPT_SS_ANSI_OEM */
167#define SQL_AO_OFF		0L	/* ANSI/OEM translation is not performed */
168#define SQL_AO_ON		1L	/* ANSI/OEM translation is performed */
169#define SQL_AO_DEFAULT	SQL_AO_OFF	/* Default unless DSN OEM/ANSI checkbox is checked */
170
171/* Defines for use with SQL_COPT_SS_FALLBACK_CONNECT */
172#define SQL_FB_OFF		0L	/* FallBack connections are disabled */
173#define SQL_FB_ON		1L	/* FallBack connections are enabled */
174#define SQL_FB_DEFAULT	SQL_FB_OFF
175
176/* Defines for use with SQL_COPT_SS_BCP */
177#define SQL_BCP_OFF		0L	/* BCP is not allowed on connection */
178#define SQL_BCP_ON		1L	/* BCP is allowed on connection */
179#define SQL_BCP_DEFAULT	SQL_BCP_OFF
180
181/* Defines for use with SQL_COPT_SS_QUOTED_IDENT - Pre-Connect Option only */
182#define SQL_QI_OFF		0L	/* Quoted identifiers are not supported */
183#define SQL_QI_ON		1L	/* Quoted identifiers are supported */
184#define SQL_QI_DEFAULT	SQL_QI_ON
185
186/* Defines for use with SQL_COPT_SS_ANSI_NPW - Pre-Connect Option only */
187#define SQL_AD_OFF		0L	/* ANSI NULLs, Padding and Warnings are not supported */
188#define SQL_AD_ON		1L	/* ANSI NULLs, Padding and Warnings are supported */
189#define SQL_AD_DEFAULT	SQL_AD_ON
190
191
192/* Defines for use with SQL_SOPT_SS_TEXTPTR_LOGGING */
193#define SQL_TL_OFF		0L	/* No logging on text pointer ops */
194#define SQL_TL_ON		1L	/* Logging occurs on text pointer ops */
195#define SQL_TL_DEFAULT	SQL_TL_ON
196
197/* Defines for use with SQL_SOPT_SS_HIDDEN_COLUMNS */
198#define SQL_HC_OFF		0L	/* FOR BROWSE columns are hidden */
199#define SQL_HC_ON		1L	/* FOR BROWSE columns are exposed */
200#define SQL_HC_DEFAULT	SQL_HC_OFF
201
202/* Defines for use with SQL_SOPT_SS_NOBROWSETABLE */
203#define SQL_NB_OFF		0L	/* NO_BROWSETABLE is off */
204#define SQL_NB_ON		1L	/* NO_BROWSETABLE is on */
205#define SQL_NB_DEFAULT	SQL_NB_OFF
206
207/* Defines for use with SQL_SOPT_SS_REGIONALIZE */
208#define SQL_RE_OFF		0L	/* No regionalization occurs on output character conversions */
209#define SQL_RE_ON		1L	/* Regionalization occurs on output character conversions */
210#define SQL_RE_DEFAULT	SQL_RE_OFF
211
212
213/*
214 * IBM extensions for DB2
215 */
216
217/* Options for SQLGetStmtOption/SQLSetStmtOption extensions */
218#define  SQL_CURSOR_HOLD              1250
219#define  SQL_ATTR_CURSOR_HOLD         1250
220#define  SQL_NODESCRIBE_OUTPUT        1251
221#define  SQL_ATTR_NODESCRIBE_OUTPUT   1251
222#define  SQL_NODESCRIBE_INPUT         1264
223#define  SQL_ATTR_NODESCRIBE_INPUT    1264
224#define  SQL_NODESCRIBE               SQL_NODESCRIBE_OUTPUT
225#define  SQL_ATTR_NODESCRIBE          SQL_NODESCRIBE_OUTPUT
226#define  SQL_CLOSE_BEHAVIOR           1257
227#define  SQL_ATTR_CLOSE_BEHAVIOR      1257
228#define  SQL_ATTR_CLOSEOPEN           1265
229#define  SQL_ATTR_CURRENT_PACKAGE_SET 1276
230#define  SQL_ATTR_DEFERRED_PREPARE    1277
231#define  SQL_ATTR_EARLYCLOSE          1268
232#define  SQL_ATTR_PROCESSCTL          1278
233
234/* SQL_CLOSE_BEHAVIOR values.                  */
235#define SQL_CC_NO_RELEASE             0
236#define SQL_CC_RELEASE                1
237#define SQL_CC_DEFAULT                SQL_CC_NO_RELEASE
238
239/* SQL_ATTR_DEFERRED_PREPARE values  */
240#define SQL_DEFERRED_PREPARE_ON       1
241#define SQL_DEFERRED_PREPARE_OFF      0
242#define SQL_DEFERRED_PREPARE_DEFAULT  SQL_DEFERRED_PREPARE_ON
243
244/* SQL_ATTR_EARLYCLOSE values  */
245#define SQL_EARLYCLOSE_ON             1
246#define SQL_EARLYCLOSE_OFF            0
247#define SQL_EARLYCLOSE_DEFAULT        SQL_EARLYCLOSE_ON
248
249/* SQL_ATTR_PROCESSCTL masks  */
250#define SQL_PROCESSCTL_NOTHREAD       0x00000001L
251#define SQL_PROCESSCTL_NOFORK         0x00000002L
252
253/* Options for SQL_CURSOR_HOLD */
254#define SQL_CURSOR_HOLD_ON        1
255#define SQL_CURSOR_HOLD_OFF       0
256#define SQL_CURSOR_HOLD_DEFAULT   SQL_CURSOR_HOLD_ON
257
258/* Options for SQL_NODESCRIBE_INPUT/SQL_NODESCRIBE_OUTPUT */
259#define SQL_NODESCRIBE_ON          1
260#define SQL_NODESCRIBE_OFF         0
261#define SQL_NODESCRIBE_DEFAULT     SQL_NODESCRIBE_OFF
262
263/* Options for SQLGetConnectOption/SQLSetConnectOption extensions */
264#define SQL_WCHARTYPE                1252
265#define SQL_LONGDATA_COMPAT          1253
266#define SQL_CURRENT_SCHEMA           1254
267#define SQL_DB2EXPLAIN               1258
268#define SQL_DB2ESTIMATE              1259
269#define SQL_PARAMOPT_ATOMIC          1260
270#define SQL_STMTTXN_ISOLATION        1261
271#define SQL_MAXCONN                  1262
272#define SQL_ATTR_WCHARTYPE          SQL_WCHARTYPE
273#define SQL_ATTR_LONGDATA_COMPAT    SQL_LONGDATA_COMPAT
274#define SQL_ATTR_CURRENT_SCHEMA     SQL_CURRENT_SCHEMA
275#define SQL_ATTR_DB2EXPLAIN         SQL_DB2EXPLAIN
276#define SQL_ATTR_DB2ESTIMATE        SQL_DB2ESTIMATE
277#define SQL_ATTR_PARAMOPT_ATOMIC    SQL_PARAMOPT_ATOMIC
278#define SQL_ATTR_STMTTXN_ISOLATION  SQL_STMTTXN_ISOLATION
279#define SQL_ATTR_MAXCONN            SQL_MAXCONN
280
281/* Options for SQLSetConnectOption, SQLSetEnvAttr */
282#define SQL_CONNECTTYPE              1255
283#define SQL_SYNC_POINT               1256
284#define SQL_MINMEMORY_USAGE          1263
285#define SQL_CONN_CONTEXT             1269
286#define SQL_ATTR_INHERIT_NULL_CONNECT    1270
287#define SQL_ATTR_FORCE_CONVERSION_ON_CLIENT 1275
288#define SQL_ATTR_CONNECTTYPE         SQL_CONNECTTYPE
289#define SQL_ATTR_SYNC_POINT          SQL_SYNC_POINT
290#define SQL_ATTR_MINMEMORY_USAGE     SQL_MINMEMORY_USAGE
291#define SQL_ATTR_CONN_CONTEXT        SQL_CONN_CONTEXT
292
293/* Options for SQL_LONGDATA_COMPAT */
294#define SQL_LD_COMPAT_YES            1
295#define SQL_LD_COMPAT_NO             0
296#define SQL_LD_COMPAT_DEFAULT        SQL_LD_COMPAT_NO
297
298/*  Options for SQL_PARAMOPT_ATOMIC */
299#define SQL_ATOMIC_YES               1
300#define SQL_ATOMIC_NO                0
301#define SQL_ATOMIC_DEFAULT           SQL_ATOMIC_YES
302
303/* Options for SQL_CONNECT_TYPE */
304#define SQL_CONCURRENT_TRANS         1
305#define SQL_COORDINATED_TRANS        2
306#define SQL_CONNECTTYPE_DEFAULT      SQL_CONCURRENT_TRANS
307
308/* Options for SQL_SYNCPOINT */
309#define SQL_ONEPHASE                 1
310#define SQL_TWOPHASE                 2
311#define SQL_SYNCPOINT_DEFAULT        SQL_ONEPHASE
312
313/* Options for SQL_DB2ESTIMATE */
314#define SQL_DB2ESTIMATE_ON           1
315#define SQL_DB2ESTIMATE_OFF          0
316#define SQL_DB2ESTIMATE_DEFAULT      SQL_DB2ESTIMATE_OFF
317
318/* Options for SQL_DB2EXPLAIN */
319#define SQL_DB2EXPLAIN_OFF              0x00000000L
320#define SQL_DB2EXPLAIN_SNAPSHOT_ON      0x00000001L
321#define SQL_DB2EXPLAIN_MODE_ON          0x00000002L
322#define SQL_DB2EXPLAIN_SNAPSHOT_MODE_ON SQL_DB2EXPLAIN_SNAPSHOT_ON+SQL_DB2EXPLAIN_MODE_ON
323#define SQL_DB2EXPLAIN_ON               SQL_DB2EXPLAIN_SNAPSHOT_ON
324#define SQL_DB2EXPLAIN_DEFAULT          SQL_DB2EXPLAIN_OFF
325
326/* Options for SQL_WCHARTYPE
327 * Note that you can only specify SQL_WCHARTYPE_CONVERT if you have an
328 * external compile flag SQL_WCHART_CONVERT defined
329 */
330#ifdef SQL_WCHART_CONVERT
331#define SQL_WCHARTYPE_CONVERT        1
332#endif
333#define SQL_WCHARTYPE_NOCONVERT      0
334#define SQL_WCHARTYPE_DEFAULT        SQL_WCHARTYPE_NOCONVERT
335
336#endif /* _IODBCEXT_H */
337