]>
Commit | Line | Data |
---|---|---|
1 | #ifndef _INTRINSIC_SQLEXT_H | |
2 | # define _INTRINSIC_SQLEXT_H | |
3 | ||
4 | # include <../iodbc/isql.h> | |
5 | ||
6 | # define SQL_STILL_EXECUTING 2 | |
7 | # define SQL_NEED_DATA 99 | |
8 | ||
9 | /* extend SQL datatypes */ | |
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) | |
21 | ||
22 | /* C to SQL datatype mapping */ | |
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 | |
40 | ||
41 | # if defined(SQL_TYPE_MIN) | |
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). | |
47 | */ | |
48 | # endif | |
49 | ||
50 | # define SQL_ALL_TYPES 0 | |
51 | ||
52 | /* SQLDriverConnect flag values */ | |
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 | |
57 | ||
58 | /* SQLSetParam extensions */ | |
59 | # define SQL_DEFAULT_PARAM (-5) | |
60 | # define SQL_IGNORE (-6) | |
61 | ||
62 | /* function number for SQLGetFunctions and _iodbcdm_getproc */ | |
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 | |
130 | ||
131 | /* SQLGetInfo infor number */ | |
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 | |
141 | ||
142 | # define SQL_TXN_ISOLATION_OPTION 72 | |
143 | # define SQL_NON_NULLABLE_COLUMNS 75 | |
144 | ||
145 | # define SQL_DRIVER_HLIB 76 | |
146 | # define SQL_DRIVER_ODBC_VER 77 | |
147 | ||
148 | # define SQL_QUALIFIER_LOCATION 114 | |
149 | ||
150 | # define SQL_INFO_LAST SQL_QUALIFIER_LOCATION | |
151 | ||
152 | # define SQL_INFO_DRIVER_START 1000 | |
153 | ||
154 | ||
155 | /* SQL_TXN_ISOLATION_OPTION masks */ | |
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 | |
161 | ||
162 | /* SQL_CURSOR_COMMIT_BEHAVIOR and SQL_CURSOR_ROLLBACK_BEHAVIOR values */ | |
163 | ||
164 | # define SQL_CB_DELETE 0x0000 | |
165 | # define SQL_CB_CLOSE 0x0001 | |
166 | # define SQL_CB_PRESERVE 0x0002 | |
167 | ||
168 | /* options for SQLGetStmtOption/SQLSetStmtOption */ | |
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 | |
187 | ||
188 | ||
189 | /* SQL_QUERY_TIMEOUT options */ | |
190 | # define SQL_QUERY_TIMEOUT_DEFAULT 0UL | |
191 | ||
192 | /* SQL_MAX_ROWS options */ | |
193 | # define SQL_MAX_ROWS_DEFAULT 0UL | |
194 | ||
195 | /* SQL_MAX_LENGTH options */ | |
196 | # define SQL_MAX_LENGTH_DEFAULT 0UL | |
197 | ||
198 | /* SQL_CONCURRENCY options */ | |
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 | /* options for SQLSetConnectOption/SQLGetConnectOption */ | |
205 | # define SQL_ACCESS_MODE 101 | |
206 | # define SQL_AUTOCOMMIT 102 | |
207 | # define SQL_LOGIN_TIMEOUT 103 | |
208 | # define SQL_OPT_TRACE 104 | |
209 | # define SQL_OPT_TRACEFILE 105 | |
210 | # define SQL_TRANSLATE_DLL 106 | |
211 | # define SQL_TRANSLATE_OPTION 107 | |
212 | # define SQL_TXN_ISOLATION 108 | |
213 | # define SQL_CURRENT_QUALIFIER 109 | |
214 | # define SQL_ODBC_CURSORS 110 | |
215 | # define SQL_QUIET_MODE 111 | |
216 | # define SQL_PACKET_SIZE 112 | |
217 | # define SQL_CONN_OPT_MAX SQL_PACKET_SIZE | |
218 | # define SQL_CONNECT_OPT_DRVR_START 1000 | |
219 | ||
220 | # define SQL_CONN_OPT_MIN SQL_ACCESS_MODE | |
221 | ||
222 | /* SQL_ACCESS_MODE options */ | |
223 | # define SQL_MODE_READ_WRITE 0UL | |
224 | # define SQL_MODE_READ_ONLY 1UL | |
225 | # define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE | |
226 | ||
227 | /* SQL_AUTOCOMMIT options */ | |
228 | # define SQL_AUTOCOMMIT_OFF 0UL | |
229 | # define SQL_AUTOCOMMIT_ON 1UL | |
230 | # define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON | |
231 | ||
232 | /* SQL_LOGIN_TIMEOUT options */ | |
233 | # define SQL_LOGIN_TIMEOUT_DEFAULT 15UL | |
234 | ||
235 | /* SQL_OPT_TRACE options */ | |
236 | # define SQL_OPT_TRACE_OFF 0UL | |
237 | # define SQL_OPT_TRACE_ON 1UL | |
238 | # define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF | |
239 | # define SQL_OPT_TRACE_FILE_DEFAULT "odbc.log" | |
240 | ||
241 | /* SQL_ODBC_CURSORS options */ | |
242 | # define SQL_CUR_USE_IF_NEEDED 0UL | |
243 | # define SQL_CUR_USE_ODBC 1UL | |
244 | # define SQL_CUR_USE_DRIVER 2UL | |
245 | # define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER | |
246 | ||
247 | /* Column types and scopes in SQLSpecialColumns. */ | |
248 | # define SQL_BEST_ROWID 1 | |
249 | # define SQL_ROWVER 2 | |
250 | ||
251 | # define SQL_SCOPE_CURROW 0 | |
252 | # define SQL_SCOPE_TRANSACTION 1 | |
253 | # define SQL_SCOPE_SESSION 2 | |
254 | ||
255 | /* Operations in SQLSetPos */ | |
256 | # define SQL_ADD 4 | |
257 | ||
258 | /* Lock options in SQLSetPos */ | |
259 | # define SQL_LOCK_NO_CHANGE 0 | |
260 | # define SQL_LOCK_EXCLUSIVE 1 | |
261 | # define SQL_LOCK_UNLOCK 2 | |
262 | ||
263 | /* SQLExtendedFetch flag values */ | |
264 | # define SQL_FETCH_NEXT 1 | |
265 | # define SQL_FETCH_FIRST 2 | |
266 | # define SQL_FETCH_LAST 3 | |
267 | # define SQL_FETCH_PRIOR 4 | |
268 | # define SQL_FETCH_ABSOLUTE 5 | |
269 | # define SQL_FETCH_RELATIVE 6 | |
270 | # define SQL_FETCH_BOOKMARK 8 | |
271 | ||
272 | /* Defines for SQLBindParameter/SQLProcedureColumns */ | |
273 | # define SQL_PARAM_TYPE_UNKNOWN 0 | |
274 | # define SQL_PARAM_INPUT 1 | |
275 | # define SQL_PARAM_INPUT_OUTPUT 2 | |
276 | # define SQL_RESULT_COL 3 | |
277 | # define SQL_PARAM_OUTPUT 4 | |
278 | ||
279 | /* Defines used by Driver Manager for mapping SQLSetParam to SQLBindParameter */ | |
280 | # define SQL_PARAM_TYPE_DEFAULT SQL_PARAM_INPUT_OUTPUT | |
281 | # define SQL_SETPARAM_VALUE_MAX (-1L) | |
282 | ||
283 | /* SQLStatistics flag values */ | |
284 | # define SQL_INDEX_UNIQUE 0 | |
285 | # define SQL_INDEX_ALL 1 | |
286 | ||
287 | # define SQL_QUICK 0 | |
288 | # define SQL_ENSURE 1 | |
289 | ||
290 | /* SQLSetScrollOption flag values */ | |
291 | # define SQL_SCROLL_FORWARD_ONLY 0L | |
292 | # define SQL_SCROLL_KEYSET_DRIVEN (-1L) | |
293 | # define SQL_SCROLL_DYNAMIC (-2L) | |
294 | # define SQL_SCROLL_STATIC (-3L) | |
295 | ||
296 | # ifdef __cplusplus | |
297 | extern "C" { | |
298 | # endif | |
299 | ||
300 | RETCODE SQL_API SQLSetConnectOption (HDBC, UWORD, UDWORD); | |
301 | RETCODE SQL_API SQLNumResultCols ( HSTMT, SWORD FAR* ); | |
302 | ||
303 | # ifdef __cplusplus | |
304 | } | |
305 | # endif | |
306 | ||
307 | #endif |