📄 sqlext.h
字号:
/*****************************************************************
** SQLEXT.H - This is the include for applications using
** the Microsoft SQL Extensions
**
** (C) Copyright 1990 - 1998 By Microsoft Corp.
**
** Updated 05/12/93 for 2.00 specification
** Updated 05/23/94 for 2.01 specification
** Updated 10/27/94 for 2.10 specification
** Updated 04/10/95 for 2.50 specification
** Updated 07/25/95 for 3.00 specification
** Updated 01/12/96 for 3.00 preliminary release
** Updated 10/22/97 for 3.51 specification
*********************************************************************/
#ifndef __SQLEXT
#define __SQLEXT
#ifndef __SQL
#include "sql.h"
#endif
#ifdef __cplusplus
extern "C" { /* Assume C declarations for C++ */
#endif /* __cplusplus */
/* generally useful constants */
#define SQL_SPEC_MAJOR 3 /* Major version of specification */
#define SQL_SPEC_MINOR 51 /* Minor version of specification */
#define SQL_SPEC_STRING "03.51" /* String constant for version */
#define SQL_SQLSTATE_SIZE 5 /* size of SQLSTATE */
#define SQL_MAX_DSN_LENGTH 32 /* maximum data source name size */
#define SQL_MAX_OPTION_STRING_LENGTH 256
/* return code SQL_NO_DATA_FOUND is the same as SQL_NO_DATA */
#if (ODBCVER < 0x0300)
#define SQL_NO_DATA_FOUND 100
#else
#define SQL_NO_DATA_FOUND SQL_NO_DATA
#endif
/* an end handle type */
#if (ODBCVER >= 0x0300)
#define SQL_HANDLE_SENV 5
#endif /* ODBCVER >= 0x0300 */
/* env attribute */
#if (ODBCVER >= 0x0300)
#define SQL_ATTR_ODBC_VERSION 200
#define SQL_ATTR_CONNECTION_POOLING 201
#define SQL_ATTR_CP_MATCH 202
#endif /* ODBCVER >= 0x0300 */
#if (ODBCVER >= 0x0300)
/* values for SQL_ATTR_CONNECTION_POOLING */
#define SQL_CP_OFF 0UL
#define SQL_CP_ONE_PER_DRIVER 1UL
#define SQL_CP_ONE_PER_HENV 2UL
#define SQL_CP_DEFAULT SQL_CP_OFF
/* values for SQL_ATTR_CP_MATCH */
#define SQL_CP_STRICT_MATCH 0UL
#define SQL_CP_RELAXED_MATCH 1UL
#define SQL_CP_MATCH_DEFAULT SQL_CP_STRICT_MATCH
/* values for SQL_ATTR_ODBC_VERSION */
#define SQL_OV_ODBC2 2UL
#define SQL_OV_ODBC3 3UL
#endif /* ODBCVER >= 0x0300 */
/* connection attributes */
#define SQL_ACCESS_MODE 101
#define SQL_AUTOCOMMIT 102
#define SQL_LOGIN_TIMEOUT 103
#define SQL_OPT_TRACE 104
#define SQL_OPT_TRACEFILE 105
#define SQL_TRANSLATE_DLL 106
#define SQL_TRANSLATE_OPTION 107
#define SQL_TXN_ISOLATION 108
#define SQL_CURRENT_QUALIFIER 109
#define SQL_ODBC_CURSORS 110
#define SQL_QUIET_MODE 111
#define SQL_PACKET_SIZE 112
/* connection attributes with new names */
#if (ODBCVER >= 0x0300)
#define SQL_ATTR_ACCESS_MODE SQL_ACCESS_MODE
#define SQL_ATTR_AUTOCOMMIT SQL_AUTOCOMMIT
#define SQL_ATTR_CONNECTION_TIMEOUT 113
#define SQL_ATTR_CURRENT_CATALOG SQL_CURRENT_QUALIFIER
#define SQL_ATTR_DISCONNECT_BEHAVIOR 114
#define SQL_ATTR_ENLIST_IN_DTC 1207
#define SQL_ATTR_ENLIST_IN_XA 1208
#define SQL_ATTR_LOGIN_TIMEOUT SQL_LOGIN_TIMEOUT
#define SQL_ATTR_ODBC_CURSORS SQL_ODBC_CURSORS
#define SQL_ATTR_PACKET_SIZE SQL_PACKET_SIZE
#define SQL_ATTR_QUIET_MODE SQL_QUIET_MODE
#define SQL_ATTR_TRACE SQL_OPT_TRACE
#define SQL_ATTR_TRACEFILE SQL_OPT_TRACEFILE
#define SQL_ATTR_TRANSLATE_LIB SQL_TRANSLATE_DLL
#define SQL_ATTR_TRANSLATE_OPTION SQL_TRANSLATE_OPTION
#define SQL_ATTR_TXN_ISOLATION SQL_TXN_ISOLATION
#endif /* ODBCVER >= 0x0300 */
#define SQL_ATTR_CONNECTION_DEAD 1209 /* GetConnectAttr only */
#if (ODBCVER >= 0x0351)
/* ODBC Driver Manager sets this connection attribute to a unicode driver
(which supports SQLConnectW) when the application is an ANSI application
(which calls SQLConnect, SQLDriverConnect, or SQLBrowseConnect).
This is SetConnectAttr only and application does not set this attribute
This attribute was introduced because some unicode driver's some APIs may
need to behave differently on ANSI or Unicode applications. A unicode
driver, which has same behavior for both ANSI or Unicode applications,
should return SQL_ERROR when the driver manager sets this connection
attribute. When a unicode driver returns SQL_SUCCESS on this attribute,
the driver manager treates ANSI and Unicode connections differently in
connection pooling.
*/
#define SQL_ATTR_ANSI_APP 115
#endif
/* SQL_CONNECT_OPT_DRVR_START is not meaningful for 3.0 driver */
#if (ODBCVER < 0x0300)
#define SQL_CONNECT_OPT_DRVR_START 1000
#endif /* ODBCVER < 0x0300 */
#if (ODBCVER < 0x0300)
#define SQL_CONN_OPT_MAX SQL_PACKET_SIZE
#define SQL_CONN_OPT_MIN SQL_ACCESS_MODE
#endif /* ODBCVER < 0x0300 */
/* SQL_ACCESS_MODE options */
#define SQL_MODE_READ_WRITE 0UL
#define SQL_MODE_READ_ONLY 1UL
#define SQL_MODE_DEFAULT SQL_MODE_READ_WRITE
/* SQL_AUTOCOMMIT options */
#define SQL_AUTOCOMMIT_OFF 0UL
#define SQL_AUTOCOMMIT_ON 1UL
#define SQL_AUTOCOMMIT_DEFAULT SQL_AUTOCOMMIT_ON
/* SQL_LOGIN_TIMEOUT options */
#define SQL_LOGIN_TIMEOUT_DEFAULT 15UL
/* SQL_OPT_TRACE options */
#define SQL_OPT_TRACE_OFF 0UL
#define SQL_OPT_TRACE_ON 1UL
#define SQL_OPT_TRACE_DEFAULT SQL_OPT_TRACE_OFF
#define SQL_OPT_TRACE_FILE_DEFAULT "\\SQL.LOG"
/* SQL_ODBC_CURSORS options */
#define SQL_CUR_USE_IF_NEEDED 0UL
#define SQL_CUR_USE_ODBC 1UL
#define SQL_CUR_USE_DRIVER 2UL
#define SQL_CUR_DEFAULT SQL_CUR_USE_DRIVER
#if (ODBCVER >= 0x0300)
/* values for SQL_ATTR_DISCONNECT_BEHAVIOR */
#define SQL_DB_RETURN_TO_POOL 0UL
#define SQL_DB_DISCONNECT 1UL
#define SQL_DB_DEFAULT SQL_DB_RETURN_TO_POOL
/* values for SQL_ATTR_ENLIST_IN_DTC */
#define SQL_DTC_DONE 0L
#endif /* ODBCVER >= 0x0300 */
/* values for SQL_ATTR_CONNECTION_DEAD */
#define SQL_CD_TRUE 1L /* Connection is closed/dead */
#define SQL_CD_FALSE 0L /* Connection is open/available */
/* values for SQL_ATTR_ANSI_APP */
#if (ODBCVER >= 0x0351)
#define SQL_AA_TRUE 1L /* the application is an ANSI app */
#define SQL_AA_FALSE 0L /* the application is a Unicode app */
#endif
/* statement attributes */
#define SQL_QUERY_TIMEOUT 0
#define SQL_MAX_ROWS 1
#define SQL_NOSCAN 2
#define SQL_MAX_LENGTH 3
#define SQL_ASYNC_ENABLE 4 /* same as SQL_ATTR_ASYNC_ENABLE */
#define SQL_BIND_TYPE 5
#define SQL_CURSOR_TYPE 6
#define SQL_CONCURRENCY 7
#define SQL_KEYSET_SIZE 8
#define SQL_ROWSET_SIZE 9
#define SQL_SIMULATE_CURSOR 10
#define SQL_RETRIEVE_DATA 11
#define SQL_USE_BOOKMARKS 12
#define SQL_GET_BOOKMARK 13 /* GetStmtOption Only */
#define SQL_ROW_NUMBER 14 /* GetStmtOption Only */
/* statement attributes for ODBC 3.0 */
#if (ODBCVER >= 0x0300)
#define SQL_ATTR_ASYNC_ENABLE 4
#define SQL_ATTR_CONCURRENCY SQL_CONCURRENCY
#define SQL_ATTR_CURSOR_TYPE SQL_CURSOR_TYPE
#define SQL_ATTR_ENABLE_AUTO_IPD 15
#define SQL_ATTR_FETCH_BOOKMARK_PTR 16
#define SQL_ATTR_KEYSET_SIZE SQL_KEYSET_SIZE
#define SQL_ATTR_MAX_LENGTH SQL_MAX_LENGTH
#define SQL_ATTR_MAX_ROWS SQL_MAX_ROWS
#define SQL_ATTR_NOSCAN SQL_NOSCAN
#define SQL_ATTR_PARAM_BIND_OFFSET_PTR 17
#define SQL_ATTR_PARAM_BIND_TYPE 18
#define SQL_ATTR_PARAM_OPERATION_PTR 19
#define SQL_ATTR_PARAM_STATUS_PTR 20
#define SQL_ATTR_PARAMS_PROCESSED_PTR 21
#define SQL_ATTR_PARAMSET_SIZE 22
#define SQL_ATTR_QUERY_TIMEOUT SQL_QUERY_TIMEOUT
#define SQL_ATTR_RETRIEVE_DATA SQL_RETRIEVE_DATA
#define SQL_ATTR_ROW_BIND_OFFSET_PTR 23
#define SQL_ATTR_ROW_BIND_TYPE SQL_BIND_TYPE
#define SQL_ATTR_ROW_NUMBER SQL_ROW_NUMBER /*GetStmtAttr*/
#define SQL_ATTR_ROW_OPERATION_PTR 24
#define SQL_ATTR_ROW_STATUS_PTR 25
#define SQL_ATTR_ROWS_FETCHED_PTR 26
#define SQL_ATTR_ROW_ARRAY_SIZE 27
#define SQL_ATTR_SIMULATE_CURSOR SQL_SIMULATE_CURSOR
#define SQL_ATTR_USE_BOOKMARKS SQL_USE_BOOKMARKS
#endif /* ODBCVER >= 0x0300 */
#if (ODBCVER < 0x0300)
#define SQL_STMT_OPT_MAX SQL_ROW_NUMBER
#define SQL_STMT_OPT_MIN SQL_QUERY_TIMEOUT
#endif /* ODBCVER < 0x0300 */
/* New defines for SEARCHABLE column in SQLGetTypeInfo */
#if (ODBCVER >= 0x0300)
#define SQL_COL_PRED_CHAR SQL_LIKE_ONLY
#define SQL_COL_PRED_BASIC SQL_ALL_EXCEPT_LIKE
#endif /* ODBCVER >= 0x0300 */
/* whether an attribute is a pointer or not */
#if (ODBCVER >= 0x0300)
#define SQL_IS_POINTER (-4)
#define SQL_IS_UINTEGER (-5)
#define SQL_IS_INTEGER (-6)
#define SQL_IS_USMALLINT (-7)
#define SQL_IS_SMALLINT (-8)
#endif /* ODBCVER >= 0x0300 */
/* the value of SQL_ATTR_PARAM_BIND_TYPE */
#if (ODBCVER >= 0x0300)
#define SQL_PARAM_BIND_BY_COLUMN 0UL
#define SQL_PARAM_BIND_TYPE_DEFAULT SQL_PARAM_BIND_BY_COLUMN
#endif /* ODBCVER >= 0x0300 */
/* SQL_QUERY_TIMEOUT options */
#define SQL_QUERY_TIMEOUT_DEFAULT 0UL
/* SQL_MAX_ROWS options */
#define SQL_MAX_ROWS_DEFAULT 0UL
/* SQL_NOSCAN options */
#define SQL_NOSCAN_OFF 0UL /* 1.0 FALSE */
#define SQL_NOSCAN_ON 1UL /* 1.0 TRUE */
#define SQL_NOSCAN_DEFAULT SQL_NOSCAN_OFF
/* SQL_MAX_LENGTH options */
#define SQL_MAX_LENGTH_DEFAULT 0UL
/* values for SQL_ATTR_ASYNC_ENABLE */
#define SQL_ASYNC_ENABLE_OFF 0UL
#define SQL_ASYNC_ENABLE_ON 1UL
#define SQL_ASYNC_ENABLE_DEFAULT SQL_ASYNC_ENABLE_OFF
/* SQL_BIND_TYPE options */
#define SQL_BIND_BY_COLUMN 0UL
#define SQL_BIND_TYPE_DEFAULT SQL_BIND_BY_COLUMN /* Default value */
/* SQL_CONCURRENCY options */
#define SQL_CONCUR_READ_ONLY 1
#define SQL_CONCUR_LOCK 2
#define SQL_CONCUR_ROWVER 3
#define SQL_CONCUR_VALUES 4
#define SQL_CONCUR_DEFAULT SQL_CONCUR_READ_ONLY /* Default value */
/* SQL_CURSOR_TYPE options */
#define SQL_CURSOR_FORWARD_ONLY 0UL
#define SQL_CURSOR_KEYSET_DRIVEN 1UL
#define SQL_CURSOR_DYNAMIC 2UL
#define SQL_CURSOR_STATIC 3UL
#define SQL_CURSOR_TYPE_DEFAULT SQL_CURSOR_FORWARD_ONLY /* Default value */
/* SQL_ROWSET_SIZE options */
#define SQL_ROWSET_SIZE_DEFAULT 1UL
/* SQL_KEYSET_SIZE options */
#define SQL_KEYSET_SIZE_DEFAULT 0UL
/* SQL_SIMULATE_CURSOR options */
#define SQL_SC_NON_UNIQUE 0UL
#define SQL_SC_TRY_UNIQUE 1UL
#define SQL_SC_UNIQUE 2UL
/* SQL_RETRIEVE_DATA options */
#define SQL_RD_OFF 0UL
#define SQL_RD_ON 1UL
#define SQL_RD_DEFAULT SQL_RD_ON
/* SQL_USE_BOOKMARKS options */
#define SQL_UB_OFF 0UL
#define SQL_UB_ON 01UL
#define SQL_UB_DEFAULT SQL_UB_OFF
/* New values for SQL_USE_BOOKMARKS attribute */
#if (ODBCVER >= 0x0300)
#define SQL_UB_FIXED SQL_UB_ON
#define SQL_UB_VARIABLE 2UL
#endif /* ODBCVER >= 0x0300 */
/* extended descriptor field */
#if (ODBCVER >= 0x0300)
#define SQL_DESC_ARRAY_SIZE 20
#define SQL_DESC_ARRAY_STATUS_PTR 21
#define SQL_DESC_AUTO_UNIQUE_VALUE SQL_COLUMN_AUTO_INCREMENT
#define SQL_DESC_BASE_COLUMN_NAME 22
#define SQL_DESC_BASE_TABLE_NAME 23
#define SQL_DESC_BIND_OFFSET_PTR 24
#define SQL_DESC_BIND_TYPE 25
#define SQL_DESC_CASE_SENSITIVE SQL_COLUMN_CASE_SENSITIVE
#define SQL_DESC_CATALOG_NAME SQL_COLUMN_QUALIFIER_NAME
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -