1 /**************************************************
4 * These should be consistent with the MS version.
6 **************************************************/
11 /****************************
12 * default to 3.51 declare something else before here and you get a whole new ball of wax
13 ***************************/
15 #define ODBCVER 0x0351
26 /****************************
28 ***************************/
29 #define SQL_NULL_DATA (-1)
30 #define SQL_DATA_AT_EXEC (-2)
32 #define SQL_SUCCESS_WITH_INFO 1
33 #if (ODBCVER >= 0x0300)
34 #define SQL_NO_DATA 100
36 #define SQL_ERROR (-1)
37 #define SQL_INVALID_HANDLE (-2)
38 #define SQL_STILL_EXECUTING 2
39 #define SQL_NEED_DATA 99
40 #define SQL_SUCCEEDED(rc) (((rc)&(~1))==0)
42 /****************************
43 * use these to indicate string termination to some function
44 ***************************/
46 #define SQL_NTSL (-3L)
48 /* maximum message length */
49 #define SQL_MAX_MESSAGE_LENGTH 512
51 /* date/time length constants */
52 #if (ODBCVER >= 0x0300)
53 #define SQL_DATE_LEN 10
54 #define SQL_TIME_LEN 8 /* add P+1 if precision is nonzero */
55 #define SQL_TIMESTAMP_LEN 19 /* add P+1 if precision is nonzero */
58 /* handle type identifiers */
59 #if (ODBCVER >= 0x0300)
60 #define SQL_HANDLE_ENV 1
61 #define SQL_HANDLE_DBC 2
62 #define SQL_HANDLE_STMT 3
63 #define SQL_HANDLE_DESC 4
66 /* environment attribute */
67 #if (ODBCVER >= 0x0300)
68 #define SQL_ATTR_OUTPUT_NTS 10001
71 /* connection attributes */
72 #if (ODBCVER >= 0x0300)
73 #define SQL_ATTR_AUTO_IPD 10001
74 #define SQL_ATTR_METADATA_ID 10014
75 #endif /* ODBCVER >= 0x0300 */
77 /* statement attributes */
78 #if (ODBCVER >= 0x0300)
79 #define SQL_ATTR_APP_ROW_DESC 10010
80 #define SQL_ATTR_APP_PARAM_DESC 10011
81 #define SQL_ATTR_IMP_ROW_DESC 10012
82 #define SQL_ATTR_IMP_PARAM_DESC 10013
83 #define SQL_ATTR_CURSOR_SCROLLABLE (-1)
84 #define SQL_ATTR_CURSOR_SENSITIVITY (-2)
87 /* SQL_ATTR_CURSOR_SCROLLABLE values */
88 #if (ODBCVER >= 0x0300)
89 #define SQL_NONSCROLLABLE 0
90 #define SQL_SCROLLABLE 1
91 #endif /* ODBCVER >= 0x0300 */
93 /* identifiers of fields in the SQL descriptor */
94 #if (ODBCVER >= 0x0300)
95 #define SQL_DESC_COUNT 1001
96 #define SQL_DESC_TYPE 1002
97 #define SQL_DESC_LENGTH 1003
98 #define SQL_DESC_OCTET_LENGTH_PTR 1004
99 #define SQL_DESC_PRECISION 1005
100 #define SQL_DESC_SCALE 1006
101 #define SQL_DESC_DATETIME_INTERVAL_CODE 1007
102 #define SQL_DESC_NULLABLE 1008
103 #define SQL_DESC_INDICATOR_PTR 1009
104 #define SQL_DESC_DATA_PTR 1010
105 #define SQL_DESC_NAME 1011
106 #define SQL_DESC_UNNAMED 1012
107 #define SQL_DESC_OCTET_LENGTH 1013
108 #define SQL_DESC_ALLOC_TYPE 1099
111 /* identifiers of fields in the diagnostics area */
112 #if (ODBCVER >= 0x0300)
113 #define SQL_DIAG_RETURNCODE 1
114 #define SQL_DIAG_NUMBER 2
115 #define SQL_DIAG_ROW_COUNT 3
116 #define SQL_DIAG_SQLSTATE 4
117 #define SQL_DIAG_NATIVE 5
118 #define SQL_DIAG_MESSAGE_TEXT 6
119 #define SQL_DIAG_DYNAMIC_FUNCTION 7
120 #define SQL_DIAG_CLASS_ORIGIN 8
121 #define SQL_DIAG_SUBCLASS_ORIGIN 9
122 #define SQL_DIAG_CONNECTION_NAME 10
123 #define SQL_DIAG_SERVER_NAME 11
124 #define SQL_DIAG_DYNAMIC_FUNCTION_CODE 12
127 /* dynamic function codes */
128 #if (ODBCVER >= 0x0300)
129 #define SQL_DIAG_ALTER_DOMAIN 3
130 #define SQL_DIAG_ALTER_TABLE 4
131 #define SQL_DIAG_CALL 7
132 #define SQL_DIAG_CREATE_ASSERTION 6
133 #define SQL_DIAG_CREATE_CHARACTER_SET 8
134 #define SQL_DIAG_CREATE_COLLATION 10
135 #define SQL_DIAG_CREATE_DOMAIN 23
136 #define SQL_DIAG_CREATE_INDEX (-1)
137 #define SQL_DIAG_CREATE_SCHEMA 64
138 #define SQL_DIAG_CREATE_TABLE 77
139 #define SQL_DIAG_CREATE_TRANSLATION 79
140 #define SQL_DIAG_CREATE_VIEW 84
141 #define SQL_DIAG_DELETE_WHERE 19
142 #define SQL_DIAG_DROP_ASSERTION 24
143 #define SQL_DIAG_DROP_CHARACTER_SET 25
144 #define SQL_DIAG_DROP_COLLATION 26
145 #define SQL_DIAG_DROP_DOMAIN 27
146 #define SQL_DIAG_DROP_INDEX (-2)
147 #define SQL_DIAG_DROP_SCHEMA 31
148 #define SQL_DIAG_DROP_TABLE 32
149 #define SQL_DIAG_DROP_TRANSLATION 33
150 #define SQL_DIAG_DROP_VIEW 36
151 #define SQL_DIAG_DYNAMIC_DELETE_CURSOR 38
152 #define SQL_DIAG_DYNAMIC_UPDATE_CURSOR 81
153 #define SQL_DIAG_GRANT 48
154 #define SQL_DIAG_INSERT 50
155 #define SQL_DIAG_REVOKE 59
156 #define SQL_DIAG_SELECT_CURSOR 85
157 #define SQL_DIAG_UNKNOWN_STATEMENT 0
158 #define SQL_DIAG_UPDATE_WHERE 82
159 #endif /* ODBCVER >= 0x0300 */
161 /* SQL data type codes */
162 #define SQL_UNKNOWN_TYPE 0
164 #define SQL_NUMERIC 2
165 #define SQL_DECIMAL 3
166 #define SQL_INTEGER 4
167 #define SQL_SMALLINT 5
170 //#define SQL_BIGINT -5
172 #if (ODBCVER >= 0x0300)
173 #define SQL_DATETIME 9
175 #define SQL_VARCHAR 12
177 /* One-parameter shortcuts for date/time data types */
178 #if (ODBCVER >= 0x0300)
179 #define SQL_TYPE_DATE 91
180 #define SQL_TYPE_TIME 92
181 #define SQL_TYPE_TIMESTAMP 93
184 /* Statement attribute values for cursor sensitivity */
185 #if (ODBCVER >= 0x0300)
186 #define SQL_UNSPECIFIED 0
187 #define SQL_INSENSITIVE 1
188 #define SQL_SENSITIVE 2
191 /* GetTypeInfo() request for all data types */
192 #define SQL_ALL_TYPES 0
194 /* Default conversion code for SQLBindCol(), SQLBindParam() and SQLGetData() */
195 #if (ODBCVER >= 0x0300)
196 #define SQL_DEFAULT 99
199 /* SQLGetData() code indicating that the application row descriptor
200 * specifies the data type
202 #if (ODBCVER >= 0x0300)
203 #define SQL_ARD_TYPE (-99)
206 /* SQL date/time type subcodes */
207 #if (ODBCVER >= 0x0300)
208 #define SQL_CODE_DATE 1
209 #define SQL_CODE_TIME 2
210 #define SQL_CODE_TIMESTAMP 3
213 /* CLI option values */
214 #if (ODBCVER >= 0x0300)
219 /* values of NULLABLE field in descriptor */
220 #define SQL_NO_NULLS 0
221 #define SQL_NULLABLE 1
223 /* Value returned by SQLGetTypeInfo() to denote that it is
224 * not known whether or not a data type supports null values.
226 #define SQL_NULLABLE_UNKNOWN 2
228 /* Values returned by SQLGetTypeInfo() to show WHERE clause
231 #if (ODBCVER >= 0x0300)
232 #define SQL_PRED_NONE 0
233 #define SQL_PRED_CHAR 1
234 #define SQL_PRED_BASIC 2
237 /* values of UNNAMED field in descriptor */
238 #if (ODBCVER >= 0x0300)
240 #define SQL_UNNAMED 1
243 /* values of ALLOC_TYPE field in descriptor */
244 #if (ODBCVER >= 0x0300)
245 #define SQL_DESC_ALLOC_AUTO 1
246 #define SQL_DESC_ALLOC_USER 2
249 /* FreeStmt() options */
253 #define SQL_RESET_PARAMS 3
255 /* Codes used for FetchOrientation in SQLFetchScroll(),
256 and in SQLDataSources()
258 #define SQL_FETCH_NEXT 1
259 #define SQL_FETCH_FIRST 2
261 /* Other codes used for FetchOrientation in SQLFetchScroll() */
262 #define SQL_FETCH_LAST 3
263 #define SQL_FETCH_PRIOR 4
264 #define SQL_FETCH_ABSOLUTE 5
265 #define SQL_FETCH_RELATIVE 6
267 /* SQLEndTran() options */
269 #define SQL_ROLLBACK 1
271 /* null handles returned by SQLAllocHandle() */
272 #define SQL_NULL_HENV 0
273 #define SQL_NULL_HDBC 0
274 #define SQL_NULL_HSTMT 0
275 #if (ODBCVER >= 0x0300)
276 #define SQL_NULL_HDESC 0
277 #define SQL_NULL_DESC 0
280 /* null handle used in place of parent handle when allocating HENV */
281 #if (ODBCVER >= 0x0300)
282 #define SQL_NULL_HANDLE 0L
285 /* Values that may appear in the result set of SQLSpecialColumns() */
286 #define SQL_SCOPE_CURROW 0
287 #define SQL_SCOPE_TRANSACTION 1
288 #define SQL_SCOPE_SESSION 2
290 #define SQL_PC_UNKNOWN 0
291 #if (ODBCVER >= 0x0300)
292 #define SQL_PC_NON_PSEUDO 1
294 #define SQL_PC_PSEUDO 2
296 /* Reserved value for the IdentifierType argument of SQLSpecialColumns() */
297 #if (ODBCVER >= 0x0300)
298 #define SQL_ROW_IDENTIFIER 1
301 /* Reserved values for UNIQUE argument of SQLStatistics() */
302 #define SQL_INDEX_UNIQUE 0
303 #define SQL_INDEX_ALL 1
305 /* Values that may appear in the result set of SQLStatistics() */
306 #define SQL_INDEX_CLUSTERED 1
307 #define SQL_INDEX_HASHED 2
308 #define SQL_INDEX_OTHER 3
310 /* SQLGetFunctions() values to identify ODBC APIs */
311 #define SQL_API_SQLALLOCCONNECT 1
312 #define SQL_API_SQLALLOCENV 2
313 #if (ODBCVER >= 0x0300)
314 #define SQL_API_SQLALLOCHANDLE 1001
316 #define SQL_API_SQLALLOCSTMT 3
317 #define SQL_API_SQLBINDCOL 4
318 #if (ODBCVER >= 0x0300)
319 #define SQL_API_SQLBINDPARAM 1002
321 #define SQL_API_SQLCANCEL 5
322 #if (ODBCVER >= 0x0300)
323 #define SQL_API_SQLCLOSECURSOR 1003
324 #define SQL_API_SQLCOLATTRIBUTE 6
326 #define SQL_API_SQLCOLUMNS 40
327 #define SQL_API_SQLCONNECT 7
328 #if (ODBCVER >= 0x0300)
329 #define SQL_API_SQLCOPYDESC 1004
331 #define SQL_API_SQLDATASOURCES 57
332 #define SQL_API_SQLDESCRIBECOL 8
333 #define SQL_API_SQLDISCONNECT 9
334 #if (ODBCVER >= 0x0300)
335 #define SQL_API_SQLENDTRAN 1005
337 #define SQL_API_SQLERROR 10
338 #define SQL_API_SQLEXECDIRECT 11
339 #define SQL_API_SQLEXECUTE 12
340 #define SQL_API_SQLFETCH 13
341 #if (ODBCVER >= 0x0300)
342 #define SQL_API_SQLFETCHSCROLL 1021
344 #define SQL_API_SQLFREECONNECT 14
345 #define SQL_API_SQLFREEENV 15
346 #if (ODBCVER >= 0x0300)
347 #define SQL_API_SQLFREEHANDLE 1006
349 #define SQL_API_SQLFREESTMT 16
350 #if (ODBCVER >= 0x0300)
351 #define SQL_API_SQLGETCONNECTATTR 1007
353 #define SQL_API_SQLGETCONNECTOPTION 42
354 #define SQL_API_SQLGETCURSORNAME 17
355 #define SQL_API_SQLGETDATA 43
356 #if (ODBCVER >= 0x0300)
357 #define SQL_API_SQLGETDESCFIELD 1008
358 #define SQL_API_SQLGETDESCREC 1009
359 #define SQL_API_SQLGETDIAGFIELD 1010
360 #define SQL_API_SQLGETDIAGREC 1011
361 #define SQL_API_SQLGETENVATTR 1012
363 #define SQL_API_SQLGETFUNCTIONS 44
364 #define SQL_API_SQLGETINFO 45
365 #if (ODBCVER >= 0x0300)
366 #define SQL_API_SQLGETSTMTATTR 1014
368 #define SQL_API_SQLGETSTMTOPTION 46
369 #define SQL_API_SQLGETTYPEINFO 47
370 #define SQL_API_SQLNUMRESULTCOLS 18
371 #define SQL_API_SQLPARAMDATA 48
372 #define SQL_API_SQLPREPARE 19
373 #define SQL_API_SQLPUTDATA 49
374 #define SQL_API_SQLROWCOUNT 20
375 #if (ODBCVER >= 0x0300)
376 #define SQL_API_SQLSETCONNECTATTR 1016
378 #define SQL_API_SQLSETCONNECTOPTION 50
379 #define SQL_API_SQLSETCURSORNAME 21
380 #if (ODBCVER >= 0x0300)
381 #define SQL_API_SQLSETDESCFIELD 1017
382 #define SQL_API_SQLSETDESCREC 1018
383 #define SQL_API_SQLSETENVATTR 1019
385 #define SQL_API_SQLSETPARAM 22
386 #if (ODBCVER >= 0x0300)
387 #define SQL_API_SQLSETSTMTATTR 1020
389 #define SQL_API_SQLSETSTMTOPTION 51
390 #define SQL_API_SQLSPECIALCOLUMNS 52
391 #define SQL_API_SQLSTATISTICS 53
392 #define SQL_API_SQLTABLES 54
393 #define SQL_API_SQLTRANSACT 23
395 /* Information requested by SQLGetInfo() */
396 #if (ODBCVER >= 0x0300)
397 #define SQL_MAX_DRIVER_CONNECTIONS 0
398 #define SQL_MAXIMUM_DRIVER_CONNECTIONS SQL_MAX_DRIVER_CONNECTIONS
399 #define SQL_MAX_CONCURRENT_ACTIVITIES 1
400 #define SQL_MAXIMUM_CONCURRENT_ACTIVITIES SQL_MAX_CONCURRENT_ACTIVITIES
402 #define SQL_DATA_SOURCE_NAME 2
403 #define SQL_FETCH_DIRECTION 8
404 #define SQL_SERVER_NAME 13
405 #define SQL_SEARCH_PATTERN_ESCAPE 14
406 #define SQL_DBMS_NAME 17
407 #define SQL_DBMS_VER 18
408 #define SQL_ACCESSIBLE_TABLES 19
409 #define SQL_ACCESSIBLE_PROCEDURES 20
410 #define SQL_CURSOR_COMMIT_BEHAVIOR 23
411 #define SQL_DATA_SOURCE_READ_ONLY 25
412 #define SQL_DEFAULT_TXN_ISOLATION 26
413 #define SQL_IDENTIFIER_CASE 28
414 #define SQL_IDENTIFIER_QUOTE_CHAR 29
415 #define SQL_MAX_COLUMN_NAME_LEN 30
416 #define SQL_MAXIMUM_COLUMN_NAME_LENGTH SQL_MAX_COLUMN_NAME_LEN
417 #define SQL_MAX_CURSOR_NAME_LEN 31
418 #define SQL_MAXIMUM_CURSOR_NAME_LENGTH SQL_MAX_CURSOR_NAME_LEN
419 #define SQL_MAX_SCHEMA_NAME_LEN 32
420 #define SQL_MAXIMUM_SCHEMA_NAME_LENGTH SQL_MAX_SCHEMA_NAME_LEN
421 #define SQL_MAX_CATALOG_NAME_LEN 34
422 #define SQL_MAXIMUM_CATALOG_NAME_LENGTH SQL_MAX_CATALOG_NAME_LEN
423 #define SQL_MAX_TABLE_NAME_LEN 35
424 #define SQL_SCROLL_CONCURRENCY 43
425 #define SQL_TXN_CAPABLE 46
426 #define SQL_TRANSACTION_CAPABLE SQL_TXN_CAPABLE
427 #define SQL_USER_NAME 47
428 #define SQL_TXN_ISOLATION_OPTION 72
429 #define SQL_TRANSACTION_ISOLATION_OPTION SQL_TXN_ISOLATION_OPTION
430 #define SQL_INTEGRITY 73
431 #define SQL_GETDATA_EXTENSIONS 81
432 #define SQL_NULL_COLLATION 85
433 #define SQL_ALTER_TABLE 86
434 #define SQL_ORDER_BY_COLUMNS_IN_SELECT 90
435 #define SQL_SPECIAL_CHARACTERS 94
436 #define SQL_MAX_COLUMNS_IN_GROUP_BY 97
437 #define SQL_MAXIMUM_COLUMNS_IN_GROUP_BY SQL_MAX_COLUMNS_IN_GROUP_BY
438 #define SQL_MAX_COLUMNS_IN_INDEX 98
439 #define SQL_MAXIMUM_COLUMNS_IN_INDEX SQL_MAX_COLUMNS_IN_INDEX
440 #define SQL_MAX_COLUMNS_IN_ORDER_BY 99
441 #define SQL_MAXIMUM_COLUMNS_IN_ORDER_BY SQL_MAX_COLUMNS_IN_ORDER_BY
442 #define SQL_MAX_COLUMNS_IN_SELECT 100
443 #define SQL_MAXIMUM_COLUMNS_IN_SELECT SQL_MAX_COLUMNS_IN_SELECT
444 #define SQL_MAX_COLUMNS_IN_TABLE 101
445 #define SQL_MAX_INDEX_SIZE 102
446 #define SQL_MAXIMUM_INDEX_SIZE SQL_MAX_INDEX_SIZE
447 #define SQL_MAX_ROW_SIZE 104
448 #define SQL_MAXIMUM_ROW_SIZE SQL_MAX_ROW_SIZE
449 #define SQL_MAX_STATEMENT_LEN 105
450 #define SQL_MAXIMUM_STATEMENT_LENGTH SQL_MAX_STATEMENT_LEN
451 #define SQL_MAX_TABLES_IN_SELECT 106
452 #define SQL_MAXIMUM_TABLES_IN_SELECT SQL_MAX_TABLES_IN_SELECT
453 #define SQL_MAX_USER_NAME_LEN 107
454 #define SQL_MAXIMUM_USER_NAME_LENGTH SQL_MAX_USER_NAME_LEN
455 #if (ODBCVER >= 0x0300)
456 #define SQL_OJ_CAPABILITIES 115
457 #define SQL_OUTER_JOIN_CAPABILITIES SQL_OJ_CAPABILITIES
458 #endif /* ODBCVER >= 0x0300 */
460 #if (ODBCVER >= 0x0300)
461 #define SQL_XOPEN_CLI_YEAR 10000
462 #define SQL_CURSOR_SENSITIVITY 10001
463 #define SQL_DESCRIBE_PARAMETER 10002
464 #define SQL_CATALOG_NAME 10003
465 #define SQL_COLLATION_SEQ 10004
466 #define SQL_MAX_IDENTIFIER_LEN 10005
467 #define SQL_MAXIMUM_IDENTIFIER_LENGTH SQL_MAX_IDENTIFIER_LEN
468 #endif /* ODBCVER >= 0x0300 */
470 /* SQL_ALTER_TABLE bitmasks */
471 #if (ODBCVER >= 0x0200)
472 #define SQL_AT_ADD_COLUMN 0x00000001L
473 #define SQL_AT_DROP_COLUMN 0x00000002L
474 #endif /* ODBCVER >= 0x0200 */
476 #if (ODBCVER >= 0x0300)
477 #define SQL_AT_ADD_CONSTRAINT 0x00000008L
479 /* The following bitmasks are ODBC extensions and defined in sqlext.h
480 *#define SQL_AT_COLUMN_SINGLE 0x00000020L
481 *#define SQL_AT_ADD_COLUMN_DEFAULT 0x00000040L
482 *#define SQL_AT_ADD_COLUMN_COLLATION 0x00000080L
483 *#define SQL_AT_SET_COLUMN_DEFAULT 0x00000100L
484 *#define SQL_AT_DROP_COLUMN_DEFAULT 0x00000200L
485 *#define SQL_AT_DROP_COLUMN_CASCADE 0x00000400L
486 *#define SQL_AT_DROP_COLUMN_RESTRICT 0x00000800L
487 *#define SQL_AT_ADD_TABLE_CONSTRAINT 0x00001000L
488 *#define SQL_AT_DROP_TABLE_CONSTRAINT_CASCADE 0x00002000L
489 *#define SQL_AT_DROP_TABLE_CONSTRAINT_RESTRICT 0x00004000L
490 *#define SQL_AT_CONSTRAINT_NAME_DEFINITION 0x00008000L
491 *#define SQL_AT_CONSTRAINT_INITIALLY_DEFERRED 0x00010000L
492 *#define SQL_AT_CONSTRAINT_INITIALLY_IMMEDIATE 0x00020000L
493 *#define SQL_AT_CONSTRAINT_DEFERRABLE 0x00040000L
494 *#define SQL_AT_CONSTRAINT_NON_DEFERRABLE 0x00080000L
496 #endif /* ODBCVER >= 0x0300 */
499 /* SQL_ASYNC_MODE values */
500 #if (ODBCVER >= 0x0300)
501 #define SQL_AM_NONE 0
502 #define SQL_AM_CONNECTION 1
503 #define SQL_AM_STATEMENT 2
506 /* SQL_CURSOR_COMMIT_BEHAVIOR values */
507 #define SQL_CB_DELETE 0
508 #define SQL_CB_CLOSE 1
509 #define SQL_CB_PRESERVE 2
511 /* SQL_FETCH_DIRECTION bitmasks */
512 #define SQL_FD_FETCH_NEXT 0x00000001L
513 #define SQL_FD_FETCH_FIRST 0x00000002L
514 #define SQL_FD_FETCH_LAST 0x00000004L
515 #define SQL_FD_FETCH_PRIOR 0x00000008L
516 #define SQL_FD_FETCH_ABSOLUTE 0x00000010L
517 #define SQL_FD_FETCH_RELATIVE 0x00000020L
519 /* SQL_GETDATA_EXTENSIONS bitmasks */
520 #define SQL_GD_ANY_COLUMN 0x00000001L
521 #define SQL_GD_ANY_ORDER 0x00000002L
523 /* SQL_IDENTIFIER_CASE values */
524 #define SQL_IC_UPPER 1
525 #define SQL_IC_LOWER 2
526 #define SQL_IC_SENSITIVE 3
527 #define SQL_IC_MIXED 4
529 /* SQL_OJ_CAPABILITIES bitmasks */
530 /* NB: this means 'outer join', not what you may be thinking */
533 #if (ODBCVER >= 0x0201)
534 #define SQL_OJ_LEFT 0x00000001L
535 #define SQL_OJ_RIGHT 0x00000002L
536 #define SQL_OJ_FULL 0x00000004L
537 #define SQL_OJ_NESTED 0x00000008L
538 #define SQL_OJ_NOT_ORDERED 0x00000010L
539 #define SQL_OJ_INNER 0x00000020L
540 #define SQL_OJ_ALL_COMPARISON_OPS 0x00000040L
543 /* SQL_SCROLL_CONCURRENCY bitmasks */
544 #define SQL_SCCO_READ_ONLY 0x00000001L
545 #define SQL_SCCO_LOCK 0x00000002L
546 #define SQL_SCCO_OPT_ROWVER 0x00000004L
547 #define SQL_SCCO_OPT_VALUES 0x00000008L
549 /* SQL_TXN_CAPABLE values */
550 #define SQL_TC_NONE 0
553 #define SQL_TC_DDL_COMMIT 3
554 #define SQL_TC_DDL_IGNORE 4
556 /* SQL_TXN_ISOLATION_OPTION bitmasks */
557 #define SQL_TXN_READ_UNCOMMITTED 0x00000001L
558 #define SQL_TRANSACTION_READ_UNCOMMITTED SQL_TXN_READ_UNCOMMITTED
559 #define SQL_TXN_READ_COMMITTED 0x00000002L
560 #define SQL_TRANSACTION_READ_COMMITTED SQL_TXN_READ_COMMITTED
561 #define SQL_TXN_REPEATABLE_READ 0x00000004L
562 #define SQL_TRANSACTION_REPEATABLE_READ SQL_TXN_REPEATABLE_READ
563 #define SQL_TXN_SERIALIZABLE 0x00000008L
564 #define SQL_TRANSACTION_SERIALIZABLE SQL_TXN_SERIALIZABLE
566 /* SQL_NULL_COLLATION values */
567 #define SQL_NC_HIGH 0
570 SQLRETURN SQL_API
SQLAllocConnect(SQLHENV EnvironmentHandle
,
571 SQLHDBC
*ConnectionHandle
);
573 SQLRETURN SQL_API
SQLAllocEnv(SQLHENV
*EnvironmentHandle
);
575 #if (ODBCVER >= 0x0300)
576 SQLRETURN SQL_API
SQLAllocHandle(SQLSMALLINT HandleType
,
577 SQLHANDLE InputHandle
, SQLHANDLE
*OutputHandle
);
580 SQLRETURN SQL_API
SQLAllocStmt(SQLHDBC ConnectionHandle
,
581 SQLHSTMT
*StatementHandle
);
583 SQLRETURN SQL_API
SQLBindCol(SQLHSTMT StatementHandle
,
584 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
585 SQLPOINTER TargetValue
, SQLLEN BufferLength
,
586 SQLLEN
*StrLen_or_Ind
);
588 #if (ODBCVER >= 0x0300)
589 SQLRETURN SQL_API
SQLBindParam(SQLHSTMT StatementHandle
,
590 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
591 SQLSMALLINT ParameterType
, SQLULEN LengthPrecision
,
592 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
593 SQLLEN
*StrLen_or_Ind
);
596 SQLRETURN SQL_API
SQLCancel(SQLHSTMT StatementHandle
);
598 #if (ODBCVER >= 0x0300)
599 SQLRETURN SQL_API
SQLCloseCursor(SQLHSTMT StatementHandle
);
601 SQLRETURN SQL_API
SQLColAttribute (SQLHSTMT StatementHandle
,
602 SQLUSMALLINT ColumnNumber
, SQLUSMALLINT FieldIdentifier
,
603 SQLPOINTER CharacterAttribute
, SQLSMALLINT BufferLength
,
604 SQLSMALLINT
*StringLength
, SQLLEN
*NumericAttribute
605 /* spec says (SQLPOINTER) not (SQLEN*) - PAH */ );
606 /* Ms now say SQLLEN* http://msdn.microsoft.com/library/en-us/odbc/htm/dasdkodbcoverview_64bit.asp - NG */
611 SQLRETURN SQL_API
SQLColumns(SQLHSTMT StatementHandle
,
612 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
613 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
614 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
615 SQLCHAR
*ColumnName
, SQLSMALLINT NameLength4
);
618 SQLRETURN SQL_API
SQLConnect(SQLHDBC ConnectionHandle
,
619 SQLCHAR
*ServerName
, SQLSMALLINT NameLength1
,
620 SQLCHAR
*UserName
, SQLSMALLINT NameLength2
,
621 SQLCHAR
*Authentication
, SQLSMALLINT NameLength3
);
623 #if (ODBCVER >= 0x0300)
624 SQLRETURN SQL_API
SQLCopyDesc(SQLHDESC SourceDescHandle
,
625 SQLHDESC TargetDescHandle
);
628 SQLRETURN SQL_API
SQLDataSources(SQLHENV EnvironmentHandle
,
629 SQLUSMALLINT Direction
, SQLCHAR
*ServerName
,
630 SQLSMALLINT BufferLength1
, SQLSMALLINT
*NameLength1
,
631 SQLCHAR
*Description
, SQLSMALLINT BufferLength2
,
632 SQLSMALLINT
*NameLength2
);
634 SQLRETURN SQL_API
SQLDescribeCol(SQLHSTMT StatementHandle
,
635 SQLUSMALLINT ColumnNumber
, SQLCHAR
*ColumnName
,
636 SQLSMALLINT BufferLength
, SQLSMALLINT
*NameLength
,
637 SQLSMALLINT
*DataType
, SQLULEN
*ColumnSize
,
638 SQLSMALLINT
*DecimalDigits
, SQLSMALLINT
*Nullable
);
640 SQLRETURN SQL_API
SQLDisconnect(SQLHDBC ConnectionHandle
);
642 #if (ODBCVER >= 0x0300)
643 SQLRETURN SQL_API
SQLEndTran(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
644 SQLSMALLINT CompletionType
);
647 SQLRETURN SQL_API
SQLError(SQLHENV EnvironmentHandle
,
648 SQLHDBC ConnectionHandle
, SQLHSTMT StatementHandle
,
649 SQLCHAR
*Sqlstate
, SQLINTEGER
*NativeError
,
650 SQLCHAR
*MessageText
, SQLSMALLINT BufferLength
,
651 SQLSMALLINT
*TextLength
);
653 SQLRETURN SQL_API
SQLExecDirect(SQLHSTMT StatementHandle
,
654 SQLCHAR
*StatementText
, SQLINTEGER TextLength
);
656 SQLRETURN SQL_API
SQLExecute(SQLHSTMT StatementHandle
);
658 SQLRETURN SQL_API
SQLFetch(SQLHSTMT StatementHandle
);
660 #if (ODBCVER >= 0x0300)
661 SQLRETURN SQL_API
SQLFetchScroll(SQLHSTMT StatementHandle
,
662 SQLSMALLINT FetchOrientation
, SQLROWOFFSET FetchOffset
);
665 SQLRETURN SQL_API
SQLFreeConnect(SQLHDBC ConnectionHandle
);
667 SQLRETURN SQL_API
SQLFreeEnv(SQLHENV EnvironmentHandle
);
669 #if (ODBCVER >= 0x0300)
670 SQLRETURN SQL_API
SQLFreeHandle(SQLSMALLINT HandleType
, SQLHANDLE Handle
);
673 SQLRETURN SQL_API
SQLFreeStmt(SQLHSTMT StatementHandle
,
674 SQLUSMALLINT Option
);
676 #if (ODBCVER >= 0x0300)
677 SQLRETURN SQL_API
SQLGetConnectAttr(SQLHDBC ConnectionHandle
,
678 SQLINTEGER Attribute
, SQLPOINTER Value
,
679 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
);
682 SQLRETURN SQL_API
SQLGetConnectOption(SQLHDBC ConnectionHandle
,
683 SQLUSMALLINT Option
, SQLPOINTER Value
);
685 SQLRETURN SQL_API
SQLGetCursorName(SQLHSTMT StatementHandle
,
686 SQLCHAR
*CursorName
, SQLSMALLINT BufferLength
,
687 SQLSMALLINT
*NameLength
);
689 SQLRETURN SQL_API
SQLGetData(SQLHSTMT StatementHandle
,
690 SQLUSMALLINT ColumnNumber
, SQLSMALLINT TargetType
,
691 SQLPOINTER TargetValue
, SQLLEN BufferLength
,
692 SQLLEN
*StrLen_or_Ind
);
694 #if (ODBCVER >= 0x0300)
695 SQLRETURN
SQLGetDescField(SQLHDESC DescriptorHandle
,
696 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
697 SQLPOINTER Value
, SQLINTEGER BufferLength
,
698 SQLINTEGER
*StringLength
);
700 SQLRETURN SQL_API
SQLGetDescRec(SQLHDESC DescriptorHandle
,
701 SQLSMALLINT RecNumber
, SQLCHAR
*Name
,
702 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
,
703 SQLSMALLINT
*Type
, SQLSMALLINT
*SubType
,
704 SQLLEN
*Length
, SQLSMALLINT
*Precision
,
705 SQLSMALLINT
*Scale
, SQLSMALLINT
*Nullable
);
707 SQLRETURN SQL_API
SQLGetDiagField(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
708 SQLSMALLINT RecNumber
, SQLSMALLINT DiagIdentifier
,
709 SQLPOINTER DiagInfo
, SQLSMALLINT BufferLength
,
710 SQLSMALLINT
*StringLength
);
712 SQLRETURN SQL_API
SQLGetDiagRec(SQLSMALLINT HandleType
, SQLHANDLE Handle
,
713 SQLSMALLINT RecNumber
, SQLCHAR
*Sqlstate
,
714 SQLINTEGER
*NativeError
, SQLCHAR
*MessageText
,
715 SQLSMALLINT BufferLength
, SQLSMALLINT
*TextLength
);
717 SQLRETURN SQL_API
SQLGetEnvAttr(SQLHENV EnvironmentHandle
,
718 SQLINTEGER Attribute
, SQLPOINTER Value
,
719 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
);
720 #endif /* ODBCVER >= 0x0300 */
722 SQLRETURN SQL_API
SQLGetFunctions(SQLHDBC ConnectionHandle
,
723 SQLUSMALLINT FunctionId
, SQLUSMALLINT
*Supported
);
725 SQLRETURN SQL_API
SQLGetInfo(SQLHDBC ConnectionHandle
,
726 SQLUSMALLINT InfoType
, SQLPOINTER InfoValue
,
727 SQLSMALLINT BufferLength
, SQLSMALLINT
*StringLength
);
729 #if (ODBCVER >= 0x0300)
730 SQLRETURN SQL_API
SQLGetStmtAttr(SQLHSTMT StatementHandle
,
731 SQLINTEGER Attribute
, SQLPOINTER Value
,
732 SQLINTEGER BufferLength
, SQLINTEGER
*StringLength
);
733 #endif /* ODBCVER >= 0x0300 */
735 SQLRETURN SQL_API
SQLGetStmtOption(SQLHSTMT StatementHandle
,
736 SQLUSMALLINT Option
, SQLPOINTER Value
);
738 SQLRETURN SQL_API
SQLGetTypeInfo(SQLHSTMT StatementHandle
,
739 SQLSMALLINT DataType
);
741 SQLRETURN SQL_API
SQLNumResultCols(SQLHSTMT StatementHandle
,
742 SQLSMALLINT
*ColumnCount
);
744 SQLRETURN SQL_API
SQLParamData(SQLHSTMT StatementHandle
,
747 SQLRETURN SQL_API
SQLPrepare(SQLHSTMT StatementHandle
,
748 SQLCHAR
*StatementText
, SQLINTEGER TextLength
);
750 SQLRETURN SQL_API
SQLPutData(SQLHSTMT StatementHandle
,
751 SQLPOINTER Data
, SQLLEN StrLen_or_Ind
);
753 SQLRETURN SQL_API
SQLRowCount(SQLHSTMT StatementHandle
,
756 #if (ODBCVER >= 0x0300)
757 SQLRETURN SQL_API
SQLSetConnectAttr(SQLHDBC ConnectionHandle
,
758 SQLINTEGER Attribute
, SQLPOINTER Value
,
759 SQLINTEGER StringLength
);
760 #endif /* ODBCVER >= 0x0300 */
762 SQLRETURN SQL_API
SQLSetConnectOption(SQLHDBC ConnectionHandle
,
763 SQLUSMALLINT Option
, SQLULEN Value
);
765 SQLRETURN SQL_API
SQLSetCursorName(SQLHSTMT StatementHandle
,
766 SQLCHAR
*CursorName
, SQLSMALLINT NameLength
);
768 #if (ODBCVER >= 0x0300)
769 SQLRETURN SQL_API
SQLSetDescField(SQLHDESC DescriptorHandle
,
770 SQLSMALLINT RecNumber
, SQLSMALLINT FieldIdentifier
,
771 SQLPOINTER Value
, SQLINTEGER BufferLength
);
773 SQLRETURN SQL_API
SQLSetDescRec(SQLHDESC DescriptorHandle
,
774 SQLSMALLINT RecNumber
, SQLSMALLINT Type
,
775 SQLSMALLINT SubType
, SQLLEN Length
,
776 SQLSMALLINT Precision
, SQLSMALLINT Scale
,
777 SQLPOINTER Data
, SQLLEN
*StringLength
,
780 SQLRETURN SQL_API
SQLSetEnvAttr(SQLHENV EnvironmentHandle
,
781 SQLINTEGER Attribute
, SQLPOINTER Value
,
782 SQLINTEGER StringLength
);
783 #endif /* ODBCVER >= 0x0300 */
785 SQLRETURN SQL_API
SQLSetParam(SQLHSTMT StatementHandle
,
786 SQLUSMALLINT ParameterNumber
, SQLSMALLINT ValueType
,
787 SQLSMALLINT ParameterType
, SQLULEN LengthPrecision
,
788 SQLSMALLINT ParameterScale
, SQLPOINTER ParameterValue
,
789 SQLLEN
*StrLen_or_Ind
);
791 #if (ODBCVER >= 0x0300)
792 SQLRETURN SQL_API
SQLSetStmtAttr(SQLHSTMT StatementHandle
,
793 SQLINTEGER Attribute
, SQLPOINTER Value
,
794 SQLINTEGER StringLength
);
797 SQLRETURN SQL_API
SQLSetStmtOption(SQLHSTMT StatementHandle
,
798 SQLUSMALLINT Option
, SQLROWCOUNT Value
);
800 SQLRETURN SQL_API
SQLSpecialColumns(SQLHSTMT StatementHandle
,
801 SQLUSMALLINT IdentifierType
, SQLCHAR
*CatalogName
,
802 SQLSMALLINT NameLength1
, SQLCHAR
*SchemaName
,
803 SQLSMALLINT NameLength2
, SQLCHAR
*TableName
,
804 SQLSMALLINT NameLength3
, SQLUSMALLINT Scope
,
805 SQLUSMALLINT Nullable
);
807 SQLRETURN SQL_API
SQLStatistics(SQLHSTMT StatementHandle
,
808 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
809 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
810 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
811 SQLUSMALLINT Unique
, SQLUSMALLINT Reserved
);
813 SQLRETURN SQL_API
SQLTables(SQLHSTMT StatementHandle
,
814 SQLCHAR
*CatalogName
, SQLSMALLINT NameLength1
,
815 SQLCHAR
*SchemaName
, SQLSMALLINT NameLength2
,
816 SQLCHAR
*TableName
, SQLSMALLINT NameLength3
,
817 SQLCHAR
*TableType
, SQLSMALLINT NameLength4
);
819 SQLRETURN SQL_API
SQLTransact(SQLHENV EnvironmentHandle
,
820 SQLHDBC ConnectionHandle
, SQLUSMALLINT CompletionType
);