1 /**
2 Declarations for interfacing with the ODBC library.
3 
4 Adapted with minimal changes from the work of David L. Davis
5 (refer to the $(HTTP
6 forum.dlang.org/post/cfk7ql$(DOLLAR)1p4n$(DOLLAR)1@digitaldaemon.com,
7 original announcement)).
8 
9 `odbc.sql` is the the main include for ODBC v3.0+ Core functions,
10 corresponding to the `sql.h` C header file. It `import`s `public`ly
11 `odbc.sqltypes` for conformity with the C header.
12 
13 Note: The ODBC library itself not a part of the `dmd` distribution (and
14 typically not a part of the distribution packages of other compilers
15 such as `gdc` and `ldc`). To use ODBC, install it per the vendor- and
16 platform-specific instructions and then use the appropriate command-line
17 flags (e.g. for dmd, `-L-lodbc` on Posix and `-Lodbc32.lib` on Windows) to link
18 with the ODBC library. On Windows, using $(D pragma(lib, "odbc32")) in D
19 code at top level is also appropriate.
20 
21 See_Also: $(LINK2 https://docs.microsoft.com/en-us/sql/odbc/reference/syntax/odbc-api-reference,
22             ODBC API Reference on MSN Online)
23 */
24 
25 module odbc.sql;
26 
27 public import odbc.sqltypes;
28 
29 extern (Windows):
30 
31 // * special length/indicator values *
32 enum int SQL_NULL_DATA    = (-1);
33 enum int SQL_DATA_AT_EXEC = (-2);
34 
35 // * return values from functions *
36 enum
37 {
38     SQL_SUCCESS           = 0,
39     SQL_SUCCESS_WITH_INFO = 1,
40     SQL_NO_DATA           = 100,
41     SQL_ERROR             = (-1),
42     SQL_INVALID_HANDLE    = (-2),
43     SQL_STILL_EXECUTING   = 2,
44     SQL_NEED_DATA         = 99
45 }
46 
47 /* test for SQL_SUCCESS or SQL_SUCCESS_WITH_INFO */
48 bool SQL_SUCCEEDED()(uint rc) { return (rc & ~1U) == 0; }
49 
50 enum
51 {
52     // * flags for null-terminated string *
53     SQL_NTS                         = (-3),
54     SQL_NTSL                        = (-3L),
55 
56     // * maximum message length *
57     SQL_MAX_MESSAGE_LENGTH          = 512,
58 
59     // * date/time length constants *
60     SQL_DATE_LEN                    = 10,
61     SQL_TIME_LEN                    =  8,  /* add P+1 if precision is nonzero */
62     SQL_TIMESTAMP_LEN               = 19,  /* add P+1 if precision is nonzero */
63 
64     // * handle type identifiers *
65     SQL_HANDLE_ENV                  = 1,
66     SQL_HANDLE_DBC                  = 2,
67     SQL_HANDLE_STMT                 = 3,
68     SQL_HANDLE_DESC                 = 4,
69 
70     // * environment attribute *
71     SQL_ATTR_OUTPUT_NTS             = 10_001,
72 
73     // * connection attributes *
74     SQL_ATTR_AUTO_IPD               = 10_001,
75     SQL_ATTR_METADATA_ID            = 10_014,
76 
77     // * statement attributes *
78     SQL_ATTR_APP_ROW_DESC           = 10_010,
79     SQL_ATTR_APP_PARAM_DESC         = 10_011,
80     SQL_ATTR_IMP_ROW_DESC           = 10_012,
81     SQL_ATTR_IMP_PARAM_DESC         = 10_013,
82     SQL_ATTR_CURSOR_SCROLLABLE      = (-1),
83     SQL_ATTR_CURSOR_SENSITIVITY     = (-2),
84 
85     // * SQL_ATTR_CURSOR_SCROLLABLE values *
86     SQL_NONSCROLLABLE               = 0,
87     SQL_SCROLLABLE                  = 1,
88 
89     // * identifiers of fields in the SQL descriptor *
90     SQL_DESC_COUNT                  = 1001,
91     SQL_DESC_TYPE                   = 1002,
92     SQL_DESC_LENGTH                 = 1003,
93     SQL_DESC_OCTET_LENGTH_PTR       = 1004,
94     SQL_DESC_PRECISION              = 1005,
95     SQL_DESC_SCALE                  = 1006,
96     SQL_DESC_DATETIME_INTERVAL_CODE = 1007,
97     SQL_DESC_NULLABLE               = 1008,
98     SQL_DESC_INDICATOR_PTR          = 1009,
99     SQL_DESC_DATA_PTR               = 1010,
100     SQL_DESC_NAME                   = 1011,
101     SQL_DESC_UNNAMED                = 1012,
102     SQL_DESC_OCTET_LENGTH           = 1013,
103     SQL_DESC_ALLOC_TYPE             = 1099
104 }
105 
106 // * identifiers of fields in the diagnostics area *
107 enum
108 {
109     SQL_DIAG_RETURNCODE            = 1,
110     SQL_DIAG_NUMBER                = 2,
111     SQL_DIAG_ROW_COUNT             = 3,
112     SQL_DIAG_SQLSTATE              = 4,
113     SQL_DIAG_NATIVE                = 5,
114     SQL_DIAG_MESSAGE_TEXT          = 6,
115     SQL_DIAG_DYNAMIC_FUNCTION      = 7,
116     SQL_DIAG_CLASS_ORIGIN          = 8,
117     SQL_DIAG_SUBCLASS_ORIGIN       = 9,
118     SQL_DIAG_CONNECTION_NAME       = 10,
119     SQL_DIAG_SERVER_NAME           = 11,
120     SQL_DIAG_DYNAMIC_FUNCTION_CODE = 12
121 }
122 
123 // * dynamic function codes *
124 enum
125 {
126     SQL_DIAG_ALTER_DOMAIN          = 3,
127     SQL_DIAG_ALTER_TABLE           = 4,
128     SQL_DIAG_CALL                  = 7,
129     SQL_DIAG_CREATE_ASSERTION      = 6,
130     SQL_DIAG_CREATE_CHARACTER_SET  = 8,
131     SQL_DIAG_CREATE_COLLATION      = 10,
132     SQL_DIAG_CREATE_DOMAIN         = 23,
133     SQL_DIAG_CREATE_INDEX          = (-1),
134     SQL_DIAG_CREATE_SCHEMA         = 64,
135     SQL_DIAG_CREATE_TABLE          = 77,
136     SQL_DIAG_CREATE_TRANSLATION    = 79,
137     SQL_DIAG_CREATE_VIEW           = 84,
138     SQL_DIAG_DELETE_WHERE          = 19,
139     SQL_DIAG_DROP_ASSERTION        = 24,
140     SQL_DIAG_DROP_CHARACTER_SET    = 25,
141     SQL_DIAG_DROP_COLLATION        = 26,
142     SQL_DIAG_DROP_DOMAIN           = 27,
143     SQL_DIAG_DROP_INDEX            = (-2),
144     SQL_DIAG_DROP_SCHEMA           = 31,
145     SQL_DIAG_DROP_TABLE            = 32,
146     SQL_DIAG_DROP_TRANSLATION      = 33,
147     SQL_DIAG_DROP_VIEW             = 36,
148     SQL_DIAG_DYNAMIC_DELETE_CURSOR = 38,
149     SQL_DIAG_DYNAMIC_UPDATE_CURSOR = 81,
150     SQL_DIAG_GRANT                 = 48,
151     SQL_DIAG_INSERT                = 50,
152     SQL_DIAG_REVOKE                = 59,
153     SQL_DIAG_SELECT_CURSOR         = 85,
154     SQL_DIAG_UNKNOWN_STATEMENT     = 0,
155     SQL_DIAG_UPDATE_WHERE          = 82
156 }
157 
158 enum
159 {
160     // * SQL data type codes *
161     SQL_UNKNOWN_TYPE   = 0,
162     SQL_CHAR           = 1,
163     SQL_NUMERIC        = 2,
164     SQL_DECIMAL        = 3,
165     SQL_INTEGER        = 4,
166     SQL_SMALLINT       = 5,
167     SQL_FLOAT          = 6,
168     SQL_REAL           = 7,
169     SQL_DOUBLE         = 8,
170     SQL_DATETIME       = 9,
171     SQL_VARCHAR        = 12,
172 
173     // * One-parameter shortcuts for date/time data types *
174     SQL_TYPE_DATE      = 91,
175     SQL_TYPE_TIME      = 92,
176     SQL_TYPE_TIMESTAMP = 93
177 }
178 
179 // * Statement attribute values for cursor sensitivity *
180 enum
181 {
182     SQL_UNSPECIFIED = 0,
183     SQL_INSENSITIVE = 1,
184     SQL_SENSITIVE   = 2
185 }
186 
187 // * GetTypeInfo() request for all data types *
188 enum
189 {
190     SQL_ALL_TYPES = 0
191 }
192 
193 // * Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() *
194 enum { SQL_DEFAULT = 99 }
195 
196 /+ SQLGetData() code indicating that the application row descriptor
197  ' specifies the data type
198  +/
199 enum
200 {
201     SQL_ARD_TYPE = (-99)
202 }
203 
204 // * SQL date/time type subcodes *
205 enum
206 {
207     SQL_CODE_DATE      = 1,
208     SQL_CODE_TIME      = 2,
209     SQL_CODE_TIMESTAMP = 3
210 }
211 
212 // * CLI option values *
213 enum
214 {
215     SQL_FALSE = 0,
216     SQL_TRUE  = 1
217 }
218 
219 // * values of NULLABLE field in descriptor *
220 enum
221 {
222     SQL_NO_NULLS = 0,
223     SQL_NULLABLE = 1
224 }
225 
226 /+ Value returned by SQLGetTypeInfo() to denote that it is
227  ' not known whether or not a data type supports null values.
228  +/
229 enum { SQL_NULLABLE_UNKNOWN = 2 }
230 
231 /+ Values returned by SQLGetTypeInfo() to show WHERE clause
232  ' supported
233  +/
234 enum
235 {
236     SQL_PRED_NONE  = 0,
237     SQL_PRED_CHAR  = 1,
238     SQL_PRED_BASIC = 2
239 }
240 
241 // * values of UNNAMED field in descriptor *
242 enum
243 {
244     SQL_NAMED   = 0,
245     SQL_UNNAMED = 1
246 }
247 
248 // * values of ALLOC_TYPE field in descriptor *
249 enum
250 {
251     SQL_DESC_ALLOC_AUTO = 1,
252     SQL_DESC_ALLOC_USER = 2
253 }
254 
255 // * FreeStmt() options *
256 enum
257 {
258     SQL_CLOSE        = 0,
259     SQL_DROP         = 1,
260     SQL_UNBIND       = 2,
261     SQL_RESET_PARAMS = 3
262 }
263 
264 // * Codes used for FetchOrientation in SQLFetchScroll(), and in SQLDataSources() *
265 enum
266 {
267     SQL_FETCH_NEXT  = 1,
268     SQL_FETCH_FIRST = 2
269 }
270 
271 // * Other codes used for FetchOrientation in SQLFetchScroll() *
272 enum
273 {
274     SQL_FETCH_LAST     = 3,
275     SQL_FETCH_PRIOR    = 4,
276     SQL_FETCH_ABSOLUTE = 5,
277     SQL_FETCH_RELATIVE = 6
278 }
279 
280 // * SQLEndTran() options *
281 enum
282 {
283     SQL_COMMIT   = 0,
284     SQL_ROLLBACK = 1
285 }
286 
287 // * null handles returned by SQLAllocHandle() *
288 enum SQLHANDLE SQL_NULL_HENV  = cast(SQLHANDLE) 0;
289 enum SQLHANDLE SQL_NULL_HDBC  = cast(SQLHANDLE) 0;
290 enum SQLHANDLE SQL_NULL_HSTMT = cast(SQLHANDLE) 0;
291 enum SQLHANDLE SQL_NULL_HDESC = cast(SQLHANDLE) 0;
292 
293 // * null handle used in place of parent handle when allocating HENV *
294 enum SQLHANDLE SQL_NULL_HANDLE = cast(SQLHANDLE) 0L;
295 
296 // * Values that may appear in the result set of SQLSpecialColumns() *
297 enum
298 {
299     SQL_SCOPE_CURROW      = 0,
300     SQL_SCOPE_TRANSACTION = 1,
301     SQL_SCOPE_SESSION     = 2
302 }
303 
304 enum
305 {
306     SQL_PC_UNKNOWN    = 0,
307     SQL_PC_NON_PSEUDO = 1,
308     SQL_PC_PSEUDO     = 2
309 }
310 
311 // * Reserved value for the IdentifierType argument of SQLSpecialColumns() *
312 enum
313 {
314     SQL_ROW_IDENTIFIER = 1
315 }
316 
317 // * Reserved values for UNIQUE argument of SQLStatistics() *
318 enum
319 {
320     SQL_INDEX_UNIQUE    = 0,
321     SQL_INDEX_ALL       = 1,
322 
323     // * Values that may appear in the result set of SQLStatistics() *
324     SQL_INDEX_CLUSTERED = 1,
325     SQL_INDEX_HASHED    = 2,
326     SQL_INDEX_OTHER     = 3
327 }
328 
329 // * SQLGetFunctions() values to identify ODBC APIs *
330 enum
331 {
332     SQL_API_SQLALLOCCONNECT     =    1,
333     SQL_API_SQLALLOCENV         =    2,
334     SQL_API_SQLALLOCHANDLE      = 1001,
335     SQL_API_SQLALLOCSTMT        =    3,
336     SQL_API_SQLBINDCOL          =    4,
337     SQL_API_SQLBINDPARAM        = 1002,
338     SQL_API_SQLCANCEL           =    5,
339     SQL_API_SQLCLOSECURSOR      = 1003,
340     SQL_API_SQLCOLATTRIBUTE     =    6,
341     SQL_API_SQLCOLUMNS          =   40,
342     SQL_API_SQLCONNECT          =    7,
343     SQL_API_SQLCOPYDESC         = 1004,
344     SQL_API_SQLDATASOURCES      =   57,
345     SQL_API_SQLDESCRIBECOL      =    8,
346     SQL_API_SQLDISCONNECT       =    9,
347     SQL_API_SQLENDTRAN          = 1005,
348     SQL_API_SQLERROR            =   10,
349     SQL_API_SQLEXECDIRECT       =   11,
350     SQL_API_SQLEXECUTE          =   12,
351     SQL_API_SQLFETCH            =   13,
352     SQL_API_SQLFETCHSCROLL      = 1021,
353     SQL_API_SQLFREECONNECT      =   14,
354     SQL_API_SQLFREEENV          =   15,
355     SQL_API_SQLFREEHANDLE       = 1006,
356     SQL_API_SQLFREESTMT         =   16,
357     SQL_API_SQLGETCONNECTATTR   = 1007,
358     SQL_API_SQLGETCONNECTOPTION =   42,
359     SQL_API_SQLGETCURSORNAME    =   17,
360     SQL_API_SQLGETDATA          =   43,
361     SQL_API_SQLGETDESCFIELD     = 1008,
362     SQL_API_SQLGETDESCREC       = 1009,
363     SQL_API_SQLGETDIAGFIELD     = 1010,
364     SQL_API_SQLGETDIAGREC       = 1011,
365     SQL_API_SQLGETENVATTR       = 1012,
366     SQL_API_SQLGETFUNCTIONS     =   44,
367     SQL_API_SQLGETINFO          =   45,
368     SQL_API_SQLGETSTMTATTR      = 1014,
369     SQL_API_SQLGETSTMTOPTION    =   46,
370     SQL_API_SQLGETTYPEINFO      =   47,
371     SQL_API_SQLNUMRESULTCOLS    =   18,
372     SQL_API_SQLPARAMDATA        =   48,
373     SQL_API_SQLPREPARE          =   19,
374     SQL_API_SQLPUTDATA          =   49,
375     SQL_API_SQLROWCOUNT         =   20,
376     SQL_API_SQLSETCONNECTATTR   = 1016,
377     SQL_API_SQLSETCONNECTOPTION =   50,
378     SQL_API_SQLSETCURSORNAME    =   21,
379     SQL_API_SQLSETDESCFIELD     = 1017,
380     SQL_API_SQLSETDESCREC       = 1018,
381     SQL_API_SQLSETENVATTR       = 1019,
382     SQL_API_SQLSETPARAM         =   22,
383     SQL_API_SQLSETSTMTATTR      = 1020,
384     SQL_API_SQLSETSTMTOPTION    =   51,
385     SQL_API_SQLSPECIALCOLUMNS   =   52,
386     SQL_API_SQLSTATISTICS       =   53,
387     SQL_API_SQLTABLES           =   54,
388     SQL_API_SQLTRANSACT         =   23
389 }
390 
391 // * Information requested by SQLGetInfo() *
392 enum
393 {
394     SQL_MAX_DRIVER_CONNECTIONS        = 0,
395     SQL_MAXIMUM_DRIVER_CONNECTIONS    = SQL_MAX_DRIVER_CONNECTIONS,
396     SQL_MAX_CONCURRENT_ACTIVITIES     = 1,
397     SQL_MAXIMUM_CONCURRENT_ACTIVITIES = SQL_MAX_CONCURRENT_ACTIVITIES,
398     SQL_DATA_SOURCE_NAME              = 2,
399     SQL_FETCH_DIRECTION               = 8,
400     SQL_SERVER_NAME                   = 13,
401     SQL_SEARCH_PATTERN_ESCAPE         = 14,
402     SQL_DBMS_NAME                     = 17,
403     SQL_DBMS_VER                      = 18,
404     SQL_ACCESSIBLE_TABLES             = 19,
405     SQL_ACCESSIBLE_PROCEDURES         = 20,
406     SQL_CURSOR_COMMIT_BEHAVIOR        = 23,
407     SQL_DATA_SOURCE_READ_ONLY         = 25,
408     SQL_DEFAULT_TXN_ISOLATION         = 26,
409     SQL_IDENTIFIER_CASE               = 28,
410     SQL_IDENTIFIER_QUOTE_CHAR         = 29,
411     SQL_MAX_COLUMN_NAME_LEN           = 30,
412     SQL_MAXIMUM_COLUMN_NAME_LENGTH    = SQL_MAX_COLUMN_NAME_LEN,
413     SQL_MAX_CURSOR_NAME_LEN           = 31,
414     SQL_MAXIMUM_CURSOR_NAME_LENGTH    = SQL_MAX_CURSOR_NAME_LEN,
415     SQL_MAX_SCHEMA_NAME_LEN           = 32,
416     SQL_MAXIMUM_SCHEMA_NAME_LENGTH    = SQL_MAX_SCHEMA_NAME_LEN,
417     SQL_MAX_CATALOG_NAME_LEN          = 34,
418     SQL_MAXIMUM_CATALOG_NAME_LENGTH   = SQL_MAX_CATALOG_NAME_LEN,
419     SQL_MAX_TABLE_NAME_LEN            = 35,
420     SQL_SCROLL_CONCURRENCY            = 43,
421     SQL_TXN_CAPABLE                   = 46,
422     SQL_TRANSACTION_CAPABLE           = SQL_TXN_CAPABLE,
423     SQL_USER_NAME                     = 47,
424     SQL_TXN_ISOLATION_OPTION          = 72,
425     SQL_TRANSACTION_ISOLATION_OPTION  = SQL_TXN_ISOLATION_OPTION,
426     SQL_INTEGRITY                     = 73,
427     SQL_GETDATA_EXTENSIONS            = 81,
428     SQL_NULL_COLLATION                = 85,
429     SQL_ALTER_TABLE                   = 86,
430     SQL_ORDER_BY_COLUMNS_IN_SELECT    = 90,
431     SQL_SPECIAL_CHARACTERS            = 94,
432     SQL_MAX_COLUMNS_IN_GROUP_BY       = 97,
433     SQL_MAXIMUM_COLUMNS_IN_GROUP_BY   = SQL_MAX_COLUMNS_IN_GROUP_BY,
434     SQL_MAX_COLUMNS_IN_INDEX          = 98,
435     SQL_MAXIMUM_COLUMNS_IN_INDEX      = SQL_MAX_COLUMNS_IN_INDEX,
436     SQL_MAX_COLUMNS_IN_ORDER_BY       = 99,
437     SQL_MAXIMUM_COLUMNS_IN_ORDER_BY   = SQL_MAX_COLUMNS_IN_ORDER_BY,
438     SQL_MAX_COLUMNS_IN_SELECT         = 100,
439     SQL_MAXIMUM_COLUMNS_IN_SELECT     = SQL_MAX_COLUMNS_IN_SELECT,
440     SQL_MAX_COLUMNS_IN_TABLE          = 101,
441     SQL_MAX_INDEX_SIZE                = 102,
442     SQL_MAXIMUM_INDEX_SIZE            = SQL_MAX_INDEX_SIZE,
443     SQL_MAX_ROW_SIZE                  = 104,
444     SQL_MAXIMUM_ROW_SIZE              = SQL_MAX_ROW_SIZE,
445     SQL_MAX_STATEMENT_LEN             = 105,
446     SQL_MAXIMUM_STATEMENT_LENGTH      = SQL_MAX_STATEMENT_LEN,
447     SQL_MAX_TABLES_IN_SELECT          = 106,
448     SQL_MAXIMUM_TABLES_IN_SELECT      = SQL_MAX_TABLES_IN_SELECT,
449     SQL_MAX_USER_NAME_LEN             = 107,
450     SQL_MAXIMUM_USER_NAME_LENGTH      = SQL_MAX_USER_NAME_LEN,
451     SQL_OJ_CAPABILITIES               = 115,
452     SQL_OUTER_JOIN_CAPABILITIES       = SQL_OJ_CAPABILITIES
453 }
454 
455 enum
456 {
457     SQL_XOPEN_CLI_YEAR            = 10_000,
458     SQL_CURSOR_SENSITIVITY        = 10_001,
459     SQL_DESCRIBE_PARAMETER        = 10_002,
460     SQL_CATALOG_NAME              = 10_003,
461     SQL_COLLATION_SEQ             = 10_004,
462     SQL_MAX_IDENTIFIER_LEN        = 10_005,
463     SQL_MAXIMUM_IDENTIFIER_LENGTH = SQL_MAX_IDENTIFIER_LEN
464 }
465 
466 // * SQL_ALTER_TABLE bitmasks *
467 enum
468 {
469     SQL_AT_ADD_COLUMN     = 0x00000001L,
470     SQL_AT_DROP_COLUMN    = 0x00000002L,
471     SQL_AT_ADD_CONSTRAINT = 0x00000008L
472 }
473 
474 /+ The following bitmasks are ODBC extensions and defined in sqlext.d
475 enum : ulong
476 {
477     SQL_AT_COLUMN_SINGLE                  = 0x00000020L,
478     SQL_AT_ADD_COLUMN_DEFAULT             = 0x00000040L,
479     SQL_AT_ADD_COLUMN_COLLATION           = 0x00000080L,
480     SQL_AT_SET_COLUMN_DEFAULT             = 0x00000100L,
481     SQL_AT_DROP_COLUMN_DEFAULT            = 0x00000200L,
482     SQL_AT_DROP_COLUMN_CASCADE            = 0x00000400L,
483     SQL_AT_DROP_COLUMN_RESTRICT           = 0x00000800L,
484     SQL_AT_ADD_TABLE_CONSTRAINT           = 0x00001000L,
485     SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE  = 0x00002000L,
486     SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT = 0x00004000L,
487     SQL_AT_CONSTRAINT_NAME_DEFINITION     = 0x00008000L,
488     SQL_AT_CONSTRAINT_INITIALLY_DEFERRED  = 0x00010000L,
489     SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE = 0x00020000L,
490     SQL_AT_CONSTRAINT_DEFERRABLE          = 0x00040000L,
491     SQL_AT_CONSTRAINT_NON_DEFERRABLE      = 0x00080000L
492 }
493 +/
494 
495 // * SQL_ASYNC_MODE values *
496 enum
497 {
498     SQL_AM_NONE       = 0,
499     SQL_AM_CONNECTION = 1,
500     SQL_AM_STATEMENT  = 2
501 }
502 
503 // * SQL_CURSOR_COMMIT_BEHAVIOR values *
504 enum
505 {
506     SQL_CB_DELETE   = 0,
507     SQL_CB_CLOSE    = 1,
508     SQL_CB_PRESERVE = 2
509 }
510 
511 // * SQL_FETCH_DIRECTION bitmasks *
512 enum
513 {
514     SQL_FD_FETCH_NEXT     = 0x00000001L,
515     SQL_FD_FETCH_FIRST    = 0x00000002L,
516     SQL_FD_FETCH_LAST     = 0x00000004L,
517     SQL_FD_FETCH_PRIOR    = 0x00000008L,
518     SQL_FD_FETCH_ABSOLUTE = 0x00000010L,
519     SQL_FD_FETCH_RELATIVE = 0x00000020L
520 }
521 
522 // * SQL_GETDATA_EXTENSIONS bitmasks *
523 enum
524 {
525     SQL_GD_ANY_COLUMN = 0x00000001L,
526     SQL_GD_ANY_ORDER  = 0x00000002L
527 }
528 
529 // * SQL_IDENTIFIER_CASE values *
530 enum
531 {
532     SQL_IC_UPPER     = 1,
533     SQL_IC_LOWER     = 2,
534     SQL_IC_SENSITIVE = 3,
535     SQL_IC_MIXED     = 4
536 }
537 
538 // * SQL_OJ_CAPABILITIES bitmasks *
539 // * OJ means 'outer join' *
540 enum
541 {
542     SQL_OJ_LEFT               = 0x00000001L,
543     SQL_OJ_RIGHT              = 0x00000002L,
544     SQL_OJ_FULL               = 0x00000004L,
545     SQL_OJ_NESTED             = 0x00000008L,
546     SQL_OJ_NOT_ORDERED        = 0x00000010L,
547     SQL_OJ_INNER              = 0x00000020L,
548     SQL_OJ_ALL_COMPARISON_OPS = 0x00000040L
549 }
550 
551 // * SQL_SCROLL_CONCURRENCY bitmasks *
552 enum
553 {
554     SQL_SCCO_READ_ONLY  = 0x00000001L,
555     SQL_SCCO_LOCK       = 0x00000002L,
556     SQL_SCCO_OPT_ROWVER = 0x00000004L,
557     SQL_SCCO_OPT_VALUES = 0x00000008L
558 }
559 
560 // * SQL_TXN_CAPABLE values *
561 enum
562 {
563     SQL_TC_NONE       = 0,
564     SQL_TC_DML        = 1,
565     SQL_TC_ALL        = 2,
566     SQL_TC_DDL_COMMIT = 3,
567     SQL_TC_DDL_IGNORE = 4
568 }
569 
570 // * SQL_TXN_ISOLATION_OPTION bitmasks *
571 enum
572 {
573     SQL_TXN_READ_UNCOMMITTED         = 0x00000001L,
574     SQL_TRANSACTION_READ_UNCOMMITTED = SQL_TXN_READ_UNCOMMITTED,
575     SQL_TXN_READ_COMMITTED           = 0x00000002L,
576     SQL_TRANSACTION_READ_COMMITTED   = SQL_TXN_READ_COMMITTED,
577     SQL_TXN_REPEATABLE_READ          = 0x00000004L,
578     SQL_TRANSACTION_REPEATABLE_READ  = SQL_TXN_REPEATABLE_READ,
579     SQL_TXN_SERIALIZABLE             = 0x00000008L,
580     SQL_TRANSACTION_SERIALIZABLE     = SQL_TXN_SERIALIZABLE
581 }
582 
583 // * SQL_NULL_COLLATION values *
584 enum
585 {
586     SQL_NC_HIGH = 0,
587     SQL_NC_LOW  = 1
588 }
589 
590 /+
591  ' ODBC v3.0+ ISO 92
592  ' Allocates an environment, connection, statement, or descriptor handle.
593  '
594  ' -- HandleTypes --
595  ' SQL_HANDLE_ENV
596  ' SQL_HANDLE_DBC
597  ' SQL_HANDLE_DESC
598  ' SQL_HANDLE_STMT
599  '
600  ' -- InputHandle --
601  ' The input handle in whose context the new handle is to be allocated.
602  ' If HandleType is SQL_HANDLE_ENV, this is SQL_NULL_HANDLE. If HandleType
603  ' is SQL_HANDLE_DBC, this must be an environment handle, and if it is
604  ' SQL_HANDLE_STMT or SQL_HANDLE_DESC, it must be a connection handle.
605  '
606  +/
607 SQLRETURN SQLAllocHandle
608 (
609     /+ IN  +/ SQLSMALLINT HandleType,
610     /+ IN  +/ SQLHANDLE   InputHandle,
611     /+ OUT +/ SQLHANDLE   *OutputHandle
612 );
613 
614 /+
615  ' ODBC v1.0+ ISO 92
616  ' Binds application data buffers to columns in the result set.
617  '
618  +/
619 SQLRETURN SQLBindCol
620 (
621     /+ IN     +/ SQLHSTMT     StatementHandle,
622     /+ IN     +/ SQLUSMALLINT ColumnNumber,
623     /+ IN     +/ SQLSMALLINT  TargetType,
624     /+ INOUT  +/ SQLPOINTER   TargetValue,
625     /+ IN     +/ SQLINTEGER   BufferLength,
626     /+ INOUT  +/ SQLINTEGER   *StrLen_or_Ind
627 );
628 
629 SQLRETURN SQLBindParam
630 (
631     SQLHSTMT     StatementHandle,
632     SQLUSMALLINT ParameterNumber,
633     SQLSMALLINT  ValueType,
634     SQLSMALLINT  ParameterType,
635     SQLUINTEGER  LengthPrecision,
636     SQLSMALLINT  ParameterScale,
637     SQLPOINTER   ParameterValue,
638     SQLINTEGER   *StrLen_or_Ind
639 );
640 
641 /+
642  ' ODBC v1.0+ ISO 92
643  ' Cancels the processing on a statement.
644  '
645  +/
646 SQLRETURN SQLCancel
647 (
648     /+ IN  +/ SQLHSTMT StatementHandle
649 );
650 
651 /+
652  ' ODBC v3.0+ ISO 92
653  ' Closes a cursor that has been opened on a statement and discards pending results.
654  '
655  +/
656 SQLRETURN SQLCloseCursor
657 (
658     SQLHSTMT StatementHandle
659 );
660 
661 /+
662  ' ODBC v3.0+ ISO 92
663  ' Returns descriptor information for a column in a result set.
664  ' Descriptor information is returned as a character string, a 32-bit
665  ' descriptor-dependent value, or an integer value.
666  '
667  +/
668 SQLRETURN SQLColAttribute
669 (
670     /+ IN  +/ SQLHSTMT     StatementHandle,
671     /+ IN  +/ SQLUSMALLINT ColumnNumber,
672     /+ IN  +/ SQLUSMALLINT FieldIdentifier,
673     /+ OUT +/ SQLPOINTER   CharacterAttribute,
674     /+ IN  +/ SQLSMALLINT  BufferLength,
675     /+ OUT +/ SQLSMALLINT  *StringLength,
676     /+ OUT +/ SQLPOINTER   NumericAttribute
677 );
678 
679 /+
680  ' ODBC v1.0+ X/Open
681  ' Returns the list of column names in specified tables. The driver
682  ' returns this information as a result set on the specified StatementHandle.
683  '
684  +/
685 SQLRETURN SQLColumns
686 (
687     /+ IN  +/ SQLHSTMT    StatementHandle,
688     /+ IN  +/ SQLCHAR     *CatalogName,
689     /+ IN  +/ SQLSMALLINT NameLength1,
690     /+ IN  +/ SQLCHAR     *SchemaName,
691     /+ IN  +/ SQLSMALLINT NameLength2,
692     /+ IN  +/ SQLCHAR     *TableName,
693     /+ IN  +/ SQLSMALLINT NameLength3,
694     /+ IN  +/ SQLCHAR     *ColumnName,
695     /+ IN  +/ SQLSMALLINT NameLength4
696 );
697 
698 /+
699  ' ODBC v1.0+ ISO 92
700  ' Establishes connections to a driver and a data source. The connection
701  ' handle references storage of all information about the connection to
702  ' the data source, including status, transaction state, and error information.
703  '
704  +/
705 SQLRETURN SQLConnect
706 (
707     /+ IN  +/ SQLHDBC     ConnectionHandle,
708     /+ IN  +/ SQLCHAR     *ServerName,
709     /+ IN  +/ SQLSMALLINT NameLength1,
710     /+ IN  +/ SQLCHAR     *UserName,
711     /+ IN  +/ SQLSMALLINT NameLength2,
712     /+ IN  +/ SQLCHAR     *Authentication,
713     /+ IN  +/ SQLSMALLINT NameLength3
714 );
715 
716 /+
717  ' ODBC v3.0+ ISO 92
718  ' Copies descriptor information from one descriptor handle to another.
719  '
720  +/
721 SQLRETURN SQLCopyDesc
722 (
723     /+ IN  +/ SQLHDESC SourceDescHandle,
724     /+ IN  +/ SQLHDESC TargetDescHandle
725 );
726 
727 /+
728  ' ODBC v1.0+ ISO 92
729  ' Returns information about a data source. This function is implemented
730  ' solely by the Driver Manager.
731  '
732  +/
733 SQLRETURN SQLDataSources
734 (
735     /+ IN  +/ SQLHENV      EnvironmentHandle,
736     /+ IN  +/ SQLUSMALLINT Direction,
737     /+ OUT +/ SQLCHAR      *ServerName,
738     /+ IN  +/ SQLSMALLINT  BufferLength1,
739     /+ OUT +/ SQLSMALLINT  *NameLength1,
740     /+ OUT +/ SQLCHAR      *Description,
741     /+ IN  +/ SQLSMALLINT  BufferLength2,
742     /+ OUT +/ SQLSMALLINT  *NameLength2
743 );
744 
745 /+
746  ' ODBC v1.0+ ISO 92
747  ' Returns the result descriptor column name, type, column size,
748  ' decimal digits, and nullability for one column in the result set.
749  ' This information also is available in the fields of the IRD.
750  '
751  +/
752 SQLRETURN SQLDescribeCol
753 (
754     /+ IN  +/ SQLHSTMT     StatementHandle,
755     /+ IN  +/ SQLUSMALLINT ColumnNumber,
756     /+ OUT +/ SQLCHAR      *ColumnName,
757     /+ IN  +/ SQLSMALLINT  BufferLength,
758     /+ OUT +/ SQLSMALLINT  *NameLength,
759     /+ OUT +/ SQLSMALLINT  *DataType,
760     /+ OUT +/ SQLUINTEGER  *ColumnSize,
761     /+ OUT +/ SQLSMALLINT  *DecimalDigits,
762     /+ OUT +/ SQLSMALLINT  *Nullable
763 );
764 
765 /+
766  ' ODBC v1.0+ ISO 92
767  ' Closes the connection associated with a specific connection handle.
768  '
769  +/
770 SQLRETURN SQLDisconnect
771 (
772     /+ IN  +/ SQLHDBC ConnectionHandle
773 );
774 
775 /+
776  ' ODBC v3.0+ ISO 92
777  ' Requests a commit or rollback operation for all active operations on all
778  ' statements associated with a connection. SQLEndTran can also request that
779  ' a commit or rollback operation be performed for all connections associated
780  ' with an environment.
781  '
782  ' -- HandleType --
783  ' Contains either SQL_HANDLE_ENV (if Handle is an environment handle)
784  ' or SQL_HANDLE_DBC (if Handle is a connection handle).
785  '
786  ' -- Handle --
787  ' The handle, of the type indicated by HandleType, indicating the scope of the transaction.
788  '
789  ' -- CompletionType --
790  ' One of the following two values:
791  ' SQL_COMMIT
792  ' SQL_ROLLBACK
793  '
794  +/
795 SQLRETURN SQLEndTran
796 (
797     /+ IN  +/ SQLSMALLINT HandleType,
798     /+ IN  +/ SQLHANDLE   Handle,
799     /+ IN  +/ SQLSMALLINT CompletionType
800 );
801 
802 /+
803  ' ODBC v1.0+ ISO 92
804  ' Executes a preparable statement, using the current values of the
805  ' parameter marker variables if any parameters exist in the statement.
806  ' SQLExecDirect is the fastest way to submit an SQL statement for
807  ' one-time execution.
808  '
809  +/
810 SQLRETURN SQLExecDirect
811 (
812     /+ IN  +/ SQLHSTMT   StatementHandle,
813     /+ IN  +/ SQLCHAR    *StatementText,
814     /+ IN  +/ SQLINTEGER TextLength
815 );
816 
817 /+
818  ' ODBC v1.0+ ISO 92
819  ' Executes a prepared statement, using the current values of the parameter
820  ' marker variables if any parameter markers exist in the statement.
821  '
822  +/
823 SQLRETURN SQLExecute
824 (
825     /+ IN  +/ SQLHSTMT StatementHandle
826 );
827 
828 /+
829  ' ODBC v1.0+ ISO 92
830  ' Fetches the next rowset of data from the result set and returns
831  ' data for all bound columns.
832  '
833  +/
834 SQLRETURN SQLFetch
835 (
836     /+ IN  +/ SQLHSTMT StatementHandle
837 );
838 
839 /+
840  ' ODBC v3.0+ ISO 92
841  ' Fetches the specified rowset of data from the result set and
842  ' returns data for all bound columns. Rowsets can be specified
843  ' at an absolute or relative position or by bookmark.
844  '
845  ' -- FetchOrientation --
846  ' Type of fetch:
847  ' SQL_FETCH_NEXT
848  ' SQL_FETCH_PRIOR
849  ' SQL_FETCH_FIRST
850  ' SQL_FETCH_LAST
851  ' SQL_FETCH_ABSOLUTE
852  ' SQL_FETCH_RELATIVE
853  ' SQL_FETCH_BOOKMARK
854  '
855  ' -- FetchOffset --
856  ' Number of the row to fetch based on the type above.
857  '
858  +/
859 SQLRETURN SQLFetchScroll
860 (
861     /+ IN  +/ SQLHSTMT    StatementHandle,
862     /+ IN  +/ SQLSMALLINT FetchOrientation,
863     /+ IN  +/ SQLINTEGER  FetchOffset
864 );
865 
866 /+
867  ' ODBC v3.0+ ISO 92
868  ' Frees resources associated with a specific environment, connection,
869  ' statement, or descriptor handle.
870  '
871  ' -- HandleType --
872  ' Must be one of the following values:
873  ' SQL_HANDLE_ENV
874  ' SQL_HANDLE_DBC
875  ' SQL_HANDLE_STMT
876  ' SQL_HANDLE_DESC
877  '
878  +/
879 SQLRETURN SQLFreeHandle
880 (
881     /+ IN  +/ SQLSMALLINT HandleType,
882     /+ IN  +/ SQLHANDLE   Handle
883 );
884 
885 /+
886  ' ODBC v1.0+ ISO 92
887  ' Stops processing associated with a specific statement,
888  ' closes any open cursors associated with the statement,
889  ' discards pending results, or, optionally, frees all
890  ' resources associated with the statement handle.
891  '
892  +/
893 SQLRETURN SQLFreeStmt
894 (
895     /+ IN  +/ SQLHSTMT     StatementHandle,
896     /+ IN  +/ SQLUSMALLINT Option
897 );
898 
899 /+
900  ' ODBC v3.0+  ISO 92
901  ' Returns the current setting of a connection attribute.
902  '
903  +/
904 SQLRETURN SQLGetConnectAttr
905 (
906     /+ IN  +/ SQLHDBC    ConnectionHandle,
907     /+ IN  +/ SQLINTEGER Attribute,
908     /+ OUT +/ SQLPOINTER Value,
909     /+ IN  +/ SQLINTEGER BufferLength,
910     /+ OUT +/ SQLINTEGER *StringLength
911 );
912 
913 /+
914  ' ODBC v1.+ ISO 92
915  ' Returns the cursor name associated with a specified statement.
916  '
917  +/
918 SQLRETURN SQLGetCursorName
919 (
920     /+ IN  +/ SQLHSTMT    StatementHandle,
921     /+ OUT +/ SQLCHAR     *CursorName,
922     /+ IN  +/ SQLSMALLINT BufferLength,
923     /+ OUT +/ SQLSMALLINT *NameLength
924 );
925 
926 /+
927  ' ODBC v1.0+ ISO 92
928  ' Retrieves data for a single column in the result set. It can be called
929  ' multiple times to retrieve variable-length data in parts.
930  '
931  +/
932 SQLRETURN SQLGetData
933 (
934     /+ IN  +/ SQLHSTMT     StatementHandle,
935     /+ IN  +/ SQLUSMALLINT ColumnNumber,
936     /+ IN  +/ SQLSMALLINT  TargetType,
937     /+ OUT +/ SQLPOINTER   TargetValue,
938     /+ IN  +/ SQLINTEGER   BufferLength,
939     /+ OUT +/ SQLINTEGER   *StrLen_or_Ind
940 );
941 
942 /+
943  ' ODBC v3.0+ ISO 92
944  ' Returns the current setting or value of a single field of a descriptor record.
945  '
946  +/
947 SQLRETURN SQLGetDescField
948 (
949     /+ IN  +/ SQLHDESC    DescriptorHandle,
950     /+ IN  +/ SQLSMALLINT RecNumber,
951     /+ IN  +/ SQLSMALLINT FieldIdentifier,
952     /+ OUT +/ SQLPOINTER  Value,
953     /+ IN  +/ SQLINTEGER  BufferLength,
954     /+ OUT +/ SQLINTEGER  *StringLength
955 );
956 
957 /+
958  ' ODBC v3.0+ ISO 92
959  ' Returns the current settings or values of multiple fields of a descriptor
960  ' record. The fields returned describe the name, data type, and storage of
961  ' column or parameter data.
962  '
963  +/
964 SQLRETURN SQLGetDescRec
965 (
966     /+ IN  +/ SQLHDESC    DescriptorHandle,
967     /+ IN  +/ SQLSMALLINT RecNumber,
968     /+ OUT +/ SQLCHAR     *Name,         // SQLGetDescField( DescriptorHandle = SQL_DESC_NAME )
969     /+ IN  +/ SQLSMALLINT BufferLength,
970     /+ OUT +/ SQLSMALLINT *StringLength,
971     /+ OUT +/ SQLSMALLINT *Type,         // SQLGetDescField( DescriptorHandle = SQL_DESC_TYPE )
972     /+ OUT +/ SQLSMALLINT *SubType,      // SQLGetDescField( DescriptorHandle = SQL_DESC_DATETIME_INTERVAL_CODE  )
973     /+ OUT +/ SQLINTEGER  *Length,       // SQLGetDescField( DescriptorHandle = SQL_DESC_OCTET_LENGTH )
974     /+ OUT +/ SQLSMALLINT *Precision,    // SQLGetDescField( DescriptorHandle = SQL_DESC_PRECISION )
975     /+ OUT +/ SQLSMALLINT *Scale,        // SQLGetDescField( DescriptorHandle = SQL_DESC_SCALE )
976     /+ OUT +/ SQLSMALLINT *Nullable      // SQLGetDescField( DescriptorHandle = SQL_DESC_NULLABLE )
977 );
978 
979 /+
980  ' ODBC v3.0+ ISO 92
981  ' Returns the current value of a field of a record of the diagnostic
982  ' data structure (associated with a specified handle) that contains
983  ' error, warning, and status information.
984  '
985  ' -- HandleType --
986  ' Must be one of the following:
987  ' SQL_HANDLE_ENV
988  ' SQL_HANDLE_DBC
989  ' SQL_HANDLE_STMT
990  ' SQL_HANDLE_DESC
991  '
992  +/
993 SQLRETURN SQLGetDiagField
994 (
995     /+ IN  +/ SQLSMALLINT HandleType,
996     /+ IN  +/ SQLHANDLE   Handle,
997     /+ IN  +/ SQLSMALLINT RecNumber,
998     /+ IN  +/ SQLSMALLINT DiagIdentifier,
999     /+ OUT +/ SQLPOINTER  DiagInfo,
1000     /+ IN  +/ SQLSMALLINT BufferLength,
1001     /+ OUT +/ SQLSMALLINT *StringLength
1002 );
1003 
1004 /+
1005  ' ODBC v3.0+ ISO 92
1006  ' Returns the current values of multiple fields of a diagnostic record that
1007  ' contains error, warning, and status information. Unlike SQLGetDiagField,
1008  ' which returns one diagnostic field per call, SQLGetDiagRec returns several
1009  ' commonly used fields of a diagnostic record, including the SQLSTATE, the
1010  ' native error code, and the diagnostic message text.
1011  '
1012  ' -- HandleType --
1013  ' Must be one of the following:
1014  ' SQL_HANDLE_ENV
1015  ' SQL_HANDLE_DBC
1016  ' SQL_HANDLE_STMT
1017  ' SQL_HANDLE_DESC
1018  '
1019  +/
1020 SQLRETURN SQLGetDiagRec
1021 (
1022     /+ IN  +/ SQLSMALLINT HandleType,
1023     /+ IN  +/ SQLHANDLE   Handle,
1024     /+ IN  +/ SQLSMALLINT RecNumber,
1025     /+ OUT +/ SQLCHAR     *Sqlstate,
1026     /+ OUT +/ SQLINTEGER  *NativeError,
1027     /+ OUT +/ SQLCHAR     *MessageText,
1028     /+ IN  +/ SQLSMALLINT BufferLength,
1029     /+ OUT +/ SQLSMALLINT *TextLength
1030 );
1031 
1032 /+
1033  ' ODBC v3.0+ ISO 92
1034  ' Returns the current setting of an environment attribute.
1035  '
1036  +/
1037 SQLRETURN SQLGetEnvAttr
1038 (
1039     /+ IN  +/ SQLHENV EnvironmentHandle,
1040     /+ IN  +/ SQLINTEGER Attribute,
1041     /+ OUT +/ SQLPOINTER Value,
1042     /+ IN  +/ SQLINTEGER BufferLength,
1043     /+ OUT +/ SQLINTEGER *StringLength
1044 );
1045 
1046 /+
1047  ' ODBC v1.0+ ISO 92
1048  ' returns information about whether a driver supports a specific ODBC
1049  ' function. This function is implemented in the Driver Manager; it can
1050  ' also be implemented in drivers. If a driver implements SQLGetFunctions,
1051  ' the Driver Manager calls the function in the driver. Otherwise,
1052  ' it executes the function itself.
1053  '
1054  +/
1055 SQLRETURN SQLGetFunctions
1056 (
1057     /+ IN  +/ SQLHDBC      ConnectionHandle,
1058     /+ IN  +/ SQLUSMALLINT FunctionId,
1059     /+ OUT +/ SQLUSMALLINT *Supported
1060 );
1061 
1062 /+
1063  ' ODBC v1.0+ ISO 92
1064  ' Returns general information about the driver and data
1065  ' source associated with a connection.
1066  '
1067  +/
1068 SQLRETURN SQLGetInfo
1069 (
1070     /+ IN  +/ SQLHDBC      ConnectionHandle,
1071     /+ IN  +/ SQLUSMALLINT InfoType,
1072     /+ OUT +/ SQLPOINTER   InfoValue,
1073     /+ IN  +/ SQLSMALLINT  BufferLength,
1074     /+ OUT +/ SQLSMALLINT  *StringLength
1075 );
1076 
1077 /+
1078  ' ODBC v3.0+ ISO 92
1079  ' Returns the current setting of a statement attribute.
1080  '
1081  +/
1082 SQLRETURN SQLGetStmtAttr
1083 (
1084     /+ IN  +/ SQLHSTMT   StatementHandle,
1085     /+ IN  +/ SQLINTEGER Attribute,
1086     /+ OUT +/ SQLPOINTER Value,
1087     /+ IN  +/ SQLINTEGER BufferLength,
1088     /+ OUT +/ SQLINTEGER *StringLength
1089 );
1090 
1091 /+
1092  ' ODBC v1.0+ ISO 92
1093  ' Returns information about data types supported by the data source.
1094  ' The driver returns the information in the form of an SQL result set.
1095  ' The data types are intended for use in Data Definition Language (DDL) statements.
1096  '
1097  +/
1098 SQLRETURN SQLGetTypeInfo
1099 (
1100     /+ IN  +/ SQLHSTMT    StatementHandle,
1101     /+ IN  +/ SQLSMALLINT DataType
1102 );
1103 
1104 /+
1105  ' ODBC v1.0+ ISO 92
1106  ' Returns the number of columns in a result set.
1107  '
1108  +/
1109 SQLRETURN SQLNumResultCols
1110 (
1111     /+ IN  +/ SQLHSTMT    StatementHandle,
1112     /+ OUT +/ SQLSMALLINT *ColumnCount
1113 );
1114 
1115 /+
1116  ' ODBC v1.0+ ISO 92
1117  ' Is used in conjunction with SQLPutData to supply parameter data at statement execution time.
1118  '
1119  +/
1120 SQLRETURN SQLParamData
1121 (
1122     /+ IN  +/ SQLHSTMT   StatementHandle,
1123     /+ OUT +/ SQLPOINTER *Value
1124 );
1125 
1126 /+
1127  ' ODBC v1.0+ ISO 92
1128  ' Prepares an SQL string for execution.
1129  '
1130  +/
1131 SQLRETURN SQLPrepare
1132 (
1133     /+ IN  +/ SQLHSTMT   StatementHandle,
1134     /+ IN  +/ SQLCHAR   *StatementText,
1135     /+ IN  +/ SQLINTEGER TextLength
1136 );
1137 
1138 /+
1139  ' ODBC v1.0+ ISO 92
1140  ' Allows an application to send data for a parameter or column to the driver
1141  ' at statement execution time. This function can be used to send character or
1142  ' binary data values in parts to a column with a character, binary, or data
1143  ' source specific data type (for example, parameters of the SQL_LONGVARBINARY
1144  ' or SQL_LONGVARCHAR types). SQLPutData supports binding to a Unicode C data
1145  ' type, even if the underlying driver does not support Unicode data.
1146  '
1147  +/
1148 SQLRETURN SQLPutData
1149 (
1150     /+ IN  +/ SQLHSTMT   StatementHandle,
1151     /+ IN  +/ SQLPOINTER Data,
1152     /+ IN  +/ SQLINTEGER StrLen_or_Ind
1153 );
1154 
1155 /+
1156  ' ODBC v1.+ ISO 92
1157  ' Returns the number of rows affected by an UPDATE, INSERT, or DELETE statement;
1158  ' an SQL_ADD, SQL_UPDATE_BY_BOOKMARK, or SQL_DELETE_BY_BOOKMARK operation in
1159  ' SQLBulkOperations; or an SQL_UPDATE or SQL_DELETE operation in SQLSetPos.
1160  '
1161  +/
1162 SQLRETURN SQLRowCount
1163 (
1164     /+ IN  +/ SQLHSTMT   StatementHandle,
1165     /+ OUT +/ SQLINTEGER *RowCount
1166 );
1167 
1168 /+
1169  ' ODBC v3.0+ ISO 92
1170  ' Sets attributes that govern aspects of connections.
1171  '
1172  +/
1173 SQLRETURN SQLSetConnectAttr
1174 (
1175     /+ IN  +/ SQLHDBC    ConnectionHandle,
1176     /+ IN  +/ SQLINTEGER Attribute,
1177     /+ IN  +/ SQLPOINTER Value,
1178     /+ IN  +/ SQLINTEGER StringLength
1179 );
1180 
1181 /+
1182  ' ODBC v1.0+ ISO 92
1183  ' Associates a cursor name with an active statement. If an application
1184  ' does not call SQLSetCursorName, the driver generates cursor names as
1185  ' needed for SQL statement processing.
1186  '
1187  +/
1188 SQLRETURN SQLSetCursorName
1189 (
1190     /+ IN  +/ SQLHSTMT    StatementHandle,
1191     /+ IN  +/ SQLCHAR     *CursorName,
1192     /+ IN  +/ SQLSMALLINT NameLength
1193 );
1194 
1195 /+
1196  ' ODBC v3.0+ ISO 92
1197  ' Sets the value of a single field of a descriptor record.
1198  '
1199  +/
1200 SQLRETURN SQLSetDescField
1201 (
1202     /+ IN  +/ SQLHDESC    DescriptorHandle,
1203     /+ IN  +/ SQLSMALLINT RecNumber,
1204     /+ IN  +/ SQLSMALLINT FieldIdentifier,
1205     /+ IN  +/ SQLPOINTER  Value,
1206     /+ IN  +/ SQLINTEGER  BufferLength
1207 );
1208 
1209 /+
1210  ' ODBC v3.0+ ISO 92
1211  ' Function sets multiple descriptor fields that affect the data
1212  ' type and buffer bound to a column or parameter data.
1213  '
1214  +/
1215 SQLRETURN SQLSetDescRec
1216 (
1217     /+ IN    +/ SQLHDESC    DescriptorHandle,
1218     /+ IN    +/ SQLSMALLINT RecNumber,
1219     /+ IN    +/ SQLSMALLINT Type,
1220     /+ IN    +/ SQLSMALLINT SubType,
1221     /+ IN    +/ SQLINTEGER  Length,
1222     /+ IN    +/ SQLSMALLINT Precision,
1223     /+ IN    +/ SQLSMALLINT Scale,
1224     /+ INOUT +/ SQLPOINTER  Data,
1225     /+ INOUT +/ SQLINTEGER  *StringLength,
1226     /+ INOUT +/ SQLINTEGER  *Indicator
1227 );
1228 
1229 /+
1230  ' ODBC v3.0+ ISO 92
1231  ' Sets attributes that govern aspects of environments.
1232  '
1233  +/
1234 SQLRETURN SQLSetEnvAttr
1235 (
1236     /+ IN  +/ SQLHENV    EnvironmentHandle,
1237     /+ IN  +/ SQLINTEGER Attribute,
1238     /+ IN  +/ SQLPOINTER Value,
1239     /+ IN  +/ SQLINTEGER StringLength
1240 );
1241 
1242 /+
1243  ' ODBC v3.0+ ISO 92
1244  ' Sets attributes related to a statement.
1245  '
1246  +/
1247 SQLRETURN SQLSetStmtAttr
1248 (
1249     /+ IN  +/ SQLHSTMT   StatementHandle,
1250     /+ IN  +/ SQLINTEGER Attribute,
1251     /+ IN  +/ SQLPOINTER Value,
1252     /+ IN  +/ SQLINTEGER StringLength
1253 );
1254 
1255 /+
1256  ' ODBC v1.0+ X/Open
1257  ' Retrieves the following information about columns within a specified table:
1258  '
1259  ' 1) The optimal set of columns that uniquely identifies a row in the table.
1260  ' 2) Columns that are automatically updated when any value in the row is updated by a transaction.
1261  '
1262  '
1263  +/
1264 SQLRETURN SQLSpecialColumns
1265 (
1266     /+ IN  +/ SQLHSTMT     StatementHandle,
1267     /+ IN  +/ SQLUSMALLINT IdentifierType,
1268     /+ IN  +/ SQLCHAR      *CatalogName,
1269     /+ IN  +/ SQLSMALLINT  NameLength1,
1270     /+ IN  +/ SQLCHAR      *SchemaName,
1271     /+ IN  +/ SQLSMALLINT  NameLength2,
1272     /+ IN  +/ SQLCHAR      *TableName,
1273     /+ IN  +/ SQLSMALLINT  NameLength3,
1274     /+ IN  +/ SQLUSMALLINT Scope,
1275     /+ IN  +/ SQLUSMALLINT Nullable
1276 );
1277 
1278 /+
1279  ' ODBC v1.0+ ISO 92
1280  ' Retrieves a list of statistics about a single table and the
1281  ' indexes associated with the table. The driver returns the
1282  ' information as a result set.
1283  '
1284  ' -- Unique --
1285  ' Type of index: SQL_INDEX_UNIQUE or SQL_INDEX_ALL.
1286  '
1287  +/
1288 SQLRETURN SQLStatistics
1289 (
1290     /+ IN  +/ SQLHSTMT     StatementHandle,
1291     /+ IN  +/ SQLCHAR      *CatalogName,
1292     /+ IN  +/ SQLSMALLINT  NameLength1,
1293     /+ IN  +/ SQLCHAR      *SchemaName,
1294     /+ IN  +/ SQLSMALLINT  NameLength2,
1295     /+ IN  +/ SQLCHAR      *TableName,
1296     /+ IN  +/ SQLSMALLINT  NameLength3,
1297     /+ IN  +/ SQLUSMALLINT Unique,
1298     /+ IN  +/ SQLUSMALLINT Reserved
1299 );
1300 
1301 /+
1302  ' OBDC v1.0+ X/Open
1303  ' Returns the list of table, catalog, or schema names, and table
1304  ' types, stored in a specific data source. The driver returns the
1305  ' information as a result set.
1306  '
1307  +/
1308 SQLRETURN SQLTables
1309 (
1310     /+ IN  +/ SQLHSTMT    StatementHandle,
1311     /+ IN  +/ SQLCHAR     *CatalogName,
1312     /+ IN  +/ SQLSMALLINT NameLength1,
1313     /+ IN  +/ SQLCHAR     *SchemaName,
1314     /+ IN  +/ SQLSMALLINT NameLength2,
1315     /+ IN  +/ SQLCHAR     *TableName,
1316     /+ IN  +/ SQLSMALLINT NameLength3,
1317     /+ IN  +/ SQLCHAR     *TableType,
1318     /+ IN  +/ SQLSMALLINT NameLength4
1319 );
1320 
1321 /+---------------------------+
1322  | * Deprecated Functions *  |
1323  +---------------------------+/
1324 /+
1325  ' In ODBC 3.x, the ODBC 2.x function SQLAllocConnect has been
1326  ' replaced by SQLAllocHandle.
1327  '
1328  +/
1329 SQLRETURN SQLAllocConnect
1330 (
1331     SQLHENV EnvironmentHandle,
1332     SQLHDBC *ConnectionHandle
1333 );
1334 
1335 /+
1336  ' In ODBC 3.x, the ODBC 2.x function SQLAllocEnv has been replaced by SQLAllocHandle.
1337  '
1338  +/
1339 SQLRETURN SQLAllocEnv
1340 (
1341     SQLHENV *EnvironmentHandle
1342 );
1343 
1344 /+
1345  ' In ODBC 3.x, the ODBC 2.x function SQLAllocStmt has been replaced by SQLAllocHandle.
1346  '
1347  +/
1348 SQLRETURN SQLAllocStmt
1349 (
1350     SQLHDBC  ConnectionHandle,
1351     SQLHSTMT *StatementHandle
1352 );
1353 
1354 SQLRETURN SQLError
1355 (
1356     SQLHENV     EnvironmentHandle,
1357     SQLHDBC     ConnectionHandle,
1358     SQLHSTMT    StatementHandle,
1359     SQLCHAR     *Sqlstate,
1360     SQLINTEGER  *NativeError,
1361     SQLCHAR     *MessageText,
1362     SQLSMALLINT BufferLength,
1363     SQLSMALLINT *TextLength
1364 );
1365 
1366 SQLRETURN SQLFreeConnect
1367 (
1368     SQLHDBC ConnectionHandle
1369 );
1370 
1371 SQLRETURN SQLFreeEnv
1372 (
1373     SQLHENV EnvironmentHandle
1374 );
1375 
1376 SQLRETURN SQLGetConnectOption
1377 (
1378     SQLHDBC      ConnectionHandle,
1379     SQLUSMALLINT Option,
1380     SQLPOINTER   Value
1381 );
1382 
1383 SQLRETURN SQLGetStmtOption
1384 (
1385     SQLHSTMT     StatementHandle,
1386     SQLUSMALLINT Option,
1387     SQLPOINTER   Value
1388 );
1389 
1390 SQLRETURN SQLSetConnectOption
1391 (
1392     SQLHDBC      ConnectionHandle,
1393     SQLUSMALLINT Option,
1394     SQLUINTEGER  Value
1395 );
1396 
1397 SQLRETURN SQLSetParam
1398 (
1399     SQLHSTMT StatementHandle,
1400     SQLUSMALLINT ParameterNumber,
1401     SQLSMALLINT ValueType,
1402     SQLSMALLINT ParameterType,
1403     SQLUINTEGER LengthPrecision,
1404     SQLSMALLINT ParameterScale,
1405     SQLPOINTER ParameterValue,
1406     SQLINTEGER *StrLen_or_Ind
1407 );
1408 
1409 SQLRETURN SQLSetStmtOption
1410 (
1411     SQLHSTMT StatementHandle,
1412     SQLUSMALLINT Option,
1413     SQLUINTEGER Value
1414 );
1415 
1416 SQLRETURN SQLTransact
1417 (
1418     SQLHENV      EnvironmentHandle,
1419     SQLHDBC      ConnectionHandle,
1420     SQLUSMALLINT CompletionType
1421 );
1422 
1423 // end Deprecated Functions