Home | History | Annotate | Download | only in include
      1 /**
      2  * This file has no copyright assigned and is placed in the Public Domain.
      3  * This file is part of the mingw-w64 runtime package.
      4  * No warranty is given; refer to the file DISCLAIMER.PD within this package.
      5  */
      6 #ifndef __ODBCSS
      7 #define __ODBCSS
      8 
      9 #include <_mingw_unicode.h>
     10 
     11 #ifdef __cplusplus
     12 extern "C" {
     13 #endif
     14 
     15 #define SQL_MAX_SQLSERVERNAME 128
     16 
     17 #define SQL_COPT_SS_BASE 1200
     18 #define SQL_COPT_SS_REMOTE_PWD (SQL_COPT_SS_BASE+1)
     19 #define SQL_COPT_SS_USE_PROC_FOR_PREP (SQL_COPT_SS_BASE+2)
     20 #define SQL_COPT_SS_INTEGRATED_SECURITY (SQL_COPT_SS_BASE+3)
     21 #define SQL_COPT_SS_PRESERVE_CURSORS (SQL_COPT_SS_BASE+4)
     22 #define SQL_COPT_SS_USER_DATA (SQL_COPT_SS_BASE+5)
     23 #define SQL_COPT_SS_ENLIST_IN_DTC SQL_ATTR_ENLIST_IN_DTC
     24 #define SQL_COPT_SS_ENLIST_IN_XA SQL_ATTR_ENLIST_IN_XA
     25 
     26 #define SQL_COPT_SS_FALLBACK_CONNECT (SQL_COPT_SS_BASE+10)
     27 #define SQL_COPT_SS_PERF_DATA (SQL_COPT_SS_BASE+11)
     28 #define SQL_COPT_SS_PERF_DATA_LOG (SQL_COPT_SS_BASE+12)
     29 #define SQL_COPT_SS_PERF_QUERY_INTERVAL (SQL_COPT_SS_BASE+13)
     30 #define SQL_COPT_SS_PERF_QUERY_LOG (SQL_COPT_SS_BASE+14)
     31 #define SQL_COPT_SS_PERF_QUERY (SQL_COPT_SS_BASE+15)
     32 #define SQL_COPT_SS_PERF_DATA_LOG_NOW (SQL_COPT_SS_BASE+16)
     33 #define SQL_COPT_SS_QUOTED_IDENT (SQL_COPT_SS_BASE+17)
     34 #define SQL_COPT_SS_ANSI_NPW (SQL_COPT_SS_BASE+18)
     35 #define SQL_COPT_SS_BCP (SQL_COPT_SS_BASE+19)
     36 #define SQL_COPT_SS_TRANSLATE (SQL_COPT_SS_BASE+20)
     37 #define SQL_COPT_SS_ATTACHDBFILENAME (SQL_COPT_SS_BASE+21)
     38 #define SQL_COPT_SS_CONCAT_NULL (SQL_COPT_SS_BASE+22)
     39 #define SQL_COPT_SS_ENCRYPT (SQL_COPT_SS_BASE+23)
     40 
     41 #define SQL_COPT_SS_MAX_USED SQL_COPT_SS_ENCRYPT
     42 
     43 #define SQL_SOPT_SS_BASE 1225
     44 #define SQL_SOPT_SS_TEXTPTR_LOGGING (SQL_SOPT_SS_BASE+0)
     45 #define SQL_SOPT_SS_CURRENT_COMMAND (SQL_SOPT_SS_BASE+1)
     46 #define SQL_SOPT_SS_HIDDEN_COLUMNS (SQL_SOPT_SS_BASE+2)
     47 #define SQL_SOPT_SS_NOBROWSETABLE (SQL_SOPT_SS_BASE+3)
     48 #define SQL_SOPT_SS_REGIONALIZE (SQL_SOPT_SS_BASE+4)
     49 #define SQL_SOPT_SS_CURSOR_OPTIONS (SQL_SOPT_SS_BASE+5)
     50 #define SQL_SOPT_SS_NOCOUNT_STATUS (SQL_SOPT_SS_BASE+6)
     51 #define SQL_SOPT_SS_DEFER_PREPARE (SQL_SOPT_SS_BASE+7)
     52 
     53 #define SQL_SOPT_SS_MAX_USED SQL_SOPT_SS_DEFER_PREPARE
     54 
     55 #define SQL_COPT_SS_BASE_EX 1240
     56 #define SQL_COPT_SS_BROWSE_CONNECT (SQL_COPT_SS_BASE_EX+1)
     57 #define SQL_COPT_SS_BROWSE_SERVER (SQL_COPT_SS_BASE_EX+2)
     58 #define SQL_COPT_SS_WARN_ON_CP_ERROR (SQL_COPT_SS_BASE_EX+3)
     59 
     60 #define SQL_COPT_SS_CONNECTION_DEAD (SQL_COPT_SS_BASE_EX+4)
     61 
     62 #define SQL_COPT_SS_BROWSE_CACHE_DATA (SQL_COPT_SS_BASE_EX+5)
     63 
     64 #define SQL_COPT_SS_RESET_CONNECTION (SQL_COPT_SS_BASE_EX+6)
     65 
     66 #define SQL_COPT_SS_EX_MAX_USED SQL_COPT_SS_RESET_CONNECTION
     67 
     68 #define SQL_UP_OFF __MSABI_LONG(0)
     69 #define SQL_UP_ON __MSABI_LONG(1)
     70 #define SQL_UP_ON_DROP __MSABI_LONG(2)
     71 #define SQL_UP_DEFAULT SQL_UP_ON
     72 
     73 #define SQL_IS_OFF __MSABI_LONG(0)
     74 #define SQL_IS_ON __MSABI_LONG(1)
     75 #define SQL_IS_DEFAULT SQL_IS_OFF
     76 
     77 #define SQL_PC_OFF __MSABI_LONG(0)
     78 #define SQL_PC_ON __MSABI_LONG(1)
     79 #define SQL_PC_DEFAULT SQL_PC_OFF
     80 
     81 #define SQL_UD_NOTSET NULL
     82 
     83 #define SQL_XL_OFF __MSABI_LONG(0)
     84 #define SQL_XL_ON __MSABI_LONG(1)
     85 #define SQL_XL_DEFAULT SQL_XL_ON
     86 
     87 #define SQL_FB_OFF __MSABI_LONG(0)
     88 #define SQL_FB_ON __MSABI_LONG(1)
     89 #define SQL_FB_DEFAULT SQL_FB_OFF
     90 
     91 #define SQL_BCP_OFF __MSABI_LONG(0)
     92 #define SQL_BCP_ON __MSABI_LONG(1)
     93 #define SQL_BCP_DEFAULT SQL_BCP_OFF
     94 
     95 #define SQL_QI_OFF __MSABI_LONG(0)
     96 #define SQL_QI_ON __MSABI_LONG(1)
     97 #define SQL_QI_DEFAULT SQL_QI_ON
     98 
     99 #define SQL_AD_OFF __MSABI_LONG(0)
    100 #define SQL_AD_ON __MSABI_LONG(1)
    101 #define SQL_AD_DEFAULT SQL_AD_ON
    102 
    103 #define SQL_CN_OFF __MSABI_LONG(0)
    104 #define SQL_CN_ON __MSABI_LONG(1)
    105 #define SQL_CN_DEFAULT SQL_CN_ON
    106 
    107 #define SQL_TL_OFF __MSABI_LONG(0)
    108 #define SQL_TL_ON __MSABI_LONG(1)
    109 #define SQL_TL_DEFAULT SQL_TL_ON
    110 
    111 #define SQL_HC_OFF __MSABI_LONG(0)
    112 #define SQL_HC_ON __MSABI_LONG(1)
    113 #define SQL_HC_DEFAULT SQL_HC_OFF
    114 
    115 #define SQL_NB_OFF __MSABI_LONG(0)
    116 #define SQL_NB_ON __MSABI_LONG(1)
    117 #define SQL_NB_DEFAULT SQL_NB_OFF
    118 
    119 #define SQL_RE_OFF __MSABI_LONG(0)
    120 #define SQL_RE_ON __MSABI_LONG(1)
    121 #define SQL_RE_DEFAULT SQL_RE_OFF
    122 
    123 #define SQL_CO_OFF __MSABI_LONG(0)
    124 #define SQL_CO_FFO __MSABI_LONG(1)
    125 #define SQL_CO_AF __MSABI_LONG(2)
    126 #define SQL_CO_FFO_AF (SQL_CO_FFO|SQL_CO_AF)
    127 #define SQL_CO_FIREHOSE_AF __MSABI_LONG(4)
    128 #define SQL_CO_DEFAULT SQL_CO_OFF
    129 
    130 #define SQL_NC_OFF __MSABI_LONG(0)
    131 #define SQL_NC_ON __MSABI_LONG(1)
    132 
    133 #define SQL_DP_OFF __MSABI_LONG(0)
    134 #define SQL_DP_ON __MSABI_LONG(1)
    135 
    136 #define SQL_EN_OFF __MSABI_LONG(0)
    137 #define SQL_EN_ON __MSABI_LONG(1)
    138 
    139 #define SQL_MORE_INFO_NO __MSABI_LONG(0)
    140 #define SQL_MORE_INFO_YES __MSABI_LONG(1)
    141 
    142 #define SQL_CACHE_DATA_NO __MSABI_LONG(0)
    143 #define SQL_CACHE_DATA_YES __MSABI_LONG(1)
    144 
    145 #define SQL_RESET_YES __MSABI_LONG(1)
    146 
    147 #define SQL_WARN_NO __MSABI_LONG(0)
    148 #define SQL_WARN_YES __MSABI_LONG(1)
    149 
    150 #define SQL_CURSOR_FAST_FORWARD_ONLY 8
    151 
    152 #define SQL_CA_SS_BASE 1200
    153 #define SQL_CA_SS_COLUMN_SSTYPE (SQL_CA_SS_BASE+0)
    154 #define SQL_CA_SS_COLUMN_UTYPE (SQL_CA_SS_BASE+1)
    155 #define SQL_CA_SS_NUM_ORDERS (SQL_CA_SS_BASE+2)
    156 #define SQL_CA_SS_COLUMN_ORDER (SQL_CA_SS_BASE+3)
    157 #define SQL_CA_SS_COLUMN_VARYLEN (SQL_CA_SS_BASE+4)
    158 #define SQL_CA_SS_NUM_COMPUTES (SQL_CA_SS_BASE+5)
    159 #define SQL_CA_SS_COMPUTE_ID (SQL_CA_SS_BASE+6)
    160 #define SQL_CA_SS_COMPUTE_BYLIST (SQL_CA_SS_BASE+7)
    161 #define SQL_CA_SS_COLUMN_ID (SQL_CA_SS_BASE+8)
    162 #define SQL_CA_SS_COLUMN_OP (SQL_CA_SS_BASE+9)
    163 #define SQL_CA_SS_COLUMN_SIZE (SQL_CA_SS_BASE+10)
    164 #define SQL_CA_SS_COLUMN_HIDDEN (SQL_CA_SS_BASE+11)
    165 #define SQL_CA_SS_COLUMN_KEY (SQL_CA_SS_BASE+12)
    166 
    167 #define SQL_CA_SS_COLUMN_COLLATION (SQL_CA_SS_BASE+14)
    168 #define SQL_CA_SS_VARIANT_TYPE (SQL_CA_SS_BASE+15)
    169 #define SQL_CA_SS_VARIANT_SQL_TYPE (SQL_CA_SS_BASE+16)
    170 #define SQL_CA_SS_VARIANT_SERVER_TYPE (SQL_CA_SS_BASE+17)
    171 #define SQL_CA_SS_MAX_USED (SQL_CA_SS_BASE+18)
    172 
    173 #define SQLTEXT 0x23
    174 #define SQLVARBINARY 0x25
    175 #define SQLINTN 0x26
    176 #define SQLVARCHAR 0x27
    177 #define SQLBINARY 0x2d
    178 #define SQLIMAGE 0x22
    179 #define SQLCHARACTER 0x2f
    180 #define SQLINT1 0x30
    181 #define SQLBIT 0x32
    182 #define SQLINT2 0x34
    183 #define SQLINT4 0x38
    184 #define SQLMONEY 0x3c
    185 #define SQLDATETIME 0x3d
    186 #define SQLFLT8 0x3e
    187 #define SQLFLTN 0x6d
    188 #define SQLMONEYN 0x6e
    189 #define SQLDATETIMN 0x6f
    190 #define SQLFLT4 0x3b
    191 #define SQLMONEY4 0x7a
    192 #define SQLDATETIM4 0x3a
    193 
    194 #define SQLDECIMAL 0x6a
    195 #define SQLNUMERIC 0x6c
    196 
    197 #define SQLUNIQUEID 0x24
    198 #define SQLBIGCHAR 0xaf
    199 #define SQLBIGVARCHAR 0xa7
    200 #define SQLBIGBINARY 0xad
    201 #define SQLBIGVARBINARY 0xa5
    202 #define SQLBITN 0x68
    203 #define SQLNCHAR 0xef
    204 #define SQLNVARCHAR 0xe7
    205 #define SQLNTEXT 0x63
    206 
    207 #define SQLINT8 0x7f
    208 #define SQLVARIANT 0x62
    209 
    210 #define SQLudtBINARY 3
    211 #define SQLudtBIT 16
    212 #define SQLudtBITN 0
    213 #define SQLudtCHAR 1
    214 #define SQLudtDATETIM4 22
    215 #define SQLudtDATETIME 12
    216 #define SQLudtDATETIMN 15
    217 #define SQLudtDECML 24
    218 #define SQLudtDECMLN 26
    219 #define SQLudtFLT4 23
    220 #define SQLudtFLT8 8
    221 #define SQLudtFLTN 14
    222 #define SQLudtIMAGE 20
    223 #define SQLudtINT1 5
    224 #define SQLudtINT2 6
    225 #define SQLudtINT4 7
    226 #define SQLudtINTN 13
    227 #define SQLudtMONEY 11
    228 #define SQLudtMONEY4 21
    229 #define SQLudtMONEYN 17
    230 #define SQLudtNUM 10
    231 #define SQLudtNUMN 25
    232 #define SQLudtSYSNAME 18
    233 #define SQLudtTEXT 19
    234 #define SQLudtTIMESTAMP 80
    235 #define SQLudtUNIQUEIDENTIFIER 0
    236 #define SQLudtVARBINARY 4
    237 #define SQLudtVARCHAR 2
    238 #define MIN_USER_DATATYPE 256
    239 
    240 #define SQLAOPSTDEV 0x30
    241 #define SQLAOPSTDEVP 0x31
    242 #define SQLAOPVAR 0x32
    243 #define SQLAOPVARP 0x33
    244 #define SQLAOPCNT 0x4b
    245 #define SQLAOPSUM 0x4d
    246 #define SQLAOPAVG 0x4f
    247 #define SQLAOPMIN 0x51
    248 #define SQLAOPMAX 0x52
    249 #define SQLAOPANY 0x53
    250 #define SQLAOPNOOP 0x56
    251 
    252 #define SQL_INFO_SS_FIRST 1199
    253 #define SQL_INFO_SS_NETLIB_NAMEW (SQL_INFO_SS_FIRST+0)
    254 #define SQL_INFO_SS_NETLIB_NAMEA (SQL_INFO_SS_FIRST+1)
    255 #define SQL_INFO_SS_MAX_USED SQL_INFO_SS_NETLIB_NAMEA
    256 
    257 #define SQL_INFO_SS_NETLIB_NAME __MINGW_NAME_AW(SQL_INFO_SS_NETLIB_NAME)
    258 
    259 #define SQL_SS_VARIANT -150
    260 
    261 #define SQL_DIAG_SS_BASE (-1150)
    262 #define SQL_DIAG_SS_MSGSTATE (SQL_DIAG_SS_BASE)
    263 #define SQL_DIAG_SS_SEVERITY (SQL_DIAG_SS_BASE-1)
    264 #define SQL_DIAG_SS_SRVNAME (SQL_DIAG_SS_BASE-2)
    265 #define SQL_DIAG_SS_PROCNAME (SQL_DIAG_SS_BASE-3)
    266 #define SQL_DIAG_SS_LINE (SQL_DIAG_SS_BASE-4)
    267 
    268 #define SQL_DIAG_DFC_SS_BASE (-200)
    269 #define SQL_DIAG_DFC_SS_ALTER_DATABASE (SQL_DIAG_DFC_SS_BASE-0)
    270 #define SQL_DIAG_DFC_SS_CHECKPOINT (SQL_DIAG_DFC_SS_BASE-1)
    271 #define SQL_DIAG_DFC_SS_CONDITION (SQL_DIAG_DFC_SS_BASE-2)
    272 #define SQL_DIAG_DFC_SS_CREATE_DATABASE (SQL_DIAG_DFC_SS_BASE-3)
    273 #define SQL_DIAG_DFC_SS_CREATE_DEFAULT (SQL_DIAG_DFC_SS_BASE-4)
    274 #define SQL_DIAG_DFC_SS_CREATE_PROCEDURE (SQL_DIAG_DFC_SS_BASE-5)
    275 #define SQL_DIAG_DFC_SS_CREATE_RULE (SQL_DIAG_DFC_SS_BASE-6)
    276 #define SQL_DIAG_DFC_SS_CREATE_TRIGGER (SQL_DIAG_DFC_SS_BASE-7)
    277 #define SQL_DIAG_DFC_SS_CURSOR_DECLARE (SQL_DIAG_DFC_SS_BASE-8)
    278 #define SQL_DIAG_DFC_SS_CURSOR_OPEN (SQL_DIAG_DFC_SS_BASE-9)
    279 #define SQL_DIAG_DFC_SS_CURSOR_FETCH (SQL_DIAG_DFC_SS_BASE-10)
    280 #define SQL_DIAG_DFC_SS_CURSOR_CLOSE (SQL_DIAG_DFC_SS_BASE-11)
    281 #define SQL_DIAG_DFC_SS_DEALLOCATE_CURSOR (SQL_DIAG_DFC_SS_BASE-12)
    282 #define SQL_DIAG_DFC_SS_DBCC (SQL_DIAG_DFC_SS_BASE-13)
    283 #define SQL_DIAG_DFC_SS_DISK (SQL_DIAG_DFC_SS_BASE-14)
    284 #define SQL_DIAG_DFC_SS_DROP_DATABASE (SQL_DIAG_DFC_SS_BASE-15)
    285 #define SQL_DIAG_DFC_SS_DROP_DEFAULT (SQL_DIAG_DFC_SS_BASE-16)
    286 #define SQL_DIAG_DFC_SS_DROP_PROCEDURE (SQL_DIAG_DFC_SS_BASE-17)
    287 #define SQL_DIAG_DFC_SS_DROP_RULE (SQL_DIAG_DFC_SS_BASE-18)
    288 #define SQL_DIAG_DFC_SS_DROP_TRIGGER (SQL_DIAG_DFC_SS_BASE-19)
    289 #define SQL_DIAG_DFC_SS_DUMP_DATABASE (SQL_DIAG_DFC_SS_BASE-20)
    290 #define SQL_DIAG_DFC_SS_DUMP_TABLE (SQL_DIAG_DFC_SS_BASE-21)
    291 #define SQL_DIAG_DFC_SS_DUMP_TRANSACTION (SQL_DIAG_DFC_SS_BASE-22)
    292 #define SQL_DIAG_DFC_SS_GOTO (SQL_DIAG_DFC_SS_BASE-23)
    293 #define SQL_DIAG_DFC_SS_INSERT_BULK (SQL_DIAG_DFC_SS_BASE-24)
    294 #define SQL_DIAG_DFC_SS_KILL (SQL_DIAG_DFC_SS_BASE-25)
    295 #define SQL_DIAG_DFC_SS_LOAD_DATABASE (SQL_DIAG_DFC_SS_BASE-26)
    296 #define SQL_DIAG_DFC_SS_LOAD_HEADERONLY (SQL_DIAG_DFC_SS_BASE-27)
    297 #define SQL_DIAG_DFC_SS_LOAD_TABLE (SQL_DIAG_DFC_SS_BASE-28)
    298 #define SQL_DIAG_DFC_SS_LOAD_TRANSACTION (SQL_DIAG_DFC_SS_BASE-29)
    299 #define SQL_DIAG_DFC_SS_PRINT (SQL_DIAG_DFC_SS_BASE-30)
    300 #define SQL_DIAG_DFC_SS_RAISERROR (SQL_DIAG_DFC_SS_BASE-31)
    301 #define SQL_DIAG_DFC_SS_READTEXT (SQL_DIAG_DFC_SS_BASE-32)
    302 #define SQL_DIAG_DFC_SS_RECONFIGURE (SQL_DIAG_DFC_SS_BASE-33)
    303 #define SQL_DIAG_DFC_SS_RETURN (SQL_DIAG_DFC_SS_BASE-34)
    304 #define SQL_DIAG_DFC_SS_SELECT_INTO (SQL_DIAG_DFC_SS_BASE-35)
    305 #define SQL_DIAG_DFC_SS_SET (SQL_DIAG_DFC_SS_BASE-36)
    306 #define SQL_DIAG_DFC_SS_SET_IDENTITY_INSERT (SQL_DIAG_DFC_SS_BASE-37)
    307 #define SQL_DIAG_DFC_SS_SET_ROW_COUNT (SQL_DIAG_DFC_SS_BASE-38)
    308 #define SQL_DIAG_DFC_SS_SET_STATISTICS (SQL_DIAG_DFC_SS_BASE-39)
    309 #define SQL_DIAG_DFC_SS_SET_TEXTSIZE (SQL_DIAG_DFC_SS_BASE-40)
    310 #define SQL_DIAG_DFC_SS_SETUSER (SQL_DIAG_DFC_SS_BASE-41)
    311 #define SQL_DIAG_DFC_SS_SHUTDOWN (SQL_DIAG_DFC_SS_BASE-42)
    312 #define SQL_DIAG_DFC_SS_TRANS_BEGIN (SQL_DIAG_DFC_SS_BASE-43)
    313 #define SQL_DIAG_DFC_SS_TRANS_COMMIT (SQL_DIAG_DFC_SS_BASE-44)
    314 #define SQL_DIAG_DFC_SS_TRANS_PREPARE (SQL_DIAG_DFC_SS_BASE-45)
    315 #define SQL_DIAG_DFC_SS_TRANS_ROLLBACK (SQL_DIAG_DFC_SS_BASE-46)
    316 #define SQL_DIAG_DFC_SS_TRANS_SAVE (SQL_DIAG_DFC_SS_BASE-47)
    317 #define SQL_DIAG_DFC_SS_TRUNCATE_TABLE (SQL_DIAG_DFC_SS_BASE-48)
    318 #define SQL_DIAG_DFC_SS_UPDATE_STATISTICS (SQL_DIAG_DFC_SS_BASE-49)
    319 #define SQL_DIAG_DFC_SS_UPDATETEXT (SQL_DIAG_DFC_SS_BASE-50)
    320 #define SQL_DIAG_DFC_SS_USE (SQL_DIAG_DFC_SS_BASE-51)
    321 #define SQL_DIAG_DFC_SS_WAITFOR (SQL_DIAG_DFC_SS_BASE-52)
    322 #define SQL_DIAG_DFC_SS_WRITETEXT (SQL_DIAG_DFC_SS_BASE-53)
    323 #define SQL_DIAG_DFC_SS_DENY (SQL_DIAG_DFC_SS_BASE-54)
    324 #define SQL_DIAG_DFC_SS_SET_XCTLVL (SQL_DIAG_DFC_SS_BASE-55)
    325 
    326 #define EX_ANY 0
    327 #define EX_INFO 10
    328 #define EX_MAXISEVERITY EX_INFO
    329 #define EX_MISSING 11
    330 #define EX_TYPE 12
    331 #define EX_DEADLOCK 13
    332 #define EX_PERMIT 14
    333 #define EX_SYNTAX 15
    334 #define EX_USER 16
    335 #define EX_RESOURCE 17
    336 #define EX_INTOK 18
    337 #define MAXUSEVERITY EX_INTOK
    338 #define EX_LIMIT 19
    339 #define EX_CMDFATAL 20
    340 #define MINFATALERR EX_CMDFATAL
    341 #define EX_DBFATAL 21
    342 #define EX_TABCORRUPT 22
    343 #define EX_DBCORRUPT 23
    344 #define EX_HARDWARE 24
    345 #define EX_CONTROL 25
    346 
    347 #ifndef MAXNUMERICLEN
    348 
    349 #define DBMAXCHAR (8000+1)
    350 #define MAXNAME (SQL_MAX_SQLSERVERNAME+1)
    351 
    352 #if defined(UNICODE)
    353   typedef wchar_t DBCHAR;
    354 #else
    355   typedef char DBCHAR;
    356 #endif
    357   typedef unsigned char DBBINARY;
    358   typedef unsigned char DBTINYINT;
    359   typedef short DBSMALLINT;
    360   typedef unsigned short DBUSMALLINT;
    361   typedef double DBFLT8;
    362   typedef unsigned char DBBIT;
    363   typedef unsigned char DBBOOL;
    364   typedef float DBFLT4;
    365   typedef DBFLT4 DBREAL;
    366   typedef UINT DBUBOOL;
    367 
    368   typedef struct dbvarychar {
    369     DBSMALLINT len;
    370     DBCHAR str[DBMAXCHAR];
    371   } DBVARYCHAR;
    372 
    373   typedef struct dbvarybin {
    374     DBSMALLINT len;
    375     BYTE array[DBMAXCHAR];
    376   } DBVARYBIN;
    377 
    378   typedef struct dbmoney {
    379     LONG mnyhigh;
    380     ULONG mnylow;
    381   } DBMONEY;
    382 
    383   typedef struct dbdatetime {
    384     LONG dtdays;
    385     ULONG dttime;
    386   } DBDATETIME;
    387 
    388   typedef struct dbdatetime4 {
    389     USHORT numdays;
    390     USHORT nummins;
    391   } DBDATETIM4;
    392 
    393   typedef LONG DBMONEY4;
    394 
    395 #define DBNUM_PREC_TYPE BYTE
    396 #define DBNUM_SCALE_TYPE BYTE
    397 #define DBNUM_VAL_TYPE BYTE
    398 
    399 #if (ODBCVER < 0x0300)
    400 #define MAXNUMERICLEN 16
    401 
    402   typedef struct dbnumeric {
    403     DBNUM_PREC_TYPE precision;
    404     DBNUM_SCALE_TYPE scale;
    405     BYTE sign;
    406     DBNUM_VAL_TYPE val[MAXNUMERICLEN];
    407   } DBNUMERIC;
    408   typedef DBNUMERIC DBDECIMAL;
    409 #else
    410 #define MAXNUMERICLEN SQL_MAX_NUMERIC_LEN
    411   typedef SQL_NUMERIC_STRUCT DBNUMERIC;
    412   typedef SQL_NUMERIC_STRUCT DBDECIMAL;
    413 #endif
    414 #endif
    415 
    416 #ifndef INT
    417   typedef int INT;
    418   typedef __LONG32 DBINT;
    419 #ifndef _LPCBYTE_DEFINED
    420 #define _LPCBYTE_DEFINED
    421   typedef const LPBYTE LPCBYTE;
    422 #endif
    423   typedef DBINT *LPDBINT;
    424 #endif
    425 
    426   typedef struct sqlperf {
    427     DWORD TimerResolution;
    428     DWORD SQLidu;
    429     DWORD SQLiduRows;
    430     DWORD SQLSelects;
    431     DWORD SQLSelectRows;
    432     DWORD Transactions;
    433     DWORD SQLPrepares;
    434     DWORD ExecDirects;
    435     DWORD SQLExecutes;
    436     DWORD CursorOpens;
    437     DWORD CursorSize;
    438     DWORD CursorUsed;
    439     LDOUBLE PercentCursorUsed;
    440     LDOUBLE AvgFetchTime;
    441     LDOUBLE AvgCursorSize;
    442     LDOUBLE AvgCursorUsed;
    443     DWORD SQLFetchTime;
    444     DWORD SQLFetchCount;
    445     DWORD CurrentStmtCount;
    446     DWORD MaxOpenStmt;
    447     DWORD SumOpenStmt;
    448     DWORD CurrentConnectionCount;
    449     DWORD MaxConnectionsOpened;
    450     DWORD SumConnectionsOpened;
    451     DWORD SumConnectiontime;
    452     LDOUBLE AvgTimeOpened;
    453     DWORD ServerRndTrips;
    454     DWORD BuffersSent;
    455     DWORD BuffersRec;
    456     DWORD BytesSent;
    457     DWORD BytesRec;
    458     DWORD msExecutionTime;
    459     DWORD msNetWorkServerTime;
    460   } SQLPERF;
    461 
    462 #define SQL_PERF_START 1
    463 #define SQL_PERF_STOP 2
    464 
    465 #define SQL_SS_DL_DEFAULT TEXT("STATS.LOG")
    466 #define SQL_SS_QL_DEFAULT TEXT("QUERY.LOG")
    467 #define SQL_SS_QI_DEFAULT 30000
    468 
    469 #define SUCCEED 1
    470 #define FAIL 0
    471 #define SUCCEED_ABORT 2
    472 #define SUCCEED_ASYNC 3
    473 
    474 #define DB_IN 1
    475 #define DB_OUT 2
    476 
    477 #define BCPMAXERRS 1
    478 #define BCPFIRST 2
    479 #define BCPLAST 3
    480 #define BCPBATCH 4
    481 #define BCPKEEPNULLS 5
    482 #define BCPABORT 6
    483 #define BCPODBC 7
    484 #define BCPKEEPIDENTITY 8
    485 #define BCP6xFILEFMT 9
    486 #define BCPHINTSA 10
    487 #define BCPHINTSW 11
    488 #define BCPFILECP 12
    489 #define BCPUNICODEFILE 13
    490 #define BCPTEXTFILE 14
    491 #define BCPFILEFMT 15
    492 
    493 #define BCPFILECP_ACP 0
    494 #define BCPFILECP_OEMCP 1
    495 #define BCPFILECP_RAW (-1)
    496 
    497 #define SQL_VARLEN_DATA (-10)
    498 
    499   DBINT SQL_API bcp_batch(HDBC);
    500   RETCODE SQL_API bcp_bind(HDBC,LPCBYTE,INT,DBINT,LPCBYTE,INT,INT,INT);
    501   RETCODE SQL_API bcp_colfmt(HDBC,INT,BYTE,INT,DBINT,LPCBYTE,INT,INT);
    502   RETCODE SQL_API bcp_collen(HDBC,DBINT,INT);
    503   RETCODE SQL_API bcp_colptr(HDBC,LPCBYTE,INT);
    504   RETCODE SQL_API bcp_columns(HDBC,INT);
    505   RETCODE SQL_API bcp_control(HDBC,INT,void *);
    506   DBINT SQL_API bcp_done(HDBC);
    507   RETCODE SQL_API bcp_exec(HDBC,LPDBINT);
    508   RETCODE SQL_API bcp_getcolfmt(HDBC,INT,INT,void *,INT,INT *);
    509   RETCODE SQL_API bcp_initA(HDBC,LPCSTR,LPCSTR,LPCSTR,INT);
    510   RETCODE SQL_API bcp_initW(HDBC,LPCWSTR,LPCWSTR,LPCWSTR,INT);
    511   RETCODE SQL_API bcp_moretext(HDBC,DBINT,LPCBYTE);
    512   RETCODE SQL_API bcp_readfmtA(HDBC,LPCSTR);
    513   RETCODE SQL_API bcp_readfmtW(HDBC,LPCWSTR);
    514   RETCODE SQL_API bcp_sendrow(HDBC);
    515   RETCODE SQL_API bcp_setcolfmt(HDBC,INT,INT,void *,INT);
    516   RETCODE SQL_API bcp_writefmtA(HDBC,LPCSTR);
    517   RETCODE SQL_API bcp_writefmtW(HDBC,LPCWSTR);
    518   CHAR *SQL_API dbprtypeA(INT);
    519   WCHAR *SQL_API dbprtypeW(INT);
    520 
    521 #define bcp_init __MINGW_NAME_AW(bcp_init)
    522 #define bcp_readfmt __MINGW_NAME_AW(bcp_readfmt)
    523 #define bcp_writefmt __MINGW_NAME_AW(bcp_writefmt)
    524 #define dbprtype __MINGW_NAME_AW(dbprtype)
    525 #define BCPHINTS __MINGW_NAME_AW(BCPHINTS)
    526 
    527   SQLRETURN SQL_API SQLLinkedServers(SQLHSTMT);
    528   SQLRETURN SQL_API SQLLinkedCatalogsA(SQLHSTMT,LPCSTR,SWORD);
    529   SQLRETURN SQL_API SQLLinkedCatalogsW(SQLHSTMT,LPCWSTR,SWORD);
    530   HANDLE SQL_API SQLInitEnumServers(WCHAR *pwchServerName,WCHAR *pwchInstanceName);
    531   RETCODE SQL_API SQLGetNextEnumeration(HANDLE hEnumHandle,BYTE *prgEnumData,INT *piEnumLength);
    532   RETCODE SQL_API SQLCloseEnumServers(HANDLE hEnumHandle);
    533 
    534 #define SQLLinkedCatalogs __MINGW_NAME_AW(SQLLinkedCatalogs)
    535 
    536 #define BCP_FMT_TYPE 0x01
    537 #define BCP_FMT_INDICATOR_LEN 0x02
    538 #define BCP_FMT_DATA_LEN 0x03
    539 #define BCP_FMT_TERMINATOR 0x04
    540 #define BCP_FMT_SERVER_COL 0x05
    541 #define BCP_FMT_COLLATION 0x06
    542 #define BCP_FMT_COLLATION_ID 0x07
    543 
    544 #define SQL_FAST_CONNECT (SQL_COPT_SS_BASE+0)
    545 
    546 #define SQL_FC_OFF __MSABI_LONG(0)
    547 #define SQL_FC_ON __MSABI_LONG(1)
    548 #define SQL_FC_DEFAULT SQL_FC_OFF
    549 #define SQL_COPT_SS_ANSI_OEM (SQL_COPT_SS_BASE+6)
    550 #define SQL_AO_OFF __MSABI_LONG(0)
    551 #define SQL_AO_ON __MSABI_LONG(1)
    552 #define SQL_AO_DEFAULT SQL_AO_OFF
    553 
    554 #define SQL_REMOTE_PWD SQL_COPT_SS_REMOTE_PWD
    555 #define SQL_USE_PROCEDURE_FOR_PREPARE SQL_COPT_SS_USE_PROC_FOR_PREP
    556 #define SQL_INTEGRATED_SECURITY SQL_COPT_SS_INTEGRATED_SECURITY
    557 #define SQL_PRESERVE_CURSORS SQL_COPT_SS_PRESERVE_CURSORS
    558 #define SQL_TEXTPTR_LOGGING SQL_SOPT_SS_TEXTPTR_LOGGING
    559 #define SQL_CA_SS_BASE_COLUMN_NAME SQL_DESC_BASE_COLUMN_NAME
    560 #define SQLDECIMALN 0x6a
    561 #define SQLNUMERICN 0x6c
    562 
    563 #ifdef __cplusplus
    564 }
    565 #endif
    566 #endif
    567