]>
Commit | Line | Data |
---|---|---|
7e616b10 | 1 | #ifndef _INTRINSIC_SQLEXT_H |
1a6944fd RR |
2 | # define _INTRINSIC_SQLEXT_H |
3 | ||
7e616b10 | 4 | # include <isql.h> |
1a6944fd | 5 | |
7e616b10 RR |
6 | # define SQL_STILL_EXECUTING 2 |
7 | # define SQL_NEED_DATA 99 | |
1a6944fd RR |
8 | |
9 | /* extend SQL datatypes */ | |
7e616b10 RR |
10 | # define SQL_DATE 9 |
11 | # define SQL_TIME 10 | |
12 | # define SQL_TIMESTAMP 11 | |
13 | # define SQL_LONGVARCHAR (-1) | |
14 | # define SQL_BINARY (-2) | |
15 | # define SQL_VARBINARY (-3) | |
16 | # define SQL_LONGVARBINARY (-4) | |
17 | # define SQL_BIGINT (-5) | |
18 | # define SQL_TINYINT (-6) | |
19 | # define SQL_BIT (-7) /* conflict with SQL3 ??? */ | |
20 | # define SQL_TYPE_DRIVER_START (-80) | |
1a6944fd RR |
21 | |
22 | /* C to SQL datatype mapping */ | |
7e616b10 RR |
23 | # define SQL_C_DATE SQL_DATE |
24 | # define SQL_C_TIME SQL_TIME | |
25 | # define SQL_C_TIMESTAMP SQL_TIMESTAMP | |
26 | # define SQL_C_BINARY SQL_BINARY | |
27 | # define SQL_C_BIT SQL_BIT | |
28 | # define SQL_C_TINYINT SQL_TINYINT | |
29 | ||
30 | # define SQL_SIGNED_OFFSET (-20) | |
31 | # define SQL_UNSIGNED_OFFSET (-22) | |
32 | ||
33 | # define SQL_C_SLONG (SQL_C_LONG + SQL_SIGNED_OFFSET) | |
34 | # define SQL_C_SSHORT (SQL_C_SHORT + SQL_SIGNED_OFFSET) | |
35 | # define SQL_C_STINYINT (SQL_TINYINT + SQL_SIGNED_OFFSET) | |
36 | # define SQL_C_ULONG (SQL_C_LONG + SQL_UNSIGNED_OFFSET) | |
37 | # define SQL_C_USHORT (SQL_C_SHORT + SQL_UNSIGNED_OFFSET) | |
38 | # define SQL_C_UTINYINT (SQL_TINYINT + SQL_UNSIGNED_OFFSET) | |
39 | # define SQL_C_BOOKMARK SQL_C_ULONG | |
1a6944fd RR |
40 | |
41 | # if defined(SQL_TYPE_MIN) | |
7e616b10 RR |
42 | # undef SQL_TYPE_MIN |
43 | # define SQL_TYPE_MIN SQL_BIT | |
44 | /* Note:If SQL_BIT uses SQL3 value (i.e. 14) then, | |
45 | * SQL_TYPE_MIN need to be defined as SQL_TINYINT | |
46 | * (i.e. -6). | |
1a6944fd RR |
47 | */ |
48 | # endif | |
49 | ||
7e616b10 | 50 | # define SQL_ALL_TYPES 0 |
1a6944fd RR |
51 | |
52 | /* SQLDriverConnect flag values */ | |
7e616b10 RR |
53 | # define SQL_DRIVER_NOPROMPT 0 |
54 | # define SQL_DRIVER_COMPLETE 1 | |
55 | # define SQL_DRIVER_PROMPT 2 | |
56 | # define SQL_DRIVER_COMPLETE_REQUIRED 3 | |
1a6944fd RR |
57 | |
58 | /* SQLSetParam extensions */ | |
7e616b10 RR |
59 | # define SQL_DEFAULT_PARAM (-5) |
60 | # define SQL_IGNORE (-6) | |
1a6944fd RR |
61 | |
62 | /* function number for SQLGetFunctions and _iodbcdm_getproc */ | |
7e616b10 RR |
63 | # define SQL_API_SQLALLOCCONNECT 1 |
64 | # define SQL_API_SQLALLOCENV 2 | |
65 | # define SQL_API_SQLALLOCSTMT 3 | |
66 | # define SQL_API_SQLBINDCOL 4 | |
67 | # define SQL_API_SQLCANCEL 5 | |
68 | # define SQL_API_SQLCOLATTRIBUTES 6 | |
69 | # define SQL_API_SQLCONNECT 7 | |
70 | # define SQL_API_SQLDESCRIBECOL 8 | |
71 | # define SQL_API_SQLDISCONNECT 9 | |
72 | # define SQL_API_SQLERROR 10 | |
73 | # define SQL_API_SQLEXECDIRECT 11 | |
74 | # define SQL_API_SQLEXECUTE 12 | |
75 | # define SQL_API_SQLFETCH 13 | |
76 | # define SQL_API_SQLFREECONNECT 14 | |
77 | # define SQL_API_SQLFREEENV 15 | |
78 | # define SQL_API_SQLFREESTMT 16 | |
79 | # define SQL_API_SQLGETCURSORNAME 17 | |
80 | # define SQL_API_SQLNUMRESULTCOLS 18 | |
81 | # define SQL_API_SQLPREPARE 19 | |
82 | # define SQL_API_SQLROWCOUNT 20 | |
83 | # define SQL_API_SQLSETCURSORNAME 21 | |
84 | # define SQL_API_SQLSETPARAM 22 | |
85 | # define SQL_API_SQLTRANSACT 23 | |
86 | ||
87 | # define SQL_NUM_FUNCTIONS 23 | |
88 | ||
89 | # define SQL_EXT_API_START 40 | |
90 | ||
91 | # define SQL_API_SQLCOLUMNS 40 | |
92 | ||
93 | # define SQL_API_SQLDRIVERCONNECT 41 | |
94 | # define SQL_API_SQLGETCONNECTOPTION 42 | |
95 | # define SQL_API_SQLGETDATA 43 | |
96 | # define SQL_API_SQLGETFUNCTIONS 44 | |
97 | # define SQL_API_SQLGETINFO 45 | |
98 | # define SQL_API_SQLGETSTMTOPTION 46 | |
99 | # define SQL_API_SQLGETTYPEINFO 47 | |
100 | # define SQL_API_SQLPARAMDATA 48 | |
101 | # define SQL_API_SQLPUTDATA 49 | |
102 | # define SQL_API_SQLSETCONNECTOPTION 50 | |
103 | # define SQL_API_SQLSETSTMTOPTION 51 | |
104 | # define SQL_API_SQLSPECIALCOLUMNS 52 | |
105 | # define SQL_API_SQLSTATISTICS 53 | |
106 | # define SQL_API_SQLTABLES 54 | |
107 | ||
108 | # define SQL_API_SQLBROWSECONNECT 55 | |
109 | # define SQL_API_SQLCOLUMNPRIVILEGES 56 | |
110 | # define SQL_API_SQLDATASOURCES 57 | |
111 | # define SQL_API_SQLDESCRIBEPARAM 58 | |
112 | # define SQL_API_SQLEXTENDEDFETCH 59 | |
113 | # define SQL_API_SQLFOREIGNKEYS 60 | |
114 | # define SQL_API_SQLMORERESULTS 61 | |
115 | # define SQL_API_SQLNATIVESQL 62 | |
116 | # define SQL_API_SQLNUMPARAMS 63 | |
117 | # define SQL_API_SQLPARAMOPTIONS 64 | |
118 | # define SQL_API_SQLPRIMARYKEYS 65 | |
119 | # define SQL_API_SQLPROCEDURECOLUMNS 66 | |
120 | # define SQL_API_SQLPROCEDURES 67 | |
121 | # define SQL_API_SQLSETPOS 68 | |
122 | # define SQL_API_SQLSETSCROLLOPTIONS 69 | |
123 | # define SQL_API_SQLTABLEPRIVILEGES 70 | |
124 | ||
125 | # define SQL_API_SQLDRIVERS 71 | |
126 | # define SQL_API_SQLBINDPARAMETER 72 | |
127 | # define SQL_EXT_API_LAST SQL_API_SQLBINDPARAMETER | |
128 | ||
129 | # define SQL_API_ALL_FUNCTIONS 0 | |
1a6944fd RR |
130 | |
131 | /* SQLGetInfo infor number */ | |
7e616b10 RR |
132 | # define SQL_INFO_FIRST 0 |
133 | # define SQL_DRIVER_HDBC 3 | |
134 | # define SQL_DRIVER_HENV 4 | |
135 | # define SQL_DRIVER_HSTMT 5 | |
136 | # define SQL_DRIVER_NAME 6 | |
137 | # define SQL_ODBC_VER 10 | |
138 | # define SQL_CURSOR_COMMIT_BEHAVIOR 23 | |
139 | # define SQL_CURSOR_ROLLBACK_BEHAVIOR 24 | |
140 | # define SQL_DEFAULT_TXN_ISOLATION 26 | |
1a6944fd | 141 | |
7e616b10 RR |
142 | # define SQL_TXN_ISOLATION_OPTION 72 |
143 | # define SQL_NON_NULLABLE_COLUMNS 75 | |
1a6944fd | 144 | |
7e616b10 RR |
145 | # define SQL_DRIVER_HLIB 76 |
146 | # define SQL_DRIVER_ODBC_VER 77 | |
1a6944fd | 147 | |
7e616b10 | 148 | # define SQL_QUALIFIER_LOCATION 114 |
1a6944fd | 149 | |
7e616b10 | 150 | # define SQL_INFO_LAST SQL_QUALIFIER_LOCATION |
1a6944fd | 151 | |
7e616b10 | 152 | # define SQL_INFO_DRIVER_START 1000 |
1a6944fd RR |
153 | |
154 | ||
155 | /* SQL_TXN_ISOLATION_OPTION masks */ | |
7e616b10 RR |
156 | # define SQL_TXN_READ_UNCOMMITTED 0x00000001L |
157 | # define SQL_TXN_READ_COMMITTED 0x00000002L | |
158 | # define SQL_TXN_REPEATABLE_READ 0x00000004L | |
159 | # define SQL_TXN_SERIALIZABLE 0x00000008L | |
160 | # define SQL_TXN_VERSIONING 0x00000010L | |
1a6944fd RR |
161 | |
162 | /* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */ | |
163 | ||
7e616b10 RR |
164 | # define SQL_CB_DELETE 0x0000 |
165 | # define SQL_CB_CLOSE 0x0001 | |
166 | # define SQL_CB_PRESERVE 0x0002 | |
1a6944fd RR |
167 | |
168 | /* options for SQLGetStmtOption/SQLSetStmtOption */ | |
7e616b10 RR |
169 | # define SQL_QUERY_TIMEOUT 0 |
170 | # define SQL_MAX_ROWS 1 | |
171 | # define SQL_NOSCAN 2 | |
172 | # define SQL_MAX_LENGTH 3 | |
173 | # define SQL_ASYNC_ENABLE 4 | |
174 | # define SQL_BIND_TYPE 5 | |
175 | # define SQL_CURSOR_TYPE 6 | |
176 | # define SQL_CONCURRENCY 7 | |
177 | # define SQL_KEYSET_SIZE 8 | |
178 | # define SQL_ROWSET_SIZE 9 | |
179 | # define SQL_SIMULATE_CURSOR 10 | |
180 | # define SQL_RETRIEVE_DATA 11 | |
181 | # define SQL_USE_BOOKMARKS 12 | |
182 | # define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */ | |
183 | # define SQL_ROW_NUMBER 14 /* GetStmtOption Only */ | |
184 | # define SQL_STMT_OPT_MAX SQL_ROW_NUMBER | |
185 | ||
186 | # define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT | |
1a6944fd RR |
187 | |
188 | ||
189 | /* SQL_QUERY_TIMEOUT options */ | |
7e616b10 | 190 | # define SQL_QUERY_TIMEOUT_DEFAULT 0UL |
1a6944fd RR |
191 | |
192 | /* SQL_MAX_ROWS options */ | |
7e616b10 | 193 | # define SQL_MAX_ROWS_DEFAULT 0UL |
1a6944fd RR |
194 | |
195 | /* SQL_MAX_LENGTH options */ | |
7e616b10 | 196 | # define SQL_MAX_LENGTH_DEFAULT 0UL |
1a6944fd RR |
197 | |
198 | /* SQL_CONCURRENCY options */ | |
7e616b10 RR |
199 | # define SQL_CONCUR_READ_ONLY 1 |
200 | # define SQL_CONCUR_LOCK 2 | |
201 | # define SQL_CONCUR_ROWVER 3 | |
202 | # define SQL_CONCUR_VALUES 4 | |
203 | ||
204 | /* SQL_CURSOR_TYPE options */ | |
205 | #define SQL_CURSOR_FORWARD_ONLY 0UL | |
206 | #define SQL_CURSOR_KEYSET_DRIVEN 1UL | |
207 | #define SQL_CURSOR_DYNAMIC 2UL | |
208 | #define SQL_CURSOR_STATIC 3UL | |
209 | #define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY | |
1a6944fd RR |
210 | |
211 | /* options for SQLSetConnectOption/SQLGetConnectOption */ | |
7e616b10 RR |
212 | # define SQL_ACCESS_MODE 101 |
213 | # define SQL_AUTOCOMMIT 102 | |
214 | # define SQL_LOGIN_TIMEOUT 103 | |
215 | # define SQL_OPT_TRACE 104 | |
216 | # define SQL_OPT_TRACEFILE 105 | |
217 | # define SQL_TRANSLATE_DLL 106 | |
218 | # define SQL_TRANSLATE_OPTION 107 | |
219 | # define SQL_TXN_ISOLATION 108 | |
220 | # define SQL_CURRENT_QUALIFIER 109 | |
221 | # define SQL_ODBC_CURSORS 110 | |
222 | # define SQL_QUIET_MODE 111 | |
223 | # define SQL_PACKET_SIZE 112 | |
224 | # define SQL_CONN_OPT_MAX SQL_PACKET_SIZE | |
225 | # define SQL_CONNECT_OPT_DRVR_START 1000 | |
226 | ||
227 | # define SQL_CONN_OPT_MIN SQL_ACCESS_MODE | |
1a6944fd RR |
228 | |
229 | /* SQL_ACCESS_MODE options */ | |
7e616b10 RR |
230 | # define SQL_MODE_READ_WRITE 0UL |
231 | # define SQL_MODE_READ_ONLY 1UL | |
232 | # define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE | |
1a6944fd RR |
233 | |
234 | /* SQL_AUTOCOMMIT options */ | |
7e616b10 RR |
235 | # define SQL_AUTOCOMMIT_OFF 0UL |
236 | # define SQL_AUTOCOMMIT_ON 1UL | |
237 | # define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON | |
1a6944fd RR |
238 | |
239 | /* SQL_LOGIN_TIMEOUT options */ | |
7e616b10 | 240 | # define SQL_LOGIN_TIMEOUT_DEFAULT 15UL |
1a6944fd RR |
241 | |
242 | /* SQL_OPT_TRACE options */ | |
7e616b10 RR |
243 | # define SQL_OPT_TRACE_OFF 0UL |
244 | # define SQL_OPT_TRACE_ON 1UL | |
245 | # define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF | |
246 | # define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log" | |
1a6944fd RR |
247 | |
248 | /* SQL_ODBC_CURSORS options */ | |
7e616b10 RR |
249 | # define SQL_CUR_USE_IF_NEEDED 0UL |
250 | # define SQL_CUR_USE_ODBC 1UL | |
251 | # define SQL_CUR_USE_DRIVER 2UL | |
252 | # define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER | |
1a6944fd RR |
253 | |
254 | /* Column types and scopes in SQLSpecialColumns. */ | |
7e616b10 RR |
255 | # define SQL_BEST_ROWID 1 |
256 | # define SQL_ROWVER 2 | |
1a6944fd | 257 | |
7e616b10 RR |
258 | # define SQL_SCOPE_CURROW 0 |
259 | # define SQL_SCOPE_TRANSACTION 1 | |
260 | # define SQL_SCOPE_SESSION 2 | |
1a6944fd RR |
261 | |
262 | /* Operations in SQLSetPos */ | |
7e616b10 | 263 | # define SQL_ADD 4 |
1a6944fd RR |
264 | |
265 | /* Lock options in SQLSetPos */ | |
7e616b10 RR |
266 | # define SQL_LOCK_NO_CHANGE 0 |
267 | # define SQL_LOCK_EXCLUSIVE 1 | |
268 | # define SQL_LOCK_UNLOCK 2 | |
1a6944fd RR |
269 | |
270 | /* SQLExtendedFetch flag values */ | |
7e616b10 RR |
271 | # define SQL_FETCH_NEXT 1 |
272 | # define SQL_FETCH_FIRST 2 | |
273 | # define SQL_FETCH_LAST 3 | |
274 | # define SQL_FETCH_PRIOR 4 | |
275 | # define SQL_FETCH_ABSOLUTE 5 | |
276 | # define SQL_FETCH_RELATIVE 6 | |
277 | # define SQL_FETCH_BOOKMARK 8 | |
1a6944fd RR |
278 | |
279 | /* Defines for SQLBindParameter/SQLProcedureColumns */ | |
7e616b10 RR |
280 | # define SQL_PARAM_TYPE_UNKNOWN 0 |
281 | # define SQL_PARAM_INPUT 1 | |
282 | # define SQL_PARAM_INPUT_OUTPUT 2 | |
283 | # define SQL_RESULT_COL 3 | |
284 | # define SQL_PARAM_OUTPUT 4 | |
1a6944fd RR |
285 | |
286 | /* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */ | |
7e616b10 RR |
287 | # define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT |
288 | # define SQL_SETPARAM_VALUE_MAX (-1L) | |
1a6944fd RR |
289 | |
290 | /* SQLStatistics flag values */ | |
7e616b10 RR |
291 | # define SQL_INDEX_UNIQUE 0 |
292 | # define SQL_INDEX_ALL 1 | |
1a6944fd | 293 | |
7e616b10 RR |
294 | # define SQL_QUICK 0 |
295 | # define SQL_ENSURE 1 | |
1a6944fd RR |
296 | |
297 | /* SQLSetScrollOption flag values */ | |
7e616b10 RR |
298 | # define SQL_SCROLL_FORWARD_ONLY 0L |
299 | # define SQL_SCROLL_KEYSET_DRIVEN (-1L) | |
300 | # define SQL_SCROLL_DYNAMIC (-2L) | |
301 | # define SQL_SCROLL_STATIC (-3L) | |
1a6944fd | 302 | |
7e616b10 RR |
303 | # if defined(__cplusplus) || defined(__IBMCPP__) |
304 | extern "C" { | |
1a6944fd RR |
305 | # endif |
306 | ||
307 | RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD); | |
308 | RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* ); | |
309 | ||
7e616b10 RR |
310 | # if defined(__cplusplus) || defined(__IBMCPP__) |
311 | } | |
1a6944fd RR |
312 | # endif |
313 | ||
314 | #endif |