ntoskrnl.exe: Add stub for KeSetPriorityThread.
[wine] / include / sqlext.h
1 /*
2  * MS SQL Extension definitions
3  *
4  * Copyright (C) 1999 Xiang Li
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19  */
20
21 #ifndef __SQLEXT_H
22 #define __SQLEXT_H
23
24 #include <sql.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #define SQL_SPEC_MAJOR     3
31 #define SQL_SPEC_MINOR     51
32 #define SQL_SPEC_STRING   "03.51"
33
34 #define SQL_SQLSTATE_SIZE       5
35 #define SQL_MAX_DSN_LENGTH      32
36
37 #define SQL_MAX_OPTION_STRING_LENGTH    256
38
39 #if (ODBCVER < 0x0300)
40 #define SQL_NO_DATA_FOUND       100
41 #else
42 #define SQL_NO_DATA_FOUND       SQL_NO_DATA
43 #endif
44
45 #if (ODBCVER >= 0x0300)
46 #define SQL_HANDLE_SENV         5
47 #endif
48
49 #if (ODBCVER >= 0x0300)
50 #define SQL_ATTR_ODBC_VERSION                           200
51 #define SQL_ATTR_CONNECTION_POOLING                     201
52 #define SQL_ATTR_CP_MATCH                                       202
53 #endif
54
55 #if (ODBCVER >= 0x0300)
56 #define SQL_CP_OFF                                                      0UL
57 #define SQL_CP_ONE_PER_DRIVER                           1UL
58 #define SQL_CP_ONE_PER_HENV                                     2UL
59 #define SQL_CP_DEFAULT                                          SQL_CP_OFF
60
61 #define SQL_CP_STRICT_MATCH                                     0UL
62 #define SQL_CP_RELAXED_MATCH                            1UL
63 #define SQL_CP_MATCH_DEFAULT                            SQL_CP_STRICT_MATCH
64
65 #define SQL_OV_ODBC2                                            2UL
66 #define SQL_OV_ODBC3                                            3UL
67 #endif
68
69 #define SQL_ACCESS_MODE                 101
70 #define SQL_AUTOCOMMIT                  102
71 #define SQL_LOGIN_TIMEOUT               103
72 #define SQL_OPT_TRACE                   104
73 #define SQL_OPT_TRACEFILE               105
74 #define SQL_TRANSLATE_DLL               106
75 #define SQL_TRANSLATE_OPTION            107
76 #define SQL_TXN_ISOLATION               108
77 #define SQL_CURRENT_QUALIFIER           109
78 #define SQL_ODBC_CURSORS                110
79 #define SQL_QUIET_MODE                  111
80 #define SQL_PACKET_SIZE                 112
81
82 #if (ODBCVER >= 0x0300)
83 #define SQL_ATTR_ACCESS_MODE            SQL_ACCESS_MODE
84 #define SQL_ATTR_AUTOCOMMIT                     SQL_AUTOCOMMIT
85 #define SQL_ATTR_CONNECTION_TIMEOUT     113
86 #define SQL_ATTR_CURRENT_CATALOG        SQL_CURRENT_QUALIFIER
87 #define SQL_ATTR_DISCONNECT_BEHAVIOR    114
88 #define SQL_ATTR_ENLIST_IN_DTC          1207
89 #define SQL_ATTR_ENLIST_IN_XA           1208
90 #define SQL_ATTR_LOGIN_TIMEOUT          SQL_LOGIN_TIMEOUT
91 #define SQL_ATTR_ODBC_CURSORS           SQL_ODBC_CURSORS
92 #define SQL_ATTR_PACKET_SIZE            SQL_PACKET_SIZE
93 #define SQL_ATTR_QUIET_MODE                     SQL_QUIET_MODE
94 #define SQL_ATTR_TRACE                          SQL_OPT_TRACE
95 #define SQL_ATTR_TRACEFILE                      SQL_OPT_TRACEFILE
96 #define SQL_ATTR_TRANSLATE_LIB          SQL_TRANSLATE_DLL
97 #define SQL_ATTR_TRANSLATE_OPTION       SQL_TRANSLATE_OPTION
98 #define SQL_ATTR_TXN_ISOLATION          SQL_TXN_ISOLATION
99 #endif
100
101 #define SQL_ATTR_CONNECTION_DEAD        1209
102
103 #if (ODBCVER >= 0x0351)
104 #define SQL_ATTR_ANSI_APP                       115
105 #endif
106
107 #if (ODBCVER < 0x0300)
108 #define SQL_CONNECT_OPT_DRVR_START      1000
109 #endif
110
111 #if (ODBCVER < 0x0300)
112 #define SQL_CONN_OPT_MAX                SQL_PACKET_SIZE
113 #define SQL_CONN_OPT_MIN                SQL_ACCESS_MODE
114 #endif
115
116 #define SQL_MODE_READ_WRITE             0UL
117 #define SQL_MODE_READ_ONLY              1UL
118 #define SQL_MODE_DEFAULT                SQL_MODE_READ_WRITE
119
120 #define SQL_AUTOCOMMIT_OFF              0UL
121 #define SQL_AUTOCOMMIT_ON               1UL
122 #define SQL_AUTOCOMMIT_DEFAULT          SQL_AUTOCOMMIT_ON
123
124 #define SQL_LOGIN_TIMEOUT_DEFAULT       15UL
125
126 #define SQL_OPT_TRACE_OFF               0UL
127 #define SQL_OPT_TRACE_ON                1UL
128 #define SQL_OPT_TRACE_DEFAULT           SQL_OPT_TRACE_OFF
129 #define SQL_OPT_TRACE_FILE_DEFAULT      "\\SQL.LOG"
130
131 #define SQL_CUR_USE_IF_NEEDED           0UL
132 #define SQL_CUR_USE_ODBC                1UL
133 #define SQL_CUR_USE_DRIVER              2UL
134 #define SQL_CUR_DEFAULT                 SQL_CUR_USE_DRIVER
135
136 #if (ODBCVER >= 0x0300)
137 #define SQL_DB_RETURN_TO_POOL                   0UL
138 #define SQL_DB_DISCONNECT                               1UL
139 #define SQL_DB_DEFAULT                                  SQL_DB_RETURN_TO_POOL
140
141 #define SQL_DTC_DONE                                    0L
142 #endif
143
144 #define SQL_CD_TRUE                                     1L
145 #define SQL_CD_FALSE                                    0L
146
147 #if (ODBCVER >= 0x0351)
148 #define SQL_AA_TRUE                                     1L
149 #define SQL_AA_FALSE                                    0L
150 #endif
151
152 #define SQL_QUERY_TIMEOUT               0
153 #define SQL_MAX_ROWS                    1
154 #define SQL_NOSCAN                      2
155 #define SQL_MAX_LENGTH                  3
156 #define SQL_ASYNC_ENABLE                4
157 #define SQL_BIND_TYPE                   5
158 #define SQL_CURSOR_TYPE                 6
159 #define SQL_CONCURRENCY                 7
160 #define SQL_KEYSET_SIZE                 8
161 #define SQL_ROWSET_SIZE                 9
162 #define SQL_SIMULATE_CURSOR             10
163 #define SQL_RETRIEVE_DATA               11
164 #define SQL_USE_BOOKMARKS               12
165 #define SQL_GET_BOOKMARK                13
166 #define SQL_ROW_NUMBER                  14
167
168 #if (ODBCVER >= 0x0300)
169 #define SQL_ATTR_ASYNC_ENABLE                           4
170 #define SQL_ATTR_CONCURRENCY                            SQL_CONCURRENCY
171 #define SQL_ATTR_CURSOR_TYPE                            SQL_CURSOR_TYPE
172 #define SQL_ATTR_ENABLE_AUTO_IPD                        15
173 #define SQL_ATTR_FETCH_BOOKMARK_PTR                     16
174 #define SQL_ATTR_KEYSET_SIZE                            SQL_KEYSET_SIZE
175 #define SQL_ATTR_MAX_LENGTH                             SQL_MAX_LENGTH
176 #define SQL_ATTR_MAX_ROWS                               SQL_MAX_ROWS
177 #define SQL_ATTR_NOSCAN                                 SQL_NOSCAN
178 #define SQL_ATTR_PARAM_BIND_OFFSET_PTR                  17
179 #define SQL_ATTR_PARAM_BIND_TYPE                        18
180 #define SQL_ATTR_PARAM_OPERATION_PTR                    19
181 #define SQL_ATTR_PARAM_STATUS_PTR                       20
182 #define SQL_ATTR_PARAMS_PROCESSED_PTR                   21
183 #define SQL_ATTR_RETRIEVE_DATA                          SQL_RETRIEVE_DATA
184 #define SQL_ATTR_ROW_BIND_OFFSET_PTR                    23
185 #define SQL_ATTR_ROW_BIND_TYPE                          SQL_BIND_TYPE
186 #define SQL_ATTR_ROW_NUMBER                             SQL_ROW_NUMBER
187 #define SQL_ATTR_ROW_OPERATION_PTR                      24
188 #define SQL_ATTR_ROW_STATUS_PTR                         25
189 #define SQL_ATTR_ROWS_FETCHED_PTR                       26
190 #define SQL_ATTR_ROW_ARRAY_SIZE                         27
191 #define SQL_ATTR_SIMULATE_CURSOR                        SQL_SIMULATE_CURSOR
192 #define SQL_ATTR_USE_BOOKMARKS                          SQL_USE_BOOKMARKS
193
194 #endif
195
196 #if (ODBCVER < 0x0300)
197 #define SQL_STMT_OPT_MAX                SQL_ROW_NUMBER
198 #define SQL_STMT_OPT_MIN        SQL_QUERY_TIMEOUT
199 #endif
200
201 #if (ODBCVER >= 0x0300)
202 #define SQL_COL_PRED_CHAR               SQL_LIKE_ONLY
203 #define SQL_COL_PRED_BASIC              SQL_ALL_EXCEPT_LIKE
204 #endif
205
206 #if (ODBCVER >= 0x0300)
207 #define SQL_IS_POINTER                                                  (-4)
208 #define SQL_IS_UINTEGER                                                 (-5)
209 #define SQL_IS_INTEGER                                                  (-6)
210 #define SQL_IS_USMALLINT                                                (-7)
211 #define SQL_IS_SMALLINT                                                 (-8)
212 #endif
213
214 #if (ODBCVER >= 0x0300)
215 #define SQL_PARAM_BIND_BY_COLUMN                        0UL
216 #define SQL_PARAM_BIND_TYPE_DEFAULT                     SQL_PARAM_BIND_BY_COLUMN
217 #endif
218
219 #define SQL_QUERY_TIMEOUT_DEFAULT       0UL
220
221 #define SQL_MAX_ROWS_DEFAULT            0UL
222
223 #define SQL_NOSCAN_OFF                  0UL
224 #define SQL_NOSCAN_ON                   1UL
225 #define SQL_NOSCAN_DEFAULT              SQL_NOSCAN_OFF
226
227 #define SQL_MAX_LENGTH_DEFAULT          0UL
228
229 #define SQL_ASYNC_ENABLE_OFF                    0UL
230 #define SQL_ASYNC_ENABLE_ON                             1UL
231 #define SQL_ASYNC_ENABLE_DEFAULT        SQL_ASYNC_ENABLE_OFF
232
233 #define SQL_BIND_BY_COLUMN              0UL
234 #define SQL_BIND_TYPE_DEFAULT           SQL_BIND_BY_COLUMN
235
236 #define SQL_CONCUR_READ_ONLY            1
237 #define SQL_CONCUR_LOCK                 2
238 #define SQL_CONCUR_ROWVER               3
239 #define SQL_CONCUR_VALUES               4
240 #define SQL_CONCUR_DEFAULT              SQL_CONCUR_READ_ONLY
241
242 #define SQL_CURSOR_FORWARD_ONLY         0UL
243 #define SQL_CURSOR_KEYSET_DRIVEN        1UL
244 #define SQL_CURSOR_DYNAMIC              2UL
245 #define SQL_CURSOR_STATIC               3UL
246 #define SQL_CURSOR_TYPE_DEFAULT         SQL_CURSOR_FORWARD_ONLY
247
248 #define SQL_ROWSET_SIZE_DEFAULT         1UL
249
250 #define SQL_KEYSET_SIZE_DEFAULT         0UL
251
252 #define SQL_SC_NON_UNIQUE               0UL
253 #define SQL_SC_TRY_UNIQUE               1UL
254 #define SQL_SC_UNIQUE                   2UL
255
256 #define SQL_RD_OFF                      0UL
257 #define SQL_RD_ON                       1UL
258 #define SQL_RD_DEFAULT                  SQL_RD_ON
259
260 #define SQL_UB_OFF                      0UL
261 #define SQL_UB_ON                       01UL
262 #define SQL_UB_DEFAULT                  SQL_UB_OFF
263
264 #if (ODBCVER >= 0x0300)
265 #define SQL_UB_FIXED                                    SQL_UB_ON
266 #define SQL_UB_VARIABLE                                 2UL
267 #endif
268
269 #if (ODBCVER >= 0x0300)
270 #define SQL_DESC_ARRAY_SIZE                                     20
271 #define SQL_DESC_ARRAY_STATUS_PTR                               21
272 #define SQL_DESC_AUTO_UNIQUE_VALUE                              SQL_COLUMN_AUTO_INCREMENT
273 #define SQL_DESC_BASE_COLUMN_NAME                               22
274 #define SQL_DESC_BASE_TABLE_NAME                                23
275 #define SQL_DESC_BIND_OFFSET_PTR                                24
276 #define SQL_DESC_BIND_TYPE                                      25
277 #define SQL_DESC_CASE_SENSITIVE                                 SQL_COLUMN_CASE_SENSITIVE
278 #define SQL_DESC_CATALOG_NAME                                   SQL_COLUMN_QUALIFIER_NAME
279 #define SQL_DESC_CONCISE_TYPE                                   SQL_COLUMN_TYPE
280 #define SQL_DESC_DATETIME_INTERVAL_PRECISION                    26
281 #define SQL_DESC_DISPLAY_SIZE                                   SQL_COLUMN_DISPLAY_SIZE
282 #define SQL_DESC_FIXED_PREC_SCALE                               SQL_COLUMN_MONEY
283 #define SQL_DESC_LABEL                                          SQL_COLUMN_LABEL
284 #define SQL_DESC_LITERAL_PREFIX                                 27
285 #define SQL_DESC_LITERAL_SUFFIX                                 28
286 #define SQL_DESC_LOCAL_TYPE_NAME                                29
287 #define SQL_DESC_MAXIMUM_SCALE                                  30
288 #define SQL_DESC_MINIMUM_SCALE                                  31
289 #define SQL_DESC_NUM_PREC_RADIX                                 32
290 #define SQL_DESC_PARAMETER_TYPE                                 33
291 #define SQL_DESC_ROWS_PROCESSED_PTR                             34
292 #if (ODBCVER >= 0x0350)
293 #define SQL_DESC_ROWVER                                         35
294 #endif
295 #define SQL_DESC_SCHEMA_NAME                                    SQL_COLUMN_OWNER_NAME
296 #define SQL_DESC_SEARCHABLE                                     SQL_COLUMN_SEARCHABLE
297 #define SQL_DESC_TYPE_NAME                                      SQL_COLUMN_TYPE_NAME
298 #define SQL_DESC_TABLE_NAME                                     SQL_COLUMN_TABLE_NAME
299 #define SQL_DESC_UNSIGNED                                       SQL_COLUMN_UNSIGNED
300 #define SQL_DESC_UPDATABLE                                      SQL_COLUMN_UPDATABLE
301 #endif
302
303 #if (ODBCVER >= 0x0300)
304 #define SQL_DIAG_CURSOR_ROW_COUNT                       (-1249)
305 #define SQL_DIAG_ROW_NUMBER                             (-1248)
306 #define SQL_DIAG_COLUMN_NUMBER                          (-1247)
307 #endif
308
309 #define SQL_DATE                                9
310 #if (ODBCVER >= 0x0300)
311 #define SQL_INTERVAL                            10
312 #endif
313 #define SQL_TIME                                10
314 #define SQL_TIMESTAMP                           11
315 #define SQL_LONGVARCHAR                         (-1)
316 #define SQL_BINARY                              (-2)
317 #define SQL_VARBINARY                           (-3)
318 #define SQL_LONGVARBINARY                       (-4)
319 #define SQL_BIGINT                              (-5)
320 #define SQL_TINYINT                             (-6)
321 #define SQL_BIT                                 (-7)
322 #if (ODBCVER >= 0x0350)
323 #define SQL_GUID                                (-11)
324 #endif
325
326 #if (ODBCVER >= 0x0300)
327 #define SQL_CODE_YEAR                           1
328 #define SQL_CODE_MONTH                          2
329 #define SQL_CODE_DAY                            3
330 #define SQL_CODE_HOUR                           4
331 #define SQL_CODE_MINUTE                         5
332 #define SQL_CODE_SECOND                         6
333 #define SQL_CODE_YEAR_TO_MONTH                  7
334 #define SQL_CODE_DAY_TO_HOUR                    8
335 #define SQL_CODE_DAY_TO_MINUTE                  9
336 #define SQL_CODE_DAY_TO_SECOND                  10
337 #define SQL_CODE_HOUR_TO_MINUTE                 11
338 #define SQL_CODE_HOUR_TO_SECOND                 12
339 #define SQL_CODE_MINUTE_TO_SECOND               13
340
341 #define SQL_INTERVAL_YEAR                       (100 + SQL_CODE_YEAR)
342 #define SQL_INTERVAL_MONTH                      (100 + SQL_CODE_MONTH)
343 #define SQL_INTERVAL_DAY                        (100 + SQL_CODE_DAY)
344 #define SQL_INTERVAL_HOUR                       (100 + SQL_CODE_HOUR)
345 #define SQL_INTERVAL_MINUTE                     (100 + SQL_CODE_MINUTE)
346 #define SQL_INTERVAL_SECOND                     (100 + SQL_CODE_SECOND)
347 #define SQL_INTERVAL_YEAR_TO_MONTH              (100 + SQL_CODE_YEAR_TO_MONTH)
348 #define SQL_INTERVAL_DAY_TO_HOUR                (100 + SQL_CODE_DAY_TO_HOUR)
349 #define SQL_INTERVAL_DAY_TO_MINUTE              (100 + SQL_CODE_DAY_TO_MINUTE)
350 #define SQL_INTERVAL_DAY_TO_SECOND              (100 + SQL_CODE_DAY_TO_SECOND)
351 #define SQL_INTERVAL_HOUR_TO_MINUTE             (100 + SQL_CODE_HOUR_TO_MINUTE)
352 #define SQL_INTERVAL_HOUR_TO_SECOND             (100 + SQL_CODE_HOUR_TO_SECOND)
353 #define SQL_INTERVAL_MINUTE_TO_SECOND           (100 + SQL_CODE_MINUTE_TO_SECOND)
354
355 #else
356 #define SQL_INTERVAL_YEAR                       (-80)
357 #define SQL_INTERVAL_MONTH                      (-81)
358 #define SQL_INTERVAL_YEAR_TO_MONTH              (-82)
359 #define SQL_INTERVAL_DAY                        (-83)
360 #define SQL_INTERVAL_HOUR                       (-84)
361 #define SQL_INTERVAL_MINUTE                     (-85)
362 #define SQL_INTERVAL_SECOND                     (-86)
363 #define SQL_INTERVAL_DAY_TO_HOUR                (-87)
364 #define SQL_INTERVAL_DAY_TO_MINUTE              (-88)
365 #define SQL_INTERVAL_DAY_TO_SECOND              (-89)
366 #define SQL_INTERVAL_HOUR_TO_MINUTE             (-90)
367 #define SQL_INTERVAL_HOUR_TO_SECOND             (-91)
368 #define SQL_INTERVAL_MINUTE_TO_SECOND           (-92)
369 #endif
370
371
372 #if (ODBCVER <= 0x0300)
373 #define SQL_UNICODE                             (-95)
374 #define SQL_UNICODE_VARCHAR                     (-96)
375 #define SQL_UNICODE_LONGVARCHAR                 (-97)
376 #define SQL_UNICODE_CHAR                        SQL_UNICODE
377 #else
378
379 #define SQL_UNICODE                     SQL_WCHAR
380 #define SQL_UNICODE_VARCHAR             SQL_WVARCHAR
381 #define SQL_UNICODE_LONGVARCHAR SQL_WLONGVARCHAR
382 #define SQL_UNICODE_CHAR                SQL_WCHAR
383 #endif
384
385 #if (ODBCVER < 0x0300)
386 #define SQL_TYPE_DRIVER_START                   SQL_INTERVAL_YEAR
387 #define SQL_TYPE_DRIVER_END                     SQL_UNICODE_LONGVARCHAR
388 #endif
389
390 #define SQL_C_CHAR    SQL_CHAR
391 #define SQL_C_LONG    SQL_INTEGER
392 #define SQL_C_SHORT   SQL_SMALLINT
393 #define SQL_C_FLOAT   SQL_REAL
394 #define SQL_C_DOUBLE  SQL_DOUBLE
395 #if (ODBCVER >= 0x0300)
396 #define SQL_C_NUMERIC           SQL_NUMERIC
397 #endif
398 #define SQL_C_DEFAULT 99
399
400 #define SQL_SIGNED_OFFSET       (-20)
401 #define SQL_UNSIGNED_OFFSET     (-22)
402
403 #define SQL_C_DATE       SQL_DATE
404 #define SQL_C_TIME       SQL_TIME
405 #define SQL_C_TIMESTAMP  SQL_TIMESTAMP
406 #if (ODBCVER >= 0x0300)
407 #define SQL_C_TYPE_DATE                         SQL_TYPE_DATE
408 #define SQL_C_TYPE_TIME                         SQL_TYPE_TIME
409 #define SQL_C_TYPE_TIMESTAMP                    SQL_TYPE_TIMESTAMP
410 #define SQL_C_INTERVAL_YEAR                     SQL_INTERVAL_YEAR
411 #define SQL_C_INTERVAL_MONTH                    SQL_INTERVAL_MONTH
412 #define SQL_C_INTERVAL_DAY                      SQL_INTERVAL_DAY
413 #define SQL_C_INTERVAL_HOUR                     SQL_INTERVAL_HOUR
414 #define SQL_C_INTERVAL_MINUTE                   SQL_INTERVAL_MINUTE
415 #define SQL_C_INTERVAL_SECOND                   SQL_INTERVAL_SECOND
416 #define SQL_C_INTERVAL_YEAR_TO_MONTH            SQL_INTERVAL_YEAR_TO_MONTH
417 #define SQL_C_INTERVAL_DAY_TO_HOUR              SQL_INTERVAL_DAY_TO_HOUR
418 #define SQL_C_INTERVAL_DAY_TO_MINUTE            SQL_INTERVAL_DAY_TO_MINUTE
419 #define SQL_C_INTERVAL_DAY_TO_SECOND            SQL_INTERVAL_DAY_TO_SECOND
420 #define SQL_C_INTERVAL_HOUR_TO_MINUTE           SQL_INTERVAL_HOUR_TO_MINUTE
421 #define SQL_C_INTERVAL_HOUR_TO_SECOND           SQL_INTERVAL_HOUR_TO_SECOND
422 #define SQL_C_INTERVAL_MINUTE_TO_SECOND         SQL_INTERVAL_MINUTE_TO_SECOND
423 #endif
424 #define SQL_C_BINARY     SQL_BINARY
425 #define SQL_C_BIT        SQL_BIT
426 #if (ODBCVER >= 0x0300)
427 #define SQL_C_SBIGINT   (SQL_BIGINT+SQL_SIGNED_OFFSET)
428 #define SQL_C_UBIGINT   (SQL_BIGINT+SQL_UNSIGNED_OFFSET)
429 #endif
430 #define SQL_C_TINYINT    SQL_TINYINT
431 #define SQL_C_SLONG      (SQL_C_LONG+SQL_SIGNED_OFFSET)
432 #define SQL_C_SSHORT     (SQL_C_SHORT+SQL_SIGNED_OFFSET)
433 #define SQL_C_STINYINT   (SQL_TINYINT+SQL_SIGNED_OFFSET)
434 #define SQL_C_ULONG      (SQL_C_LONG+SQL_UNSIGNED_OFFSET)
435 #define SQL_C_USHORT     (SQL_C_SHORT+SQL_UNSIGNED_OFFSET)
436 #define SQL_C_UTINYINT   (SQL_TINYINT+SQL_UNSIGNED_OFFSET)
437 #define SQL_C_BOOKMARK   SQL_C_ULONG
438
439 #if (ODBCVER >= 0x0350)
440 #define SQL_C_GUID      SQL_GUID
441 #endif
442
443 #define SQL_TYPE_NULL                   0
444 #if (ODBCVER < 0x0300)
445 #define SQL_TYPE_MIN                    SQL_BIT
446 #define SQL_TYPE_MAX                    SQL_VARCHAR
447 #endif
448
449 #if (ODBCVER >= 0x0300)
450 #define SQL_C_VARBOOKMARK               SQL_C_BINARY
451 #endif
452
453 #if (ODBCVER >= 0x0300)
454 #define SQL_NO_ROW_NUMBER                                       (-1)
455 #define SQL_NO_COLUMN_NUMBER                                    (-1)
456 #define SQL_ROW_NUMBER_UNKNOWN                                  (-2)
457 #define SQL_COLUMN_NUMBER_UNKNOWN                               (-2)
458 #endif
459
460 #define SQL_DEFAULT_PARAM            (-5)
461 #define SQL_IGNORE                   (-6)
462 #if (ODBCVER >= 0x0300)
463 #define SQL_COLUMN_IGNORE               SQL_IGNORE
464 #endif
465 #define SQL_LEN_DATA_AT_EXEC_OFFSET  (-100)
466 #define SQL_LEN_DATA_AT_EXEC(length) (-(length)+SQL_LEN_DATA_AT_EXEC_OFFSET)
467
468 #define SQL_LEN_BINARY_ATTR_OFFSET       (-100)
469 #define SQL_LEN_BINARY_ATTR(length)      (-(length)+SQL_LEN_BINARY_ATTR_OFFSET)
470
471 #define SQL_PARAM_TYPE_DEFAULT           SQL_PARAM_INPUT_OUTPUT
472 #define SQL_SETPARAM_VALUE_MAX           (-1L)
473
474 #define SQL_COLUMN_COUNT                0
475 #define SQL_COLUMN_NAME                 1
476 #define SQL_COLUMN_TYPE                 2
477 #define SQL_COLUMN_LENGTH               3
478 #define SQL_COLUMN_PRECISION            4
479 #define SQL_COLUMN_SCALE                5
480 #define SQL_COLUMN_DISPLAY_SIZE         6
481 #define SQL_COLUMN_NULLABLE             7
482 #define SQL_COLUMN_UNSIGNED             8
483 #define SQL_COLUMN_MONEY                9
484 #define SQL_COLUMN_UPDATABLE            10
485 #define SQL_COLUMN_AUTO_INCREMENT       11
486 #define SQL_COLUMN_CASE_SENSITIVE       12
487 #define SQL_COLUMN_SEARCHABLE           13
488 #define SQL_COLUMN_TYPE_NAME            14
489 #define SQL_COLUMN_TABLE_NAME           15
490 #define SQL_COLUMN_OWNER_NAME           16
491 #define SQL_COLUMN_QUALIFIER_NAME       17
492 #define SQL_COLUMN_LABEL                18
493 #define SQL_COLATT_OPT_MAX              SQL_COLUMN_LABEL
494 #if (ODBCVER < 0x0300)
495 #define SQL_COLUMN_DRIVER_START         1000
496 #endif
497
498 #define SQL_COLATT_OPT_MIN              SQL_COLUMN_COUNT
499
500 #define SQL_ATTR_READONLY               0
501 #define SQL_ATTR_WRITE                  1
502 #define SQL_ATTR_READWRITE_UNKNOWN      2
503
504 #define SQL_UNSEARCHABLE                0
505 #define SQL_LIKE_ONLY                   1
506 #define SQL_ALL_EXCEPT_LIKE             2
507 #define SQL_SEARCHABLE                  3
508 #define SQL_PRED_SEARCHABLE                             SQL_SEARCHABLE
509
510
511 #define SQL_NO_TOTAL                    (-4)
512
513 #if (ODBCVER >= 0x0300)
514 #define SQL_API_SQLALLOCHANDLESTD       73
515 #define SQL_API_SQLBULKOPERATIONS       24
516 #endif
517 #define SQL_API_SQLBINDPARAMETER    72
518 #define SQL_API_SQLBROWSECONNECT    55
519 #define SQL_API_SQLCOLATTRIBUTES    6
520 #define SQL_API_SQLCOLUMNPRIVILEGES 56
521 #define SQL_API_SQLDESCRIBEPARAM    58
522 #define SQL_API_SQLDRIVERCONNECT        41
523 #define SQL_API_SQLDRIVERS          71
524 #define SQL_API_SQLEXTENDEDFETCH    59
525 #define SQL_API_SQLFOREIGNKEYS      60
526 #define SQL_API_SQLMORERESULTS      61
527 #define SQL_API_SQLNATIVESQL        62
528 #define SQL_API_SQLNUMPARAMS        63
529 #define SQL_API_SQLPARAMOPTIONS     64
530 #define SQL_API_SQLPRIMARYKEYS      65
531 #define SQL_API_SQLPROCEDURECOLUMNS 66
532 #define SQL_API_SQLPROCEDURES       67
533 #define SQL_API_SQLSETPOS           68
534 #define SQL_API_SQLSETSCROLLOPTIONS 69
535 #define SQL_API_SQLTABLEPRIVILEGES  70
536
537 #if (ODBCVER < 0x0300)
538 #define SQL_EXT_API_LAST            SQL_API_SQLBINDPARAMETER
539 #define SQL_NUM_FUNCTIONS           23
540 #define SQL_EXT_API_START           40
541 #define SQL_NUM_EXTENSIONS (SQL_EXT_API_LAST-SQL_EXT_API_START+1)
542 #endif
543
544 #define SQL_API_ALL_FUNCTIONS       0
545
546 #define SQL_API_LOADBYORDINAL       199
547
548 #if (ODBCVER >= 0x0300)
549 #define SQL_API_ODBC3_ALL_FUNCTIONS             999
550 #define SQL_API_ODBC3_ALL_FUNCTIONS_SIZE        250
551
552
553 #define SQL_FUNC_EXISTS(pfExists, uwAPI) ((*(((UWORD*) (pfExists)) + ((uwAPI) >> 4)) & (1 << ((uwAPI) & 0x000F)) ) ? SQL_TRUE : SQL_FALSE )
554
555 #endif
556
557 #define SQL_INFO_FIRST                       0
558 #define SQL_ACTIVE_CONNECTIONS               0
559 #define SQL_ACTIVE_STATEMENTS                1
560 #define SQL_DRIVER_HDBC                      3
561 #define SQL_DRIVER_HENV                      4
562 #define SQL_DRIVER_HSTMT                     5
563 #define SQL_DRIVER_NAME                      6
564 #define SQL_DRIVER_VER                       7
565 #define SQL_ODBC_API_CONFORMANCE             9
566 #define SQL_ODBC_VER                        10
567 #define SQL_ROW_UPDATES                     11
568 #define SQL_ODBC_SAG_CLI_CONFORMANCE        12
569 #define SQL_ODBC_SQL_CONFORMANCE            15
570 #define SQL_PROCEDURES                      21
571 #define SQL_CONCAT_NULL_BEHAVIOR            22
572 #define SQL_CURSOR_ROLLBACK_BEHAVIOR        24
573 #define SQL_EXPRESSIONS_IN_ORDERBY          27
574 #define SQL_MAX_OWNER_NAME_LEN              32
575 #define SQL_MAX_PROCEDURE_NAME_LEN          33
576 #define SQL_MAX_QUALIFIER_NAME_LEN          34
577 #define SQL_MULT_RESULT_SETS                36
578 #define SQL_MULTIPLE_ACTIVE_TXN             37
579 #define SQL_OUTER_JOINS                     38
580 #define SQL_OWNER_TERM                      39
581 #define SQL_PROCEDURE_TERM                  40
582 #define SQL_QUALIFIER_NAME_SEPARATOR        41
583 #define SQL_QUALIFIER_TERM                  42
584 #define SQL_SCROLL_OPTIONS                  44
585 #define SQL_TABLE_TERM                      45
586 #define SQL_CONVERT_FUNCTIONS               48
587 #define SQL_NUMERIC_FUNCTIONS               49
588 #define SQL_STRING_FUNCTIONS                50
589 #define SQL_SYSTEM_FUNCTIONS                51
590 #define SQL_TIMEDATE_FUNCTIONS              52
591 #define SQL_CONVERT_BIGINT                  53
592 #define SQL_CONVERT_BINARY                  54
593 #define SQL_CONVERT_BIT                     55
594 #define SQL_CONVERT_CHAR                    56
595 #define SQL_CONVERT_DATE                    57
596 #define SQL_CONVERT_DECIMAL                 58
597 #define SQL_CONVERT_DOUBLE                  59
598 #define SQL_CONVERT_FLOAT                   60
599 #define SQL_CONVERT_INTEGER                 61
600 #define SQL_CONVERT_LONGVARCHAR             62
601 #define SQL_CONVERT_NUMERIC                 63
602 #define SQL_CONVERT_REAL                    64
603 #define SQL_CONVERT_SMALLINT                65
604 #define SQL_CONVERT_TIME                    66
605 #define SQL_CONVERT_TIMESTAMP               67
606 #define SQL_CONVERT_TINYINT                 68
607 #define SQL_CONVERT_VARBINARY               69
608 #define SQL_CONVERT_VARCHAR                 70
609 #define SQL_CONVERT_LONGVARBINARY           71
610 #define SQL_ODBC_SQL_OPT_IEF                73
611 #define SQL_CORRELATION_NAME                74
612 #define SQL_NON_NULLABLE_COLUMNS            75
613 #define SQL_DRIVER_HLIB                     76
614 #define SQL_DRIVER_ODBC_VER                 77
615 #define SQL_LOCK_TYPES                      78
616 #define SQL_POS_OPERATIONS                  79
617 #define SQL_POSITIONED_STATEMENTS           80
618 #define SQL_BOOKMARK_PERSISTENCE            82
619 #define SQL_STATIC_SENSITIVITY              83
620 #define SQL_FILE_USAGE                      84
621 #define SQL_COLUMN_ALIAS                    87
622 #define SQL_GROUP_BY                        88
623 #define SQL_KEYWORDS                        89
624 #define SQL_OWNER_USAGE                     91
625 #define SQL_QUALIFIER_USAGE                 92
626 #define SQL_QUOTED_IDENTIFIER_CASE          93
627 #define SQL_SUBQUERIES                      95
628 #define SQL_UNION                           96
629 #define SQL_MAX_ROW_SIZE_INCLUDES_LONG      103
630 #define SQL_MAX_CHAR_LITERAL_LEN            108
631 #define SQL_TIMEDATE_ADD_INTERVALS          109
632 #define SQL_TIMEDATE_DIFF_INTERVALS         110
633 #define SQL_NEED_LONG_DATA_LEN              111
634 #define SQL_MAX_BINARY_LITERAL_LEN          112
635 #define SQL_LIKE_ESCAPE_CLAUSE              113
636 #define SQL_QUALIFIER_LOCATION              114
637
638 #if (ODBCVER >= 0x0201 && ODBCVER < 0x0300)
639 #define SQL_OJ_CAPABILITIES         65003
640 #endif
641
642 #if (ODBCVER < 0x0300)
643 #define SQL_INFO_LAST                                                   SQL_QUALIFIER_LOCATION
644 #define SQL_INFO_DRIVER_START                                           1000
645 #endif
646
647 #if (ODBCVER >= 0x0300)
648 #define SQL_ACTIVE_ENVIRONMENTS                                         116
649 #define SQL_ALTER_DOMAIN                                                117
650
651 #define SQL_SQL_CONFORMANCE                                             118
652 #define SQL_DATETIME_LITERALS                                           119
653
654 #define SQL_ASYNC_MODE                                                  10021
655 #define SQL_BATCH_ROW_COUNT                                             120
656 #define SQL_BATCH_SUPPORT                                               121
657 #define SQL_CATALOG_LOCATION                                            SQL_QUALIFIER_LOCATION
658 #define SQL_CATALOG_NAME_SEPARATOR                                      SQL_QUALIFIER_NAME_SEPARATOR
659 #define SQL_CATALOG_TERM                                                SQL_QUALIFIER_TERM
660 #define SQL_CATALOG_USAGE                                               SQL_QUALIFIER_USAGE
661 #define SQL_CONVERT_WCHAR                                               122
662 #define SQL_CONVERT_INTERVAL_DAY_TIME                                   123
663 #define SQL_CONVERT_INTERVAL_YEAR_MONTH                                 124
664 #define SQL_CONVERT_WLONGVARCHAR                                        125
665 #define SQL_CONVERT_WVARCHAR                                            126
666 #define SQL_CREATE_ASSERTION                                            127
667 #define SQL_CREATE_CHARACTER_SET                                        128
668 #define SQL_CREATE_COLLATION                                            129
669 #define SQL_CREATE_DOMAIN                                               130
670 #define SQL_CREATE_SCHEMA                                               131
671 #define SQL_CREATE_TABLE                                                132
672 #define SQL_CREATE_TRANSLATION                                          133
673 #define SQL_CREATE_VIEW                                                 134
674 #define SQL_DRIVER_HDESC                                                135
675 #define SQL_DROP_ASSERTION                                              136
676 #define SQL_DROP_CHARACTER_SET                                          137
677 #define SQL_DROP_COLLATION                                              138
678 #define SQL_DROP_DOMAIN                                                 139
679 #define SQL_DROP_SCHEMA                                                 140
680 #define SQL_DROP_TABLE                                                  141
681 #define SQL_DROP_TRANSLATION                                            142
682 #define SQL_DROP_VIEW                                                   143
683 #define SQL_DYNAMIC_CURSOR_ATTRIBUTES1                  144
684 #define SQL_DYNAMIC_CURSOR_ATTRIBUTES2                  145
685 #define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES1             146
686 #define SQL_FORWARD_ONLY_CURSOR_ATTRIBUTES2             147
687 #define SQL_INDEX_KEYWORDS                              148
688 #define SQL_INFO_SCHEMA_VIEWS                           149
689 #define SQL_KEYSET_CURSOR_ATTRIBUTES1                   150
690 #define SQL_KEYSET_CURSOR_ATTRIBUTES2                   151
691 #define SQL_MAX_ASYNC_CONCURRENT_STATEMENTS             10022
692 #define SQL_ODBC_INTERFACE_CONFORMANCE                  152
693 #define SQL_PARAM_ARRAY_ROW_COUNTS                      153
694 #define SQL_PARAM_ARRAY_SELECTS                         154
695 #define SQL_SCHEMA_TERM                                 SQL_OWNER_TERM
696 #define SQL_SCHEMA_USAGE                                SQL_OWNER_USAGE
697 #define SQL_SQL92_DATETIME_FUNCTIONS                    155
698 #define SQL_SQL92_FOREIGN_KEY_DELETE_RULE               156
699 #define SQL_SQL92_FOREIGN_KEY_UPDATE_RULE               157
700 #define SQL_SQL92_GRANT                                 158
701 #define SQL_SQL92_NUMERIC_VALUE_FUNCTIONS               159
702 #define SQL_SQL92_PREDICATES                            160
703 #define SQL_SQL92_RELATIONAL_JOIN_OPERATORS             161
704 #define SQL_SQL92_REVOKE                                162
705 #define SQL_SQL92_ROW_VALUE_CONSTRUCTOR                 163
706 #define SQL_SQL92_STRING_FUNCTIONS                      164
707 #define SQL_SQL92_VALUE_EXPRESSIONS                     165
708 #define SQL_STANDARD_CLI_CONFORMANCE                    166
709 #define SQL_STATIC_CURSOR_ATTRIBUTES1                   167
710 #define SQL_STATIC_CURSOR_ATTRIBUTES2                   168
711
712 #define SQL_AGGREGATE_FUNCTIONS                         169
713 #define SQL_DDL_INDEX                                   170
714 #define SQL_DM_VER                                      171
715 #define SQL_INSERT_STATEMENT                            172
716 #define SQL_UNION_STATEMENT                             SQL_UNION
717 #endif
718
719 #define SQL_DTC_TRANSITION_COST                         1750
720
721 #if (ODBCVER >= 0x0300)
722
723 #define SQL_AT_ADD_COLUMN_SINGLE                                0x00000020L
724 #define SQL_AT_ADD_COLUMN_DEFAULT                               0x00000040L
725 #define SQL_AT_ADD_COLUMN_COLLATION                             0x00000080L
726 #define SQL_AT_SET_COLUMN_DEFAULT                               0x00000100L
727 #define SQL_AT_DROP_COLUMN_DEFAULT                              0x00000200L
728 #define SQL_AT_DROP_COLUMN_CASCADE                              0x00000400L
729 #define SQL_AT_DROP_COLUMN_RESTRICT                             0x00000800L
730 #define SQL_AT_ADD_TABLE_CONSTRAINT                             0x00001000L
731 #define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE                    0x00002000L
732 #define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT                   0x00004000L
733 #define SQL_AT_CONSTRAINT_NAME_DEFINITION                       0x00008000L
734 #define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED                    0x00010000L
735 #define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE                   0x00020000L
736 #define SQL_AT_CONSTRAINT_DEFERRABLE                            0x00040000L
737 #define SQL_AT_CONSTRAINT_NON_DEFERRABLE                        0x00080000L
738 #endif
739
740 #define SQL_CVT_CHAR                        0x00000001L
741 #define SQL_CVT_NUMERIC                     0x00000002L
742 #define SQL_CVT_DECIMAL                     0x00000004L
743 #define SQL_CVT_INTEGER                     0x00000008L
744 #define SQL_CVT_SMALLINT                    0x00000010L
745 #define SQL_CVT_FLOAT                       0x00000020L
746 #define SQL_CVT_REAL                        0x00000040L
747 #define SQL_CVT_DOUBLE                      0x00000080L
748 #define SQL_CVT_VARCHAR                     0x00000100L
749 #define SQL_CVT_LONGVARCHAR                 0x00000200L
750 #define SQL_CVT_BINARY                      0x00000400L
751 #define SQL_CVT_VARBINARY                   0x00000800L
752 #define SQL_CVT_BIT                         0x00001000L
753 #define SQL_CVT_TINYINT                     0x00002000L
754 #define SQL_CVT_BIGINT                      0x00004000L
755 #define SQL_CVT_DATE                        0x00008000L
756 #define SQL_CVT_TIME                        0x00010000L
757 #define SQL_CVT_TIMESTAMP                   0x00020000L
758 #define SQL_CVT_LONGVARBINARY               0x00040000L
759 #if (ODBCVER >= 0x0300)
760 #define SQL_CVT_INTERVAL_YEAR_MONTH     0x00080000L
761 #define SQL_CVT_INTERVAL_DAY_TIME       0x00100000L
762 #define SQL_CVT_WCHAR                   0x00200000L
763 #define SQL_CVT_WLONGVARCHAR            0x00400000L
764 #define SQL_CVT_WVARCHAR                0x00800000L
765
766 #endif
767
768
769 #define SQL_FN_CVT_CONVERT              0x00000001L
770 #if (ODBCVER >= 0x0300)
771 #define SQL_FN_CVT_CAST                 0x00000002L
772 #endif
773
774 #define SQL_FN_STR_CONCAT                   0x00000001L
775 #define SQL_FN_STR_INSERT                   0x00000002L
776 #define SQL_FN_STR_LEFT                     0x00000004L
777 #define SQL_FN_STR_LTRIM                    0x00000008L
778 #define SQL_FN_STR_LENGTH                   0x00000010L
779 #define SQL_FN_STR_LOCATE                   0x00000020L
780 #define SQL_FN_STR_LCASE                    0x00000040L
781 #define SQL_FN_STR_REPEAT                   0x00000080L
782 #define SQL_FN_STR_REPLACE                  0x00000100L
783 #define SQL_FN_STR_RIGHT                    0x00000200L
784 #define SQL_FN_STR_RTRIM                    0x00000400L
785 #define SQL_FN_STR_SUBSTRING                0x00000800L
786 #define SQL_FN_STR_UCASE                    0x00001000L
787 #define SQL_FN_STR_ASCII                    0x00002000L
788 #define SQL_FN_STR_CHAR                     0x00004000L
789 #define SQL_FN_STR_DIFFERENCE               0x00008000L
790 #define SQL_FN_STR_LOCATE_2                 0x00010000L
791 #define SQL_FN_STR_SOUNDEX                  0x00020000L
792 #define SQL_FN_STR_SPACE                    0x00040000L
793 #if (ODBCVER >= 0x0300)
794 #define SQL_FN_STR_BIT_LENGTH                   0x00080000L
795 #define SQL_FN_STR_CHAR_LENGTH                  0x00100000L
796 #define SQL_FN_STR_CHARACTER_LENGTH             0x00200000L
797 #define SQL_FN_STR_OCTET_LENGTH                 0x00400000L
798 #define SQL_FN_STR_POSITION                     0x00800000L
799 #endif
800
801 #if (ODBCVER >= 0x0300)
802 #define SQL_SSF_CONVERT                                 0x00000001L
803 #define SQL_SSF_LOWER                                   0x00000002L
804 #define SQL_SSF_UPPER                                   0x00000004L
805 #define SQL_SSF_SUBSTRING                               0x00000008L
806 #define SQL_SSF_TRANSLATE                               0x00000010L
807 #define SQL_SSF_TRIM_BOTH                               0x00000020L
808 #define SQL_SSF_TRIM_LEADING                            0x00000040L
809 #define SQL_SSF_TRIM_TRAILING                           0x00000080L
810 #endif
811
812 #define SQL_FN_NUM_ABS                      0x00000001L
813 #define SQL_FN_NUM_ACOS                     0x00000002L
814 #define SQL_FN_NUM_ASIN                     0x00000004L
815 #define SQL_FN_NUM_ATAN                     0x00000008L
816 #define SQL_FN_NUM_ATAN2                    0x00000010L
817 #define SQL_FN_NUM_CEILING                  0x00000020L
818 #define SQL_FN_NUM_COS                      0x00000040L
819 #define SQL_FN_NUM_COT                      0x00000080L
820 #define SQL_FN_NUM_EXP                      0x00000100L
821 #define SQL_FN_NUM_FLOOR                    0x00000200L
822 #define SQL_FN_NUM_LOG                      0x00000400L
823 #define SQL_FN_NUM_MOD                      0x00000800L
824 #define SQL_FN_NUM_SIGN                     0x00001000L
825 #define SQL_FN_NUM_SIN                      0x00002000L
826 #define SQL_FN_NUM_SQRT                     0x00004000L
827 #define SQL_FN_NUM_TAN                      0x00008000L
828 #define SQL_FN_NUM_PI                       0x00010000L
829 #define SQL_FN_NUM_RAND                     0x00020000L
830 #define SQL_FN_NUM_DEGREES                  0x00040000L
831 #define SQL_FN_NUM_LOG10                    0x00080000L
832 #define SQL_FN_NUM_POWER                    0x00100000L
833 #define SQL_FN_NUM_RADIANS                  0x00200000L
834 #define SQL_FN_NUM_ROUND                    0x00400000L
835 #define SQL_FN_NUM_TRUNCATE                 0x00800000L
836
837 #if (ODBCVER >= 0x0300)
838 #define SQL_SNVF_BIT_LENGTH                             0x00000001L
839 #define SQL_SNVF_CHAR_LENGTH                            0x00000002L
840 #define SQL_SNVF_CHARACTER_LENGTH                       0x00000004L
841 #define SQL_SNVF_EXTRACT                                0x00000008L
842 #define SQL_SNVF_OCTET_LENGTH                           0x00000010L
843 #define SQL_SNVF_POSITION                               0x00000020L
844 #endif
845
846 #define SQL_FN_TD_NOW                       0x00000001L
847 #define SQL_FN_TD_CURDATE                   0x00000002L
848 #define SQL_FN_TD_DAYOFMONTH                0x00000004L
849 #define SQL_FN_TD_DAYOFWEEK                 0x00000008L
850 #define SQL_FN_TD_DAYOFYEAR                 0x00000010L
851 #define SQL_FN_TD_MONTH                     0x00000020L
852 #define SQL_FN_TD_QUARTER                   0x00000040L
853 #define SQL_FN_TD_WEEK                      0x00000080L
854 #define SQL_FN_TD_YEAR                      0x00000100L
855 #define SQL_FN_TD_CURTIME                   0x00000200L
856 #define SQL_FN_TD_HOUR                      0x00000400L
857 #define SQL_FN_TD_MINUTE                    0x00000800L
858 #define SQL_FN_TD_SECOND                    0x00001000L
859 #define SQL_FN_TD_TIMESTAMPADD              0x00002000L
860 #define SQL_FN_TD_TIMESTAMPDIFF             0x00004000L
861 #define SQL_FN_TD_DAYNAME                   0x00008000L
862 #define SQL_FN_TD_MONTHNAME                 0x00010000L
863 #if (ODBCVER >= 0x0300)
864 #define SQL_FN_TD_CURRENT_DATE                          0x00020000L
865 #define SQL_FN_TD_CURRENT_TIME                          0x00040000L
866 #define SQL_FN_TD_CURRENT_TIMESTAMP                     0x00080000L
867 #define SQL_FN_TD_EXTRACT                               0x00100000L
868 #endif
869
870 #if (ODBCVER >= 0x0300)
871 #define SQL_SDF_CURRENT_DATE                            0x00000001L
872 #define SQL_SDF_CURRENT_TIME                            0x00000002L
873 #define SQL_SDF_CURRENT_TIMESTAMP                       0x00000004L
874 #endif
875
876 #define SQL_FN_SYS_USERNAME                 0x00000001L
877 #define SQL_FN_SYS_DBNAME                   0x00000002L
878 #define SQL_FN_SYS_IFNULL                   0x00000004L
879
880 #define SQL_FN_TSI_FRAC_SECOND              0x00000001L
881 #define SQL_FN_TSI_SECOND                   0x00000002L
882 #define SQL_FN_TSI_MINUTE                   0x00000004L
883 #define SQL_FN_TSI_HOUR                     0x00000008L
884 #define SQL_FN_TSI_DAY                      0x00000010L
885 #define SQL_FN_TSI_WEEK                     0x00000020L
886 #define SQL_FN_TSI_MONTH                    0x00000040L
887 #define SQL_FN_TSI_QUARTER                  0x00000080L
888 #define SQL_FN_TSI_YEAR                     0x00000100L
889
890 #if (ODBCVER >= 0x0300)
891 #define SQL_CA1_NEXT                                    0x00000001L
892 #define SQL_CA1_ABSOLUTE                                0x00000002L
893 #define SQL_CA1_RELATIVE                                0x00000004L
894 #define SQL_CA1_BOOKMARK                                0x00000008L
895
896 #define SQL_CA1_LOCK_NO_CHANGE                          0x00000040L
897 #define SQL_CA1_LOCK_EXCLUSIVE                          0x00000080L
898 #define SQL_CA1_LOCK_UNLOCK                             0x00000100L
899
900 #define SQL_CA1_POS_POSITION                            0x00000200L
901 #define SQL_CA1_POS_UPDATE                              0x00000400L
902 #define SQL_CA1_POS_DELETE                              0x00000800L
903 #define SQL_CA1_POS_REFRESH                             0x00001000L
904
905 #define SQL_CA1_POSITIONED_UPDATE                       0x00002000L
906 #define SQL_CA1_POSITIONED_DELETE                       0x00004000L
907 #define SQL_CA1_SELECT_FOR_UPDATE                       0x00008000L
908
909 #define SQL_CA1_BULK_ADD                        0x00010000L
910 #define SQL_CA1_BULK_UPDATE_BY_BOOKMARK         0x00020000L
911 #define SQL_CA1_BULK_DELETE_BY_BOOKMARK         0x00040000L
912 #define SQL_CA1_BULK_FETCH_BY_BOOKMARK          0x00080000L
913 #endif
914
915 #if (ODBCVER >= 0x0300)
916 #define SQL_CA2_READ_ONLY_CONCURRENCY           0x00000001L
917 #define SQL_CA2_LOCK_CONCURRENCY                0x00000002L
918 #define SQL_CA2_OPT_ROWVER_CONCURRENCY          0x00000004L
919 #define SQL_CA2_OPT_VALUES_CONCURRENCY          0x00000008L
920
921 #define SQL_CA2_SENSITIVITY_ADDITIONS           0x00000010L
922 #define SQL_CA2_SENSITIVITY_DELETIONS           0x00000020L
923 #define SQL_CA2_SENSITIVITY_UPDATES             0x00000040L
924
925 #define SQL_CA2_MAX_ROWS_SELECT                 0x00000080L
926 #define SQL_CA2_MAX_ROWS_INSERT                 0x00000100L
927 #define SQL_CA2_MAX_ROWS_DELETE                 0x00000200L
928 #define SQL_CA2_MAX_ROWS_UPDATE                 0x00000400L
929 #define SQL_CA2_MAX_ROWS_CATALOG                0x00000800L
930 #define SQL_CA2_MAX_ROWS_AFFECTS_ALL            (SQL_CA2_MAX_ROWS_SELECT | SQL_CA2_MAX_ROWS_INSERT | SQL_CA2_MAX_ROWS_DELETE | SQL_CA2_MAX_ROWS_UPDATE | SQL_CA2_MAX_ROWS_CATALOG)
931
932 #define SQL_CA2_CRC_EXACT                       0x00001000L
933 #define SQL_CA2_CRC_APPROXIMATE                 0x00002000L
934
935 #define SQL_CA2_SIMULATE_NON_UNIQUE             0x00004000L
936 #define SQL_CA2_SIMULATE_TRY_UNIQUE             0x00008000L
937 #define SQL_CA2_SIMULATE_UNIQUE                 0x00010000L
938 #endif
939
940 #define SQL_OAC_NONE                        0x0000
941 #define SQL_OAC_LEVEL1                      0x0001
942 #define SQL_OAC_LEVEL2                      0x0002
943
944 #define SQL_OSCC_NOT_COMPLIANT              0x0000
945 #define SQL_OSCC_COMPLIANT                  0x0001
946
947 #define SQL_OSC_MINIMUM                     0x0000
948 #define SQL_OSC_CORE                        0x0001
949 #define SQL_OSC_EXTENDED                    0x0002
950
951 #define SQL_CB_NULL                         0x0000
952 #define SQL_CB_NON_NULL                     0x0001
953
954 #define SQL_SO_FORWARD_ONLY                 0x00000001L
955 #define SQL_SO_KEYSET_DRIVEN                0x00000002L
956 #define SQL_SO_DYNAMIC                      0x00000004L
957 #define SQL_SO_MIXED                        0x00000008L
958 #define SQL_SO_STATIC                       0x00000010L
959
960 #define SQL_FD_FETCH_BOOKMARK               0x00000080L
961
962 #define SQL_CN_NONE                         0x0000
963 #define SQL_CN_DIFFERENT                    0x0001
964 #define SQL_CN_ANY                          0x0002
965
966 #define SQL_NNC_NULL                        0x0000
967 #define SQL_NNC_NON_NULL                    0x0001
968
969 #define SQL_NC_START                        0x0002
970 #define SQL_NC_END                          0x0004
971
972 #define SQL_FILE_NOT_SUPPORTED              0x0000
973 #define SQL_FILE_TABLE                      0x0001
974 #define SQL_FILE_QUALIFIER                  0x0002
975 #define SQL_FILE_CATALOG                SQL_FILE_QUALIFIER
976
977 #define SQL_GD_BLOCK                        0x00000004L
978 #define SQL_GD_BOUND                        0x00000008L
979
980 #define SQL_PS_POSITIONED_DELETE            0x00000001L
981 #define SQL_PS_POSITIONED_UPDATE            0x00000002L
982 #define SQL_PS_SELECT_FOR_UPDATE            0x00000004L
983
984 #define SQL_GB_NOT_SUPPORTED                0x0000
985 #define SQL_GB_GROUP_BY_EQUALS_SELECT       0x0001
986 #define SQL_GB_GROUP_BY_CONTAINS_SELECT     0x0002
987 #define SQL_GB_NO_RELATION                  0x0003
988 #if (ODBCVER >= 0x0300)
989 #define SQL_GB_COLLATE                  0x0004
990
991 #endif
992
993 #define SQL_OU_DML_STATEMENTS               0x00000001L
994 #define SQL_OU_PROCEDURE_INVOCATION         0x00000002L
995 #define SQL_OU_TABLE_DEFINITION             0x00000004L
996 #define SQL_OU_INDEX_DEFINITION             0x00000008L
997 #define SQL_OU_PRIVILEGE_DEFINITION         0x00000010L
998
999 #if (ODBCVER >= 0x0300)
1000 #define SQL_SU_DML_STATEMENTS                   SQL_OU_DML_STATEMENTS
1001 #define SQL_SU_PROCEDURE_INVOCATION             SQL_OU_PROCEDURE_INVOCATION
1002 #define SQL_SU_TABLE_DEFINITION                 SQL_OU_TABLE_DEFINITION
1003 #define SQL_SU_INDEX_DEFINITION                 SQL_OU_INDEX_DEFINITION
1004 #define SQL_SU_PRIVILEGE_DEFINITION             SQL_OU_PRIVILEGE_DEFINITION
1005 #endif
1006
1007 #define SQL_QU_DML_STATEMENTS               0x00000001L
1008 #define SQL_QU_PROCEDURE_INVOCATION         0x00000002L
1009 #define SQL_QU_TABLE_DEFINITION             0x00000004L
1010 #define SQL_QU_INDEX_DEFINITION             0x00000008L
1011 #define SQL_QU_PRIVILEGE_DEFINITION         0x00000010L
1012
1013 #if (ODBCVER >= 0x0300)
1014 #define SQL_CU_DML_STATEMENTS                   SQL_QU_DML_STATEMENTS
1015 #define SQL_CU_PROCEDURE_INVOCATION             SQL_QU_PROCEDURE_INVOCATION
1016 #define SQL_CU_TABLE_DEFINITION                 SQL_QU_TABLE_DEFINITION
1017 #define SQL_CU_INDEX_DEFINITION                 SQL_QU_INDEX_DEFINITION
1018 #define SQL_CU_PRIVILEGE_DEFINITION             SQL_QU_PRIVILEGE_DEFINITION
1019 #endif
1020
1021 #define SQL_SQ_COMPARISON                   0x00000001L
1022 #define SQL_SQ_EXISTS                       0x00000002L
1023 #define SQL_SQ_IN                           0x00000004L
1024 #define SQL_SQ_QUANTIFIED                   0x00000008L
1025 #define SQL_SQ_CORRELATED_SUBQUERIES        0x00000010L
1026
1027 #define SQL_U_UNION                         0x00000001L
1028 #define SQL_U_UNION_ALL                     0x00000002L
1029
1030 #define SQL_BP_CLOSE                        0x00000001L
1031 #define SQL_BP_DELETE                       0x00000002L
1032 #define SQL_BP_DROP                         0x00000004L
1033 #define SQL_BP_TRANSACTION                  0x00000008L
1034 #define SQL_BP_UPDATE                       0x00000010L
1035 #define SQL_BP_OTHER_HSTMT                  0x00000020L
1036 #define SQL_BP_SCROLL                       0x00000040L
1037
1038 #define SQL_SS_ADDITIONS                    0x00000001L
1039 #define SQL_SS_DELETIONS                    0x00000002L
1040 #define SQL_SS_UPDATES                      0x00000004L
1041
1042 #define SQL_CV_CREATE_VIEW                                      0x00000001L
1043 #define SQL_CV_CHECK_OPTION                                     0x00000002L
1044 #define SQL_CV_CASCADED                                         0x00000004L
1045 #define SQL_CV_LOCAL                                            0x00000008L
1046
1047 #define SQL_LCK_NO_CHANGE                   0x00000001L
1048 #define SQL_LCK_EXCLUSIVE                   0x00000002L
1049 #define SQL_LCK_UNLOCK                      0x00000004L
1050
1051 #define SQL_POS_POSITION                    0x00000001L
1052 #define SQL_POS_REFRESH                     0x00000002L
1053 #define SQL_POS_UPDATE                      0x00000004L
1054 #define SQL_POS_DELETE                      0x00000008L
1055 #define SQL_POS_ADD                         0x00000010L
1056
1057 #define SQL_QL_START                        0x0001
1058 #define SQL_QL_END                          0x0002
1059
1060 #if (ODBCVER >= 0x0300)
1061 #define SQL_AF_AVG                                              0x00000001L
1062 #define SQL_AF_COUNT                                    0x00000002L
1063 #define SQL_AF_MAX                                              0x00000004L
1064 #define SQL_AF_MIN                                              0x00000008L
1065 #define SQL_AF_SUM                                              0x00000010L
1066 #define SQL_AF_DISTINCT                                 0x00000020L
1067 #define SQL_AF_ALL                                              0x00000040L
1068
1069 #define SQL_SC_SQL92_ENTRY                              0x00000001L
1070 #define SQL_SC_FIPS127_2_TRANSITIONAL   0x00000002L
1071 #define SQL_SC_SQL92_INTERMEDIATE               0x00000004L
1072 #define SQL_SC_SQL92_FULL                               0x00000008L
1073
1074 #define SQL_DL_SQL92_DATE                                               0x00000001L
1075 #define SQL_DL_SQL92_TIME                                               0x00000002L
1076 #define SQL_DL_SQL92_TIMESTAMP                                  0x00000004L
1077 #define SQL_DL_SQL92_INTERVAL_YEAR                              0x00000008L
1078 #define SQL_DL_SQL92_INTERVAL_MONTH                             0x00000010L
1079 #define SQL_DL_SQL92_INTERVAL_DAY                               0x00000020L
1080 #define SQL_DL_SQL92_INTERVAL_HOUR                              0x00000040L
1081 #define SQL_DL_SQL92_INTERVAL_MINUTE                    0x00000080L
1082 #define SQL_DL_SQL92_INTERVAL_SECOND                    0x00000100L
1083 #define SQL_DL_SQL92_INTERVAL_YEAR_TO_MONTH             0x00000200L
1084 #define SQL_DL_SQL92_INTERVAL_DAY_TO_HOUR               0x00000400L
1085 #define SQL_DL_SQL92_INTERVAL_DAY_TO_MINUTE             0x00000800L
1086 #define SQL_DL_SQL92_INTERVAL_DAY_TO_SECOND             0x00001000L
1087 #define SQL_DL_SQL92_INTERVAL_HOUR_TO_MINUTE    0x00002000L
1088 #define SQL_DL_SQL92_INTERVAL_HOUR_TO_SECOND    0x00004000L
1089 #define SQL_DL_SQL92_INTERVAL_MINUTE_TO_SECOND  0x00008000L
1090
1091 #define SQL_CL_START                                            SQL_QL_START
1092 #define SQL_CL_END                                                      SQL_QL_END
1093
1094 #define SQL_BRC_PROCEDURES                      0x0000001
1095 #define SQL_BRC_EXPLICIT                        0x0000002
1096 #define SQL_BRC_ROLLED_UP                       0x0000004
1097
1098 #define SQL_BS_SELECT_EXPLICIT                          0x00000001L
1099 #define SQL_BS_ROW_COUNT_EXPLICIT                       0x00000002L
1100 #define SQL_BS_SELECT_PROC                                      0x00000004L
1101 #define SQL_BS_ROW_COUNT_PROC                           0x00000008L
1102
1103 #define SQL_PARC_BATCH          1
1104 #define SQL_PARC_NO_BATCH       2
1105
1106 #define SQL_PAS_BATCH                           1
1107 #define SQL_PAS_NO_BATCH                        2
1108 #define SQL_PAS_NO_SELECT                       3
1109
1110 #define SQL_IK_NONE                                                     0x00000000L
1111 #define SQL_IK_ASC                                                      0x00000001L
1112 #define SQL_IK_DESC                                                     0x00000002L
1113 #define SQL_IK_ALL                                                      (SQL_IK_ASC | SQL_IK_DESC)
1114
1115 #define SQL_ISV_ASSERTIONS                                      0x00000001L
1116 #define SQL_ISV_CHARACTER_SETS                          0x00000002L
1117 #define SQL_ISV_CHECK_CONSTRAINTS                       0x00000004L
1118 #define SQL_ISV_COLLATIONS                                      0x00000008L
1119 #define SQL_ISV_COLUMN_DOMAIN_USAGE                     0x00000010L
1120 #define SQL_ISV_COLUMN_PRIVILEGES                       0x00000020L
1121 #define SQL_ISV_COLUMNS                                         0x00000040L
1122 #define SQL_ISV_CONSTRAINT_COLUMN_USAGE         0x00000080L
1123 #define SQL_ISV_CONSTRAINT_TABLE_USAGE          0x00000100L
1124 #define SQL_ISV_DOMAIN_CONSTRAINTS                      0x00000200L
1125 #define SQL_ISV_DOMAINS                                         0x00000400L
1126 #define SQL_ISV_KEY_COLUMN_USAGE                        0x00000800L
1127 #define SQL_ISV_REFERENTIAL_CONSTRAINTS         0x00001000L
1128 #define SQL_ISV_SCHEMATA                                        0x00002000L
1129 #define SQL_ISV_SQL_LANGUAGES                           0x00004000L
1130 #define SQL_ISV_TABLE_CONSTRAINTS                       0x00008000L
1131 #define SQL_ISV_TABLE_PRIVILEGES                        0x00010000L
1132 #define SQL_ISV_TABLES                                          0x00020000L
1133 #define SQL_ISV_TRANSLATIONS                            0x00040000L
1134 #define SQL_ISV_USAGE_PRIVILEGES                        0x00080000L
1135 #define SQL_ISV_VIEW_COLUMN_USAGE                       0x00100000L
1136 #define SQL_ISV_VIEW_TABLE_USAGE                        0x00200000L
1137 #define SQL_ISV_VIEWS                                           0x00400000L
1138
1139 #define SQL_AM_NONE                     0
1140 #define SQL_AM_CONNECTION       1
1141 #define SQL_AM_STATEMENT        2
1142
1143 #define SQL_AD_CONSTRAINT_NAME_DEFINITION                       0x00000001L
1144 #define SQL_AD_ADD_DOMAIN_CONSTRAINT                            0x00000002L
1145 #define SQL_AD_DROP_DOMAIN_CONSTRAINT                           0x00000004L
1146 #define SQL_AD_ADD_DOMAIN_DEFAULT                               0x00000008L
1147 #define SQL_AD_DROP_DOMAIN_DEFAULT                              0x00000010L
1148 #define SQL_AD_ADD_CONSTRAINT_INITIALLY_DEFERRED        0x00000020L
1149 #define SQL_AD_ADD_CONSTRAINT_INITIALLY_IMMEDIATE       0x00000040L
1150 #define SQL_AD_ADD_CONSTRAINT_DEFERRABLE                        0x00000080L
1151 #define SQL_AD_ADD_CONSTRAINT_NON_DEFERRABLE            0x00000100L
1152
1153 #define SQL_CS_CREATE_SCHEMA                            0x00000001L
1154 #define SQL_CS_AUTHORIZATION                            0x00000002L
1155 #define SQL_CS_DEFAULT_CHARACTER_SET            0x00000004L
1156
1157 #define SQL_CTR_CREATE_TRANSLATION                      0x00000001L
1158
1159 #define SQL_CA_CREATE_ASSERTION                                 0x00000001L
1160 #define SQL_CA_CONSTRAINT_INITIALLY_DEFERRED    0x00000010L
1161 #define SQL_CA_CONSTRAINT_INITIALLY_IMMEDIATE   0x00000020L
1162 #define SQL_CA_CONSTRAINT_DEFERRABLE                    0x00000040L
1163 #define SQL_CA_CONSTRAINT_NON_DEFERRABLE                0x00000080L
1164
1165 #define SQL_CCS_CREATE_CHARACTER_SET            0x00000001L
1166 #define SQL_CCS_COLLATE_CLAUSE                          0x00000002L
1167 #define SQL_CCS_LIMITED_COLLATION                       0x00000004L
1168
1169 #define SQL_CCOL_CREATE_COLLATION                       0x00000001L
1170
1171 #define SQL_CDO_CREATE_DOMAIN                                   0x00000001L
1172 #define SQL_CDO_DEFAULT                                                 0x00000002L
1173 #define SQL_CDO_CONSTRAINT                                              0x00000004L
1174 #define SQL_CDO_COLLATION                                               0x00000008L
1175 #define SQL_CDO_CONSTRAINT_NAME_DEFINITION              0x00000010L
1176 #define SQL_CDO_CONSTRAINT_INITIALLY_DEFERRED   0x00000020L
1177 #define SQL_CDO_CONSTRAINT_INITIALLY_IMMEDIATE  0x00000040L
1178 #define SQL_CDO_CONSTRAINT_DEFERRABLE                   0x00000080L
1179 #define SQL_CDO_CONSTRAINT_NON_DEFERRABLE               0x00000100L
1180
1181 #define SQL_CT_CREATE_TABLE                                             0x00000001L
1182 #define SQL_CT_COMMIT_PRESERVE                                  0x00000002L
1183 #define SQL_CT_COMMIT_DELETE                                    0x00000004L
1184 #define SQL_CT_GLOBAL_TEMPORARY                                 0x00000008L
1185 #define SQL_CT_LOCAL_TEMPORARY                                  0x00000010L
1186 #define SQL_CT_CONSTRAINT_INITIALLY_DEFERRED    0x00000020L
1187 #define SQL_CT_CONSTRAINT_INITIALLY_IMMEDIATE   0x00000040L
1188 #define SQL_CT_CONSTRAINT_DEFERRABLE                    0x00000080L
1189 #define SQL_CT_CONSTRAINT_NON_DEFERRABLE                0x00000100L
1190 #define SQL_CT_COLUMN_CONSTRAINT                                0x00000200L
1191 #define SQL_CT_COLUMN_DEFAULT                                   0x00000400L
1192 #define SQL_CT_COLUMN_COLLATION                                 0x00000800L
1193 #define SQL_CT_TABLE_CONSTRAINT                                 0x00001000L
1194 #define SQL_CT_CONSTRAINT_NAME_DEFINITION               0x00002000L
1195
1196 #define SQL_DI_CREATE_INDEX                                             0x00000001L
1197 #define SQL_DI_DROP_INDEX                                               0x00000002L
1198
1199 #define SQL_DC_DROP_COLLATION                                   0x00000001L
1200
1201 #define SQL_DD_DROP_DOMAIN                                              0x00000001L
1202 #define SQL_DD_RESTRICT                                                 0x00000002L
1203 #define SQL_DD_CASCADE                                                  0x00000004L
1204
1205 #define SQL_DS_DROP_SCHEMA                                              0x00000001L
1206 #define SQL_DS_RESTRICT                                                 0x00000002L
1207 #define SQL_DS_CASCADE                                                  0x00000004L
1208
1209 #define SQL_DCS_DROP_CHARACTER_SET                              0x00000001L
1210
1211 #define SQL_DA_DROP_ASSERTION                                   0x00000001L
1212
1213 #define SQL_DT_DROP_TABLE                                               0x00000001L
1214 #define SQL_DT_RESTRICT                                                 0x00000002L
1215 #define SQL_DT_CASCADE                                                  0x00000004L
1216
1217 #define SQL_DTR_DROP_TRANSLATION                                0x00000001L
1218
1219 #define SQL_DV_DROP_VIEW                                                0x00000001L
1220 #define SQL_DV_RESTRICT                                                 0x00000002L
1221 #define SQL_DV_CASCADE                                                  0x00000004L
1222
1223 #define SQL_IS_INSERT_LITERALS                                  0x00000001L
1224 #define SQL_IS_INSERT_SEARCHED                                  0x00000002L
1225 #define SQL_IS_SELECT_INTO                                              0x00000004L
1226
1227 #define SQL_OIC_CORE                                                    1UL
1228 #define SQL_OIC_LEVEL1                                                  2UL
1229 #define SQL_OIC_LEVEL2                                                  3UL
1230
1231 #define SQL_SFKD_CASCADE                                                0x00000001L
1232 #define SQL_SFKD_NO_ACTION                                              0x00000002L
1233 #define SQL_SFKD_SET_DEFAULT                                    0x00000004L
1234 #define SQL_SFKD_SET_NULL                                               0x00000008L
1235
1236 #define SQL_SFKU_CASCADE                                                0x00000001L
1237 #define SQL_SFKU_NO_ACTION                                              0x00000002L
1238 #define SQL_SFKU_SET_DEFAULT                                    0x00000004L
1239 #define SQL_SFKU_SET_NULL                                               0x00000008L
1240
1241 #define SQL_SG_USAGE_ON_DOMAIN                                  0x00000001L
1242 #define SQL_SG_USAGE_ON_CHARACTER_SET                   0x00000002L
1243 #define SQL_SG_USAGE_ON_COLLATION                               0x00000004L
1244 #define SQL_SG_USAGE_ON_TRANSLATION                             0x00000008L
1245 #define SQL_SG_WITH_GRANT_OPTION                                0x00000010L
1246 #define SQL_SG_DELETE_TABLE                                             0x00000020L
1247 #define SQL_SG_INSERT_TABLE                                             0x00000040L
1248 #define SQL_SG_INSERT_COLUMN                                    0x00000080L
1249 #define SQL_SG_REFERENCES_TABLE                                 0x00000100L
1250 #define SQL_SG_REFERENCES_COLUMN                                0x00000200L
1251 #define SQL_SG_SELECT_TABLE                                             0x00000400L
1252 #define SQL_SG_UPDATE_TABLE                                             0x00000800L
1253 #define SQL_SG_UPDATE_COLUMN                                    0x00001000L
1254
1255 #define SQL_SP_EXISTS                                                   0x00000001L
1256 #define SQL_SP_ISNOTNULL                                                0x00000002L
1257 #define SQL_SP_ISNULL                                                   0x00000004L
1258 #define SQL_SP_MATCH_FULL                                               0x00000008L
1259 #define SQL_SP_MATCH_PARTIAL                                    0x00000010L
1260 #define SQL_SP_MATCH_UNIQUE_FULL                                0x00000020L
1261 #define SQL_SP_MATCH_UNIQUE_PARTIAL                             0x00000040L
1262 #define SQL_SP_OVERLAPS                                                 0x00000080L
1263 #define SQL_SP_UNIQUE                                                   0x00000100L
1264 #define SQL_SP_LIKE                                                             0x00000200L
1265 #define SQL_SP_IN                                                               0x00000400L
1266 #define SQL_SP_BETWEEN                                                  0x00000800L
1267 #define SQL_SP_COMPARISON                                               0x00001000L
1268 #define SQL_SP_QUANTIFIED_COMPARISON                    0x00002000L
1269
1270 #define SQL_SRJO_CORRESPONDING_CLAUSE                   0x00000001L
1271 #define SQL_SRJO_CROSS_JOIN                                             0x00000002L
1272 #define SQL_SRJO_EXCEPT_JOIN                                    0x00000004L
1273 #define SQL_SRJO_FULL_OUTER_JOIN                                0x00000008L
1274 #define SQL_SRJO_INNER_JOIN                                             0x00000010L
1275 #define SQL_SRJO_INTERSECT_JOIN                                 0x00000020L
1276 #define SQL_SRJO_LEFT_OUTER_JOIN                                0x00000040L
1277 #define SQL_SRJO_NATURAL_JOIN                                   0x00000080L
1278 #define SQL_SRJO_RIGHT_OUTER_JOIN                               0x00000100L
1279 #define SQL_SRJO_UNION_JOIN                                             0x00000200L
1280
1281 #define SQL_SR_USAGE_ON_DOMAIN                                  0x00000001L
1282 #define SQL_SR_USAGE_ON_CHARACTER_SET                   0x00000002L
1283 #define SQL_SR_USAGE_ON_COLLATION                               0x00000004L
1284 #define SQL_SR_USAGE_ON_TRANSLATION                             0x00000008L
1285 #define SQL_SR_GRANT_OPTION_FOR                                 0x00000010L
1286 #define SQL_SR_CASCADE                                                  0x00000020L
1287 #define SQL_SR_RESTRICT                                                 0x00000040L
1288 #define SQL_SR_DELETE_TABLE                                             0x00000080L
1289 #define SQL_SR_INSERT_TABLE                                             0x00000100L
1290 #define SQL_SR_INSERT_COLUMN                                    0x00000200L
1291 #define SQL_SR_REFERENCES_TABLE                                 0x00000400L
1292 #define SQL_SR_REFERENCES_COLUMN                                0x00000800L
1293 #define SQL_SR_SELECT_TABLE                                             0x00001000L
1294 #define SQL_SR_UPDATE_TABLE                                             0x00002000L
1295 #define SQL_SR_UPDATE_COLUMN                                    0x00004000L
1296
1297 #define SQL_SRVC_VALUE_EXPRESSION                               0x00000001L
1298 #define SQL_SRVC_NULL                                                   0x00000002L
1299 #define SQL_SRVC_DEFAULT                                                0x00000004L
1300 #define SQL_SRVC_ROW_SUBQUERY                                   0x00000008L
1301
1302 #define SQL_SVE_CASE                                                    0x00000001L
1303 #define SQL_SVE_CAST                                                    0x00000002L
1304 #define SQL_SVE_COALESCE                                                0x00000004L
1305 #define SQL_SVE_NULLIF                                                  0x00000008L
1306
1307 #define SQL_SCC_XOPEN_CLI_VERSION1                              0x00000001L
1308 #define SQL_SCC_ISO92_CLI                                               0x00000002L
1309
1310 #define SQL_US_UNION                                                    SQL_U_UNION
1311 #define SQL_US_UNION_ALL                                                SQL_U_UNION_ALL
1312
1313 #endif
1314
1315 #define SQL_DTC_ENLIST_EXPENSIVE                                0x00000001L
1316 #define SQL_DTC_UNENLIST_EXPENSIVE                              0x00000002L
1317
1318 #if (ODBCVER >= 0x0300)
1319 #define SQL_FETCH_FIRST_USER                            31
1320 #define SQL_FETCH_FIRST_SYSTEM                          32
1321 #endif
1322
1323 #define SQL_ENTIRE_ROWSET            0
1324
1325 #define SQL_POSITION                 0
1326 #define SQL_REFRESH                  1
1327 #define SQL_UPDATE                   2
1328 #define SQL_DELETE                   3
1329
1330 #define SQL_ADD                      4
1331 #define SQL_SETPOS_MAX_OPTION_VALUE                     SQL_ADD
1332 #if (ODBCVER >= 0x0300)
1333 #define SQL_UPDATE_BY_BOOKMARK           5
1334 #define SQL_DELETE_BY_BOOKMARK           6
1335 #define SQL_FETCH_BY_BOOKMARK            7
1336
1337 #endif
1338
1339 #define SQL_LOCK_NO_CHANGE           0
1340 #define SQL_LOCK_EXCLUSIVE           1
1341 #define SQL_LOCK_UNLOCK              2
1342
1343 #define SQL_SETPOS_MAX_LOCK_VALUE               SQL_LOCK_UNLOCK
1344
1345 #define SQL_POSITION_TO(hstmt,irow) SQLSetPos(hstmt,irow,SQL_POSITION,SQL_LOCK_NO_CHANGE)
1346 #define SQL_LOCK_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_POSITION,fLock)
1347 #define SQL_REFRESH_RECORD(hstmt,irow,fLock) SQLSetPos(hstmt,irow,SQL_REFRESH,fLock)
1348 #define SQL_UPDATE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_UPDATE,SQL_LOCK_NO_CHANGE)
1349 #define SQL_DELETE_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_DELETE,SQL_LOCK_NO_CHANGE)
1350 #define SQL_ADD_RECORD(hstmt,irow) SQLSetPos(hstmt,irow,SQL_ADD,SQL_LOCK_NO_CHANGE)
1351
1352 #define SQL_BEST_ROWID                  1
1353 #define SQL_ROWVER                      2
1354
1355 #define SQL_PC_NOT_PSEUDO               1
1356
1357 #define SQL_QUICK                       0
1358 #define SQL_ENSURE                      1
1359
1360 #define SQL_TABLE_STAT                  0
1361
1362 #if (ODBCVER >= 0x0300)
1363 #define SQL_ALL_CATALOGS                                "%"
1364 #define SQL_ALL_SCHEMAS                                 "%"
1365 #define SQL_ALL_TABLE_TYPES                             "%"
1366 #endif  /* ODBCVER >= 0x0300 */
1367
1368 #define SQL_DRIVER_NOPROMPT             0
1369 #define SQL_DRIVER_COMPLETE             1
1370 #define SQL_DRIVER_PROMPT               2
1371 #define SQL_DRIVER_COMPLETE_REQUIRED    3
1372
1373 SQLRETURN WINAPI  SQLDriverConnect(
1374     SQLHDBC            hdbc,
1375     SQLHWND            hwnd,
1376     SQLCHAR               *szConnStrIn,
1377     SQLSMALLINT        cbConnStrIn,
1378     SQLCHAR           *szConnStrOut,
1379     SQLSMALLINT        cbConnStrOutMax,
1380     SQLSMALLINT           *pcbConnStrOut,
1381     SQLUSMALLINT       fDriverCompletion);
1382
1383 #define SQL_FETCH_BOOKMARK               8
1384
1385 #define SQL_ROW_SUCCESS                  0
1386 #define SQL_ROW_DELETED                  1
1387 #define SQL_ROW_UPDATED                  2
1388 #define SQL_ROW_NOROW                    3
1389 #define SQL_ROW_ADDED                    4
1390 #define SQL_ROW_ERROR                    5
1391 #if (ODBCVER >= 0x0300)
1392 #define SQL_ROW_SUCCESS_WITH_INFO                6
1393 #define SQL_ROW_PROCEED                                  0
1394 #define SQL_ROW_IGNORE                                   1
1395 #endif
1396
1397 #if (ODBCVER >= 0x0300)
1398 #define SQL_PARAM_SUCCESS                               0
1399 #define SQL_PARAM_SUCCESS_WITH_INFO             6
1400 #define SQL_PARAM_ERROR                                 5
1401 #define SQL_PARAM_UNUSED                                7
1402 #define SQL_PARAM_DIAG_UNAVAILABLE              1
1403
1404 #define SQL_PARAM_PROCEED                               0
1405 #define SQL_PARAM_IGNORE                                1
1406 #endif
1407
1408 #define SQL_CASCADE                      0
1409 #define SQL_RESTRICT                     1
1410 #define SQL_SET_NULL                     2
1411 #if (ODBCVER >= 0x0250)
1412 #define SQL_NO_ACTION                    3
1413 #define SQL_SET_DEFAULT                  4
1414 #endif
1415
1416 #if (ODBCVER >= 0x0300)
1417
1418 #define SQL_INITIALLY_DEFERRED                  5
1419 #define SQL_INITIALLY_IMMEDIATE                 6
1420 #define SQL_NOT_DEFERRABLE                      7
1421
1422 #endif
1423
1424 #define SQL_PARAM_TYPE_UNKNOWN           0
1425 #define SQL_PARAM_INPUT                  1
1426 #define SQL_PARAM_INPUT_OUTPUT           2
1427 #define SQL_RESULT_COL                   3
1428 #define SQL_PARAM_OUTPUT                 4
1429 #define SQL_RETURN_VALUE                 5
1430
1431 #define SQL_PT_UNKNOWN                   0
1432 #define SQL_PT_PROCEDURE                 1
1433 #define SQL_PT_FUNCTION                  2
1434
1435 #define SQL_ODBC_KEYWORDS "ABSOLUTE,ACTION,ADA,ADD,ALL,ALLOCATE,ALTER,AND,ANY,ARE,AS,"
1436
1437 SQLRETURN WINAPI  SQLBrowseConnect(
1438     SQLHDBC            hdbc,
1439     SQLCHAR               *szConnStrIn,
1440     SQLSMALLINT        cbConnStrIn,
1441     SQLCHAR               *szConnStrOut,
1442     SQLSMALLINT        cbConnStrOutMax,
1443     SQLSMALLINT       *pcbConnStrOut);
1444
1445 #if (ODBCVER >= 0x0300)
1446 SQLRETURN WINAPI        SQLBulkOperations(
1447         SQLHSTMT                        StatementHandle,
1448         SQLSMALLINT                     Operation);
1449 #endif
1450
1451 SQLRETURN WINAPI  SQLColAttributes(
1452     SQLHSTMT           hstmt,
1453     SQLUSMALLINT       icol,
1454     SQLUSMALLINT       fDescType,
1455     SQLPOINTER         rgbDesc,
1456     SQLSMALLINT        cbDescMax,
1457     SQLSMALLINT           *pcbDesc,
1458     SQLINTEGER            *pfDesc);
1459
1460 SQLRETURN WINAPI  SQLColumnPrivileges(
1461     SQLHSTMT           hstmt,
1462     SQLCHAR               *szCatalogName,
1463     SQLSMALLINT        cbCatalogName,
1464     SQLCHAR               *szSchemaName,
1465     SQLSMALLINT        cbSchemaName,
1466     SQLCHAR               *szTableName,
1467     SQLSMALLINT        cbTableName,
1468     SQLCHAR               *szColumnName,
1469     SQLSMALLINT        cbColumnName);
1470
1471 SQLRETURN WINAPI  SQLDescribeParam(
1472     SQLHSTMT           hstmt,
1473     SQLUSMALLINT       ipar,
1474     SQLSMALLINT           *pfSqlType,
1475     SQLUINTEGER           *pcbParamDef,
1476     SQLSMALLINT           *pibScale,
1477     SQLSMALLINT           *pfNullable);
1478
1479 SQLRETURN WINAPI  SQLExtendedFetch(
1480     SQLHSTMT           hstmt,
1481     SQLUSMALLINT       fFetchType,
1482     SQLINTEGER         irow,
1483     SQLUINTEGER           *pcrow,
1484     SQLUSMALLINT          *rgfRowStatus);
1485
1486 SQLRETURN WINAPI  SQLForeignKeys(
1487     SQLHSTMT           hstmt,
1488     SQLCHAR               *szPkCatalogName,
1489     SQLSMALLINT        cbPkCatalogName,
1490     SQLCHAR               *szPkSchemaName,
1491     SQLSMALLINT        cbPkSchemaName,
1492     SQLCHAR               *szPkTableName,
1493     SQLSMALLINT        cbPkTableName,
1494     SQLCHAR               *szFkCatalogName,
1495     SQLSMALLINT        cbFkCatalogName,
1496     SQLCHAR               *szFkSchemaName,
1497     SQLSMALLINT        cbFkSchemaName,
1498     SQLCHAR               *szFkTableName,
1499     SQLSMALLINT        cbFkTableName);
1500
1501 SQLRETURN WINAPI  SQLMoreResults(
1502     SQLHSTMT           hstmt);
1503
1504 SQLRETURN WINAPI  SQLNativeSql(
1505     SQLHDBC            hdbc,
1506     SQLCHAR               *szSqlStrIn,
1507     SQLINTEGER         cbSqlStrIn,
1508     SQLCHAR               *szSqlStr,
1509     SQLINTEGER         cbSqlStrMax,
1510     SQLINTEGER            *pcbSqlStr);
1511
1512 SQLRETURN WINAPI  SQLNumParams(
1513     SQLHSTMT           hstmt,
1514     SQLSMALLINT           *pcpar);
1515
1516 SQLRETURN WINAPI  SQLParamOptions(
1517     SQLHSTMT           hstmt,
1518     SQLUINTEGER        crow,
1519     SQLUINTEGER           *pirow);
1520
1521 SQLRETURN WINAPI  SQLPrimaryKeys(
1522     SQLHSTMT           hstmt,
1523     SQLCHAR               *szCatalogName,
1524     SQLSMALLINT        cbCatalogName,
1525     SQLCHAR               *szSchemaName,
1526     SQLSMALLINT        cbSchemaName,
1527     SQLCHAR               *szTableName,
1528     SQLSMALLINT        cbTableName);
1529
1530 SQLRETURN WINAPI  SQLProcedureColumns(
1531     SQLHSTMT           hstmt,
1532     SQLCHAR               *szCatalogName,
1533     SQLSMALLINT        cbCatalogName,
1534     SQLCHAR               *szSchemaName,
1535     SQLSMALLINT        cbSchemaName,
1536     SQLCHAR               *szProcName,
1537     SQLSMALLINT        cbProcName,
1538     SQLCHAR               *szColumnName,
1539     SQLSMALLINT        cbColumnName);
1540
1541 SQLRETURN WINAPI  SQLProcedures(
1542     SQLHSTMT           hstmt,
1543     SQLCHAR               *szCatalogName,
1544     SQLSMALLINT        cbCatalogName,
1545     SQLCHAR               *szSchemaName,
1546     SQLSMALLINT        cbSchemaName,
1547     SQLCHAR               *szProcName,
1548     SQLSMALLINT        cbProcName);
1549
1550 SQLRETURN WINAPI  SQLSetPos(
1551     SQLHSTMT           hstmt,
1552     SQLUSMALLINT       irow,
1553     SQLUSMALLINT       fOption,
1554     SQLUSMALLINT       fLock);
1555
1556 SQLRETURN WINAPI  SQLTablePrivileges(
1557     SQLHSTMT           hstmt,
1558     SQLCHAR               *szCatalogName,
1559     SQLSMALLINT        cbCatalogName,
1560     SQLCHAR               *szSchemaName,
1561     SQLSMALLINT        cbSchemaName,
1562     SQLCHAR               *szTableName,
1563     SQLSMALLINT        cbTableName);
1564
1565 SQLRETURN WINAPI  SQLDrivers(
1566     SQLHENV            henv,
1567     SQLUSMALLINT       fDirection,
1568     SQLCHAR               *szDriverDesc,
1569     SQLSMALLINT        cbDriverDescMax,
1570     SQLSMALLINT           *pcbDriverDesc,
1571     SQLCHAR               *szDriverAttributes,
1572     SQLSMALLINT        cbDrvrAttrMax,
1573     SQLSMALLINT           *pcbDrvrAttr);
1574
1575 SQLRETURN WINAPI  SQLBindParameter(
1576     SQLHSTMT           hstmt,
1577     SQLUSMALLINT       ipar,
1578     SQLSMALLINT        fParamType,
1579     SQLSMALLINT        fCType,
1580     SQLSMALLINT        fSqlType,
1581     SQLUINTEGER        cbColDef,
1582     SQLSMALLINT        ibScale,
1583     SQLPOINTER         rgbValue,
1584     SQLINTEGER         cbValueMax,
1585     SQLINTEGER            *pcbValue);
1586
1587 #ifdef ODBC_STD
1588 #define SQLAllocHandle  SQLAllocHandleStd
1589 #define SQLAllocEnv(phenv)  SQLAllocHandleStd(SQL_HANDLE_ENV, SQL_NULL_HANDLE, phenv)
1590
1591 #define SQL_YEAR                                                SQL_CODE_YEAR
1592 #define SQL_MONTH                                               SQL_CODE_MONTH
1593 #define SQL_DAY                                                 SQL_CODE_DAY
1594 #define SQL_HOUR                                                SQL_CODE_HOUR
1595 #define SQL_MINUTE                                              SQL_CODE_MINUTE
1596 #define SQL_SECOND                                              SQL_CODE_SECOND
1597 #define SQL_YEAR_TO_MONTH                               SQL_CODE_YEAR_TO_MONTH
1598 #define SQL_DAY_TO_HOUR                                 SQL_CODE_DAY_TO_HOUR
1599 #define SQL_DAY_TO_MINUTE                               SQL_CODE_DAY_TO_MINUTE
1600 #define SQL_DAY_TO_SECOND                               SQL_CODE_DAY_TO_SECOND
1601 #define SQL_HOUR_TO_MINUTE                              SQL_CODE_HOUR_TO_MINUTE
1602 #define SQL_HOUR_TO_SECOND                              SQL_CODE_HOUR_TO_SECOND
1603 #define SQL_MINUTE_TO_SECOND                    SQL_CODE_MINUTE_TO_SECOND
1604 #endif
1605
1606 #if (ODBCVER >= 0x0300)
1607 SQLRETURN WINAPI  SQLAllocHandleStd(
1608         SQLSMALLINT             fHandleType,
1609         SQLHANDLE               hInput,
1610         SQLHANDLE          *phOutput);
1611 #endif
1612
1613 #define SQL_DATABASE_NAME               16
1614 #define SQL_FD_FETCH_PREV               SQL_FD_FETCH_PRIOR
1615 #define SQL_FETCH_PREV                  SQL_FETCH_PRIOR
1616 #define SQL_CONCUR_TIMESTAMP            SQL_CONCUR_ROWVER
1617 #define SQL_SCCO_OPT_TIMESTAMP          SQL_SCCO_OPT_ROWVER
1618 #define SQL_CC_DELETE                   SQL_CB_DELETE
1619 #define SQL_CR_DELETE                   SQL_CB_DELETE
1620 #define SQL_CC_CLOSE                    SQL_CB_CLOSE
1621 #define SQL_CR_CLOSE                    SQL_CB_CLOSE
1622 #define SQL_CC_PRESERVE                 SQL_CB_PRESERVE
1623 #define SQL_CR_PRESERVE                 SQL_CB_PRESERVE
1624 #define SQL_SCROLL_FORWARD_ONLY         0L
1625 #define SQL_SCROLL_KEYSET_DRIVEN        (-1L)
1626 #define SQL_SCROLL_DYNAMIC              (-2L)
1627 #define SQL_SCROLL_STATIC               (-3L)
1628
1629 SQLRETURN WINAPI  SQLSetScrollOptions(
1630     SQLHSTMT           hstmt,
1631     SQLUSMALLINT       fConcurrency,
1632     SQLINTEGER         crowKeyset,
1633     SQLUSMALLINT       crowRowset);
1634
1635 #define         TRACE_VERSION   1000
1636
1637 RETCODE  TraceOpenLogFile(LPWSTR,LPWSTR,DWORD);
1638 RETCODE  TraceCloseLogFile(void);
1639 VOID     TraceReturn(RETCODE,RETCODE);
1640 DWORD    TraceVersion(void);
1641
1642 /*#define TRACE_ON              0x00000001L*/
1643 #define TRACE_VS_EVENT_ON       0x00000002L
1644
1645 RETCODE TraceVSControl(DWORD);
1646
1647 #define ODBC_VS_FLAG_UNICODE_ARG        0x00000001L
1648 #define ODBC_VS_FLAG_UNICODE_COR        0x00000002L
1649 #define ODBC_VS_FLAG_RETCODE            0x00000004L
1650 #define ODBC_VS_FLAG_STOP               0x00000008L
1651
1652 typedef struct tagODBC_VS_ARGS {
1653         const GUID      *pguidEvent;
1654         DWORD   dwFlags;
1655         union {
1656                 WCHAR   *wszArg;
1657                 CHAR    *szArg;
1658         } DUMMYUNIONNAME1;
1659         union {
1660                 WCHAR   *wszCorrelation;
1661                 CHAR    *szCorrelation;
1662         } DUMMYUNIONNAME2;
1663         RETCODE RetCode;
1664 } ODBC_VS_ARGS, *PODBC_VS_ARGS;
1665
1666 VOID    FireVSDebugEvent(PODBC_VS_ARGS);
1667
1668
1669 #ifdef __cplusplus
1670 }
1671 #endif
1672
1673 #endif