Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

682 lines
27 KiB

  1. /*
  2. ** ODBCSS.H - This is the application include file for the
  3. ** SQL Server driver specific defines.
  4. **
  5. ** (C) Copyright 1993-1998 By Microsoft Corp.
  6. **
  7. */
  8. #ifndef __ODBCSS
  9. #define __ODBCSS
  10. #ifdef __cplusplus
  11. extern "C" { /* Assume C declarations for C++ */
  12. #endif /* __cplusplus */
  13. // Useful defines
  14. #define SQL_MAX_SQLSERVERNAME 128 // max SQL Server identifier length
  15. // SQLSetConnectOption/SQLSetStmtOption driver specific defines.
  16. // Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server driver usage.
  17. // Connection Options
  18. #define SQL_COPT_SS_BASE 1200
  19. #define SQL_COPT_SS_REMOTE_PWD (SQL_COPT_SS_BASE+1) // dbrpwset SQLSetConnectOption only
  20. #define SQL_COPT_SS_USE_PROC_FOR_PREP (SQL_COPT_SS_BASE+2) // Use create proc for SQLPrepare
  21. #define SQL_COPT_SS_INTEGRATED_SECURITY (SQL_COPT_SS_BASE+3) // Force integrated security on login
  22. #define SQL_COPT_SS_PRESERVE_CURSORS (SQL_COPT_SS_BASE+4) // Preserve server cursors after SQLTransact
  23. #define SQL_COPT_SS_USER_DATA (SQL_COPT_SS_BASE+5) // dbgetuserdata/dbsetuserdata
  24. #define SQL_COPT_SS_ENLIST_IN_DTC SQL_ATTR_ENLIST_IN_DTC // Enlist in a DTC transaction
  25. #define SQL_COPT_SS_ENLIST_IN_XA SQL_ATTR_ENLIST_IN_XA // Enlist in a XA transaction
  26. #define SQL_COPT_SS_CONNECTION_DEAD SQL_ATTR_CONNECTION_DEAD // dbdead SQLGetConnectOption only
  27. #define SQL_COPT_SS_FALLBACK_CONNECT (SQL_COPT_SS_BASE+10) // Enables FallBack connections
  28. #define SQL_COPT_SS_PERF_DATA (SQL_COPT_SS_BASE+11) // Used to access SQL Server ODBC driver performance data
  29. #define SQL_COPT_SS_PERF_DATA_LOG (SQL_COPT_SS_BASE+12) // Used to set the logfile name for the Performance data
  30. #define SQL_COPT_SS_PERF_QUERY_INTERVAL (SQL_COPT_SS_BASE+13) // Used to set the query logging threshold in milliseconds.
  31. #define SQL_COPT_SS_PERF_QUERY_LOG (SQL_COPT_SS_BASE+14) // Used to set the logfile name for saving queryies.
  32. #define SQL_COPT_SS_PERF_QUERY (SQL_COPT_SS_BASE+15) // Used to start and stop query logging.
  33. #define SQL_COPT_SS_PERF_DATA_LOG_NOW (SQL_COPT_SS_BASE+16) // Used to make a statistics log entry to disk.
  34. #define SQL_COPT_SS_QUOTED_IDENT (SQL_COPT_SS_BASE+17) // Enable/Disable Quoted Identifiers
  35. #define SQL_COPT_SS_ANSI_NPW (SQL_COPT_SS_BASE+18) // Enable/Disable ANSI NULL, Padding and Warnings
  36. #define SQL_COPT_SS_BCP (SQL_COPT_SS_BASE+19) // Allow BCP usage on connection
  37. #define SQL_COPT_SS_TRANSLATE (SQL_COPT_SS_BASE+20) // Perform code page translation
  38. #define SQL_COPT_SS_ATTACHDBFILENAME (SQL_COPT_SS_BASE+21) // File name to be attached as a database
  39. #define SQL_COPT_SS_CONCAT_NULL (SQL_COPT_SS_BASE+22) // Enable/Disable CONCAT_NULL_YIELDS_NULL
  40. #define SQL_COPT_SS_ENCRYPT (SQL_COPT_SS_BASE+23) // Allow strong encryption for data
  41. #define SQL_COPT_SS_MAX_USED SQL_COPT_SS_ENCRYPT
  42. // Statement Options
  43. #define SQL_SOPT_SS_BASE 1225
  44. #define SQL_SOPT_SS_TEXTPTR_LOGGING (SQL_SOPT_SS_BASE+0) // Text pointer logging
  45. #define SQL_SOPT_SS_CURRENT_COMMAND (SQL_SOPT_SS_BASE+1) // dbcurcmd SQLGetStmtOption only
  46. #define SQL_SOPT_SS_HIDDEN_COLUMNS (SQL_SOPT_SS_BASE+2) // Expose FOR BROWSE hidden columns
  47. #define SQL_SOPT_SS_NOBROWSETABLE (SQL_SOPT_SS_BASE+3) // Set NOBROWSETABLE option
  48. #define SQL_SOPT_SS_REGIONALIZE (SQL_SOPT_SS_BASE+4) // Regionalize output character conversions
  49. #define SQL_SOPT_SS_CURSOR_OPTIONS (SQL_SOPT_SS_BASE+5) // Server cursor options
  50. #define SQL_SOPT_SS_NOCOUNT_STATUS (SQL_SOPT_SS_BASE+6) // Real vs. Not Real row count indicator
  51. #define SQL_SOPT_SS_DEFER_PREPARE (SQL_SOPT_SS_BASE+7) // Defer prepare until necessary
  52. #define SQL_SOPT_SS_MAX_USED SQL_SOPT_SS_DEFER_PREPARE
  53. #define SQL_COPT_SS_BASE_EX 1240
  54. #define SQL_COPT_SS_BROWSE_CONNECT (SQL_COPT_SS_BASE_EX+1) // Browse connect mode of operation
  55. #define SQL_COPT_SS_BROWSE_SERVER (SQL_COPT_SS_BASE_EX+2) // Single Server browse request.
  56. #define SQL_COPT_SS_WARN_ON_CP_ERROR (SQL_COPT_SS_BASE_EX+3) // Issues warning when data from the server
  57. // had a loss during code page conversion.
  58. #define SQL_COPT_SS_EX_MAX_USED SQL_COPT_SS_WARN_ON_CP_ERROR
  59. // Defines for use with SQL_COPT_SS_USE_PROC_FOR_PREP
  60. #define SQL_UP_OFF 0L // Procedures won't be used for prepare
  61. #define SQL_UP_ON 1L // Procedures will be used for prepare
  62. #define SQL_UP_ON_DROP 2L // Temp procedures will be explicitly dropped
  63. #define SQL_UP_DEFAULT SQL_UP_ON
  64. // Defines for use with SQL_COPT_SS_INTEGRATED_SECURITY - Pre-Connect Option only
  65. #define SQL_IS_OFF 0L // Integrated security isn't used
  66. #define SQL_IS_ON 1L // Integrated security is used
  67. #define SQL_IS_DEFAULT SQL_IS_OFF
  68. // Defines for use with SQL_COPT_SS_PRESERVE_CURSORS
  69. #define SQL_PC_OFF 0L // Cursors are closed on SQLTransact
  70. #define SQL_PC_ON 1L // Cursors remain open on SQLTransact
  71. #define SQL_PC_DEFAULT SQL_PC_OFF
  72. // Defines for use with SQL_COPT_SS_USER_DATA
  73. #define SQL_UD_NOTSET NULL // No user data pointer set
  74. // Defines for use with SQL_COPT_SS_TRANSLATE
  75. #define SQL_XL_OFF 0L // Code page translation is not performed
  76. #define SQL_XL_ON 1L // Code page translation is performed
  77. #define SQL_XL_DEFAULT SQL_XL_ON
  78. // Defines for use with SQL_COPT_SS_FALLBACK_CONNECT - Pre-Connect Option only
  79. #define SQL_FB_OFF 0L // FallBack connections are disabled
  80. #define SQL_FB_ON 1L // FallBack connections are enabled
  81. #define SQL_FB_DEFAULT SQL_FB_OFF
  82. // Defines for use with SQL_COPT_SS_BCP - Pre-Connect Option only
  83. #define SQL_BCP_OFF 0L // BCP is not allowed on connection
  84. #define SQL_BCP_ON 1L // BCP is allowed on connection
  85. #define SQL_BCP_DEFAULT SQL_BCP_OFF
  86. // Defines for use with SQL_COPT_SS_QUOTED_IDENT
  87. #define SQL_QI_OFF 0L // Quoted identifiers are enable
  88. #define SQL_QI_ON 1L // Quoted identifiers are disabled
  89. #define SQL_QI_DEFAULT SQL_QI_ON
  90. // Defines for use with SQL_COPT_SS_ANSI_NPW - Pre-Connect Option only
  91. #define SQL_AD_OFF 0L // ANSI NULLs, Padding and Warnings are enabled
  92. #define SQL_AD_ON 1L // ANSI NULLs, Padding and Warnings are disabled
  93. #define SQL_AD_DEFAULT SQL_AD_ON
  94. // Defines for use with SQL_COPT_SS_CONCAT_NULL - Pre-Connect Option only
  95. #define SQL_CN_OFF 0L // CONCAT_NULL_YIELDS_NULL is off
  96. #define SQL_CN_ON 1L // CONCAT_NULL_YIELDS_NULL is on
  97. #define SQL_CN_DEFAULT SQL_CN_ON
  98. // Defines for use with SQL_SOPT_SS_TEXTPTR_LOGGING
  99. #define SQL_TL_OFF 0L // No logging on text pointer ops
  100. #define SQL_TL_ON 1L // Logging occurs on text pointer ops
  101. #define SQL_TL_DEFAULT SQL_TL_ON
  102. // Defines for use with SQL_SOPT_SS_HIDDEN_COLUMNS
  103. #define SQL_HC_OFF 0L // FOR BROWSE columns are hidden
  104. #define SQL_HC_ON 1L // FOR BROWSE columns are exposed
  105. #define SQL_HC_DEFAULT SQL_HC_OFF
  106. // Defines for use with SQL_SOPT_SS_NOBROWSETABLE
  107. #define SQL_NB_OFF 0L // NO_BROWSETABLE is off
  108. #define SQL_NB_ON 1L // NO_BROWSETABLE is on
  109. #define SQL_NB_DEFAULT SQL_NB_OFF
  110. // Defines for use with SQL_SOPT_SS_REGIONALIZE
  111. #define SQL_RE_OFF 0L // No regionalization occurs on output character conversions
  112. #define SQL_RE_ON 1L // Regionalization occurs on output character conversions
  113. #define SQL_RE_DEFAULT SQL_RE_OFF
  114. // Defines for use with SQL_SOPT_SS_CURSOR_OPTIONS
  115. #define SQL_CO_OFF 0L // Clear all cursor options
  116. #define SQL_CO_FFO 1L // Fast-forward cursor will be used
  117. #define SQL_CO_AF 2L // Autofetch on cursor open
  118. #define SQL_CO_FFO_AF (SQL_CO_FFO|SQL_CO_AF) // Fast-forward cursor with autofetch
  119. #define SQL_CO_FIREHOSE_AF 4L // Auto fetch on fire-hose cursors
  120. #define SQL_CO_DEFAULT SQL_CO_OFF
  121. //SQL_SOPT_SS_NOCOUNT_STATUS
  122. #define SQL_NC_OFF 0L
  123. #define SQL_NC_ON 1L
  124. //SQL_SOPT_SS_DEFER_PREPARE
  125. #define SQL_DP_OFF 0L
  126. #define SQL_DP_ON 1L
  127. //SQL_COPT_SS_ENCRYPT
  128. #define SQL_EN_OFF 0L
  129. #define SQL_EN_ON 1L
  130. //SQL_COPT_SS_BROWSE_CONNECT
  131. #define SQL_MORE_INFO_NO 0L
  132. #define SQL_MORE_INFO_YES 1L
  133. //SQL_COPT_SS_WARN_ON_CP_ERROR
  134. #define SQL_WARN_NO 0L
  135. #define SQL_WARN_YES 1L
  136. // Defines returned by SQL_ATTR_CURSOR_TYPE/SQL_CURSOR_TYPE
  137. #define SQL_CURSOR_FAST_FORWARD_ONLY 8 // Only returned by SQLGetStmtAttr/Option
  138. // SQLColAttributes driver specific defines.
  139. // SQLSet/GetDescField driver specific defines.
  140. // Microsoft has 1200 thru 1249 reserved for Microsoft SQL Server driver usage.
  141. #define SQL_CA_SS_BASE 1200
  142. #define SQL_CA_SS_COLUMN_SSTYPE (SQL_CA_SS_BASE+0) // dbcoltype/dbalttype
  143. #define SQL_CA_SS_COLUMN_UTYPE (SQL_CA_SS_BASE+1) // dbcolutype/dbaltutype
  144. #define SQL_CA_SS_NUM_ORDERS (SQL_CA_SS_BASE+2) // dbnumorders
  145. #define SQL_CA_SS_COLUMN_ORDER (SQL_CA_SS_BASE+3) // dbordercol
  146. #define SQL_CA_SS_COLUMN_VARYLEN (SQL_CA_SS_BASE+4) // dbvarylen
  147. #define SQL_CA_SS_NUM_COMPUTES (SQL_CA_SS_BASE+5) // dbnumcompute
  148. #define SQL_CA_SS_COMPUTE_ID (SQL_CA_SS_BASE+6) // dbnextrow status return
  149. #define SQL_CA_SS_COMPUTE_BYLIST (SQL_CA_SS_BASE+7) // dbbylist
  150. #define SQL_CA_SS_COLUMN_ID (SQL_CA_SS_BASE+8) // dbaltcolid
  151. #define SQL_CA_SS_COLUMN_OP (SQL_CA_SS_BASE+9) // dbaltop
  152. #define SQL_CA_SS_COLUMN_SIZE (SQL_CA_SS_BASE+10) // dbcollen
  153. #define SQL_CA_SS_COLUMN_HIDDEN (SQL_CA_SS_BASE+11) // Column is hidden (FOR BROWSE)
  154. #define SQL_CA_SS_COLUMN_KEY (SQL_CA_SS_BASE+12) // Column is key column (FOR BROWSE)
  155. //#define SQL_DESC_BASE_COLUMN_NAME_OLD (SQL_CA_SS_BASE+13) //This is defined at another location.
  156. #define SQL_CA_SS_COLUMN_COLLATION (SQL_CA_SS_BASE+14) // Column collation (only for chars)
  157. #define SQL_CA_SS_VARIANT_TYPE (SQL_CA_SS_BASE+15)
  158. #define SQL_CA_SS_VARIANT_SQL_TYPE (SQL_CA_SS_BASE+16)
  159. #define SQL_CA_SS_VARIANT_SERVER_TYPE (SQL_CA_SS_BASE+17)
  160. #define SQL_CA_SS_MAX_USED (SQL_CA_SS_BASE+18)
  161. // SQL Server Data Type Tokens.
  162. // New types for 6.0 and later servers
  163. /* SQL Server Data Type Tokens. */
  164. #define SQLTEXT 0x23
  165. #define SQLVARBINARY 0x25
  166. #define SQLINTN 0x26
  167. #define SQLVARCHAR 0x27
  168. #define SQLBINARY 0x2d
  169. #define SQLIMAGE 0x22
  170. #define SQLCHARACTER 0x2f
  171. #define SQLINT1 0x30
  172. #define SQLBIT 0x32
  173. #define SQLINT2 0x34
  174. #define SQLINT4 0x38
  175. #define SQLMONEY 0x3c
  176. #define SQLDATETIME 0x3d
  177. #define SQLFLT8 0x3e
  178. #define SQLFLTN 0x6d
  179. #define SQLMONEYN 0x6e
  180. #define SQLDATETIMN 0x6f
  181. #define SQLFLT4 0x3b
  182. #define SQLMONEY4 0x7a
  183. #define SQLDATETIM4 0x3a
  184. // New types for 6.0 and later servers
  185. #define SQLDECIMAL 0x6a
  186. #define SQLNUMERIC 0x6c
  187. // New types for 7.0 and later servers
  188. #define SQLUNIQUEID 0x24
  189. #define SQLBIGCHAR 0xaf
  190. #define SQLBIGVARCHAR 0xa7
  191. #define SQLBIGBINARY 0xad
  192. #define SQLBIGVARBINARY 0xa5
  193. #define SQLBITN 0x68
  194. #define SQLNCHAR 0xef
  195. #define SQLNVARCHAR 0xe7
  196. #define SQLNTEXT 0x63
  197. // New for 7.x
  198. #define SQLINT8 0x7f
  199. #define SQLVARIANT 0x62
  200. // User Data Type definitions.
  201. // Returned by SQLColAttributes/SQL_CA_SS_COLUMN_UTYPE.
  202. #define SQLudtBINARY 3
  203. #define SQLudtBIT 16
  204. #define SQLudtBITN 0
  205. #define SQLudtCHAR 1
  206. #define SQLudtDATETIM4 22
  207. #define SQLudtDATETIME 12
  208. #define SQLudtDATETIMN 15
  209. #define SQLudtDECML 24
  210. #define SQLudtDECMLN 26
  211. #define SQLudtFLT4 23
  212. #define SQLudtFLT8 8
  213. #define SQLudtFLTN 14
  214. #define SQLudtIMAGE 20
  215. #define SQLudtINT1 5
  216. #define SQLudtINT2 6
  217. #define SQLudtINT4 7
  218. #define SQLudtINTN 13
  219. #define SQLudtMONEY 11
  220. #define SQLudtMONEY4 21
  221. #define SQLudtMONEYN 17
  222. #define SQLudtNUM 10
  223. #define SQLudtNUMN 25
  224. #define SQLudtSYSNAME 18
  225. #define SQLudtTEXT 19
  226. #define SQLudtTIMESTAMP 80
  227. #define SQLudtUNIQUEIDENTIFIER 0
  228. #define SQLudtVARBINARY 4
  229. #define SQLudtVARCHAR 2
  230. #define MIN_USER_DATATYPE 256
  231. // Aggregate operator types.
  232. // Returned by SQLColAttributes/SQL_CA_SS_COLUMN_OP.
  233. #define SQLAOPSTDEV 0x30 // Standard deviation
  234. #define SQLAOPSTDEVP 0x31 // Standard deviation population
  235. #define SQLAOPVAR 0x32 // Variance
  236. #define SQLAOPVARP 0x33 // Variance population
  237. #define SQLAOPCNT 0x4b // Count
  238. #define SQLAOPSUM 0x4d // Sum
  239. #define SQLAOPAVG 0x4f // Average
  240. #define SQLAOPMIN 0x51 // Min
  241. #define SQLAOPMAX 0x52 // Max
  242. #define SQLAOPANY 0x53 // Any
  243. #define SQLAOPNOOP 0x56 // None
  244. // SQLGetInfo driver specific defines.
  245. // Microsoft has 1151 thru 1200 reserved for Microsoft SQL Server driver usage.
  246. #define SQL_INFO_SS_FIRST 1199
  247. #define SQL_INFO_SS_NETLIB_NAMEW (SQL_INFO_SS_FIRST+0) // dbprocinfo
  248. #define SQL_INFO_SS_NETLIB_NAMEA (SQL_INFO_SS_FIRST+1) // dbprocinfo
  249. #define SQL_INFO_SS_MAX_USED SQL_INFO_SS_NETLIB_NAMEA
  250. #ifdef UNICODE
  251. #define SQL_INFO_SS_NETLIB_NAME SQL_INFO_SS_NETLIB_NAMEW
  252. #else
  253. #define SQL_INFO_SS_NETLIB_NAME SQL_INFO_SS_NETLIB_NAMEA
  254. #endif
  255. // Driver specific SQL type defines.
  256. // Microsoft has -150 thru -199 reserved for Microsoft SQL Server driver usage.
  257. #define SQL_SS_VARIANT -150
  258. // SQLGetDiagField driver specific defines.
  259. // Microsoft has -1150 thru -1199 reserved for Microsoft SQL Server driver usage.
  260. #define SQL_DIAG_SS_BASE (-1150)
  261. #define SQL_DIAG_SS_MSGSTATE (SQL_DIAG_SS_BASE)
  262. #define SQL_DIAG_SS_SEVERITY (SQL_DIAG_SS_BASE-1)
  263. #define SQL_DIAG_SS_SRVNAME (SQL_DIAG_SS_BASE-2)
  264. #define SQL_DIAG_SS_PROCNAME (SQL_DIAG_SS_BASE-3)
  265. #define SQL_DIAG_SS_LINE (SQL_DIAG_SS_BASE-4)
  266. // SQLGetDiagField/SQL_DIAG_DYNAMIC_FUNCTION_CODE driver specific defines.
  267. // Microsoft has -200 thru -299 reserved for Microsoft SQL Server driver usage.
  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. // Severity codes for SQL_DIAG_SS_SEVERITY
  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. // Internal server datatypes - used when binding to SQL_C_BINARY
  347. #ifndef MAXNUMERICLEN // Resolve ODS/DBLib conflicts
  348. // DB-Library datatypes
  349. #define DBMAXCHAR (8000+1) // Max length of DBVARBINARY and DBVARCHAR, etc. +1 for zero byte
  350. #define MAXNAME (SQL_MAX_SQLSERVERNAME+1) // Max server identifier length including zero byte
  351. #ifdef UNICODE
  352. typedef wchar_t DBCHAR;
  353. #else
  354. typedef char DBCHAR;
  355. #endif
  356. typedef unsigned char DBBINARY;
  357. typedef unsigned char DBTINYINT;
  358. typedef short DBSMALLINT;
  359. typedef unsigned short DBUSMALLINT;
  360. typedef double DBFLT8;
  361. typedef unsigned char DBBIT;
  362. typedef unsigned char DBBOOL;
  363. typedef float DBFLT4;
  364. typedef DBFLT4 DBREAL;
  365. typedef UINT DBUBOOL;
  366. typedef struct dbvarychar
  367. {
  368. DBSMALLINT len;
  369. DBCHAR str[DBMAXCHAR];
  370. } DBVARYCHAR;
  371. typedef struct dbvarybin
  372. {
  373. DBSMALLINT len;
  374. BYTE array[DBMAXCHAR];
  375. } DBVARYBIN;
  376. typedef struct dbmoney
  377. { // Internal representation of MONEY data type
  378. LONG mnyhigh; // Money value *10,000 (High 32 bits/signed)
  379. ULONG mnylow; // Money value *10,000 (Low 32 bits/unsigned)
  380. } DBMONEY;
  381. typedef struct dbdatetime
  382. { // Internal representation of DATETIME data type
  383. LONG dtdays; // No of days since Jan-1-1900 (maybe negative)
  384. ULONG dttime; // No. of 300 hundredths of a second since midnight
  385. } DBDATETIME;
  386. typedef struct dbdatetime4
  387. { // Internal representation of SMALLDATETIME data type
  388. USHORT numdays; // No of days since Jan-1-1900
  389. USHORT nummins; // No. of minutes since midnight
  390. } DBDATETIM4;
  391. typedef LONG DBMONEY4; // Internal representation of SMALLMONEY data type
  392. // Money value *10,000
  393. #define DBNUM_PREC_TYPE BYTE
  394. #define DBNUM_SCALE_TYPE BYTE
  395. #define DBNUM_VAL_TYPE BYTE
  396. #if (ODBCVER < 0x0300)
  397. #define MAXNUMERICLEN 16
  398. typedef struct dbnumeric
  399. { // Internal representation of NUMERIC data type
  400. DBNUM_PREC_TYPE precision; // Precision
  401. DBNUM_SCALE_TYPE scale; // Scale
  402. BYTE sign; // Sign (1 if positive, 0 if negative)
  403. DBNUM_VAL_TYPE val[MAXNUMERICLEN]; // Value
  404. } DBNUMERIC;
  405. typedef DBNUMERIC DBDECIMAL;// Internal representation of DECIMAL data type
  406. #else // Use ODBC 3.0 definitions since same as DBLib
  407. #define MAXNUMERICLEN SQL_MAX_NUMERIC_LEN
  408. typedef SQL_NUMERIC_STRUCT DBNUMERIC;
  409. typedef SQL_NUMERIC_STRUCT DBDECIMAL;
  410. #endif
  411. #endif // MAXNUMERICLEN
  412. #ifndef INT
  413. typedef int INT;
  414. typedef long DBINT;
  415. #ifndef _LPCBYTE_DEFINED
  416. #define _LPCBYTE_DEFINED
  417. typedef const LPBYTE LPCBYTE;
  418. #endif
  419. typedef DBINT * LPDBINT;
  420. #endif
  421. /*****************************************************************
  422. This struct is a global used for
  423. gathering statistical data on the driver.
  424. Access to this structure is controlled via the
  425. pStatCrit;
  426. ******************************************************************/
  427. typedef struct sqlperf
  428. {
  429. // Application Profile Statistics
  430. DWORD TimerResolution;
  431. DWORD SQLidu;
  432. DWORD SQLiduRows;
  433. DWORD SQLSelects;
  434. DWORD SQLSelectRows;
  435. DWORD Transactions;
  436. DWORD SQLPrepares;
  437. DWORD ExecDirects;
  438. DWORD SQLExecutes;
  439. DWORD CursorOpens;
  440. DWORD CursorSize;
  441. DWORD CursorUsed;
  442. LDOUBLE PercentCursorUsed;
  443. LDOUBLE AvgFetchTime;
  444. LDOUBLE AvgCursorSize;
  445. LDOUBLE AvgCursorUsed;
  446. DWORD SQLFetchTime;
  447. DWORD SQLFetchCount;
  448. DWORD CurrentStmtCount;
  449. DWORD MaxOpenStmt;
  450. DWORD SumOpenStmt;
  451. // Connection Statistics
  452. DWORD CurrentConnectionCount;
  453. DWORD MaxConnectionsOpened;
  454. DWORD SumConnectionsOpened;
  455. DWORD SumConnectiontime;
  456. LDOUBLE AvgTimeOpened;
  457. // Network Statistics
  458. DWORD ServerRndTrips;
  459. DWORD BuffersSent;
  460. DWORD BuffersRec;
  461. DWORD BytesSent;
  462. DWORD BytesRec;
  463. // Time Statistics;
  464. DWORD msExecutionTime;
  465. DWORD msNetWorkServerTime;
  466. } SQLPERF;
  467. // The following are options for SQL_COPT_SS_PERF_DATA and SQL_COPT_SS_PERF_QUERY
  468. #define SQL_PERF_START 1 // Starts the driver sampling performance data.
  469. #define SQL_PERF_STOP 2 // Stops the counters from sampling performance data.
  470. // The following are defines for SQL_COPT_SS_PERF_DATA_LOG
  471. #define SQL_SS_DL_DEFAULT TEXT("C:\\STATS.LOG")
  472. // The following are defines for SQL_COPT_SS_PERF_QUERY_LOG
  473. #define SQL_SS_QL_DEFAULT TEXT("C:\\QUERY.LOG")
  474. // The following are defines for SQL_COPT_SS_PERF_QUERY_INTERVAL
  475. #define SQL_SS_QI_DEFAULT 30000 // 30,000 milliseconds
  476. // ODBC BCP prototypes and defines
  477. // Return codes
  478. #define SUCCEED 1
  479. #define FAIL 0
  480. #define SUCCEED_ABORT 2
  481. #define SUCCEED_ASYNC 3
  482. // Transfer directions
  483. #define DB_IN 1 // Transfer from client to server
  484. #define DB_OUT 2 // Transfer from server to client
  485. // bcp_control option
  486. #define BCPMAXERRS 1 // Sets max errors allowed
  487. #define BCPFIRST 2 // Sets first row to be copied out
  488. #define BCPLAST 3 // Sets number of rows to be copied out
  489. #define BCPBATCH 4 // Sets input batch size
  490. #define BCPKEEPNULLS 5 // Sets to insert NULLs for empty input values
  491. #define BCPABORT 6 // Sets to have bcpexec return SUCCEED_ABORT
  492. #define BCPODBC 7 // Sets ODBC canonical character output
  493. #define BCPKEEPIDENTITY 8 // Sets IDENTITY_INSERT on
  494. #define BCP6xFILEFMT 9 // DEPRECATED: Sets 6x file format on
  495. #define BCPHINTSA 10 // Sets server BCP hints (ANSI string)
  496. #define BCPHINTSW 11 // Sets server BCP hints (UNICODE string)
  497. #define BCPFILECP 12 // Sets clients code page for the file
  498. #define BCPUNICODEFILE 13 // Sets that the file contains unicode header
  499. #define BCPTEXTFILE 14 // Sets BCP mode to expect a text file and to detect Unicode or ANSI automatically
  500. #define BCPFILEFMT 15 // Sets file format version
  501. // BCPFILECP values
  502. // Any valid code page that is installed on the client can be passed plus:
  503. #define BCPFILECP_ACP 0 // Data in file is in Windows code page
  504. #define BCPFILECP_OEMCP 1 // Data in file is in OEM code page (default)
  505. #define BCPFILECP_RAW (-1)// Data in file is in Server code page (no conversion)
  506. // bcp_collen definition
  507. #define SQL_VARLEN_DATA (-10) // Use default length for column
  508. // BCP functions
  509. DBINT SQL_API bcp_batch (HDBC);
  510. RETCODE SQL_API bcp_bind (HDBC, LPCBYTE, INT, DBINT, LPCBYTE, INT, INT, INT);
  511. RETCODE SQL_API bcp_colfmt (HDBC, INT, BYTE, INT, DBINT, LPCBYTE, INT, INT);
  512. RETCODE SQL_API bcp_collen (HDBC, DBINT, INT);
  513. RETCODE SQL_API bcp_colptr (HDBC, LPCBYTE, INT);
  514. RETCODE SQL_API bcp_columns (HDBC, INT);
  515. RETCODE SQL_API bcp_control (HDBC, INT, void *);
  516. DBINT SQL_API bcp_done (HDBC);
  517. RETCODE SQL_API bcp_exec (HDBC, LPDBINT);
  518. RETCODE SQL_API bcp_getcolfmt (HDBC, INT, INT, void *, INT, INT *);
  519. RETCODE SQL_API bcp_initA (HDBC, LPCSTR, LPCSTR, LPCSTR, INT);
  520. RETCODE SQL_API bcp_initW (HDBC, LPCWSTR, LPCWSTR, LPCWSTR, INT);
  521. RETCODE SQL_API bcp_moretext (HDBC, DBINT, LPCBYTE);
  522. RETCODE SQL_API bcp_readfmtA (HDBC, LPCSTR);
  523. RETCODE SQL_API bcp_readfmtW (HDBC, LPCWSTR);
  524. RETCODE SQL_API bcp_sendrow (HDBC);
  525. RETCODE SQL_API bcp_setcolfmt (HDBC, INT, INT, void *, INT);
  526. RETCODE SQL_API bcp_writefmtA (HDBC, LPCSTR);
  527. RETCODE SQL_API bcp_writefmtW (HDBC, LPCWSTR);
  528. CHAR * SQL_API dbprtypeA (INT);
  529. WCHAR * SQL_API dbprtypeW (INT);
  530. #ifdef UNICODE
  531. #define bcp_init bcp_initW
  532. #define bcp_readfmt bcp_readfmtW
  533. #define bcp_writefmt bcp_writefmtW
  534. #define dbprtype dbprtypeW
  535. #define BCPHINTS BCPHINTSW
  536. #else
  537. #define bcp_init bcp_initA
  538. #define bcp_readfmt bcp_readfmtA
  539. #define bcp_writefmt bcp_writefmtA
  540. #define dbprtype dbprtypeA
  541. #define BCPHINTS BCPHINTSA
  542. #endif
  543. // SQL Server catalog extensions for distributed queries
  544. SQLRETURN SQL_API SQLLinkedServers (SQLHSTMT);
  545. SQLRETURN SQL_API SQLLinkedCatalogsA (SQLHSTMT, LPCSTR, SWORD);
  546. SQLRETURN SQL_API SQLLinkedCatalogsW (SQLHSTMT, LPCWSTR, SWORD);
  547. // SQL Server extensions for server enumeration
  548. HANDLE SQL_API SQLInitEnumServers (WCHAR * pwchServerName,WCHAR *pwchInstanceName);
  549. RETCODE SQL_API SQLGetNextEnumeration (HANDLE hEnumHandle,BYTE * prgEnumData,INT * piEnumLength);
  550. RETCODE SQL_API SQLCloseEnumServers (HANDLE hEnumHandle);
  551. #ifdef UNICODE
  552. #define SQLLinkedCatalogs SQLLinkedCatalogsW
  553. #else
  554. #define SQLLinkedCatalogs SQLLinkedCatalogsA
  555. #endif
  556. // BCP column format properties
  557. #define BCP_FMT_TYPE 0x01
  558. #define BCP_FMT_INDICATOR_LEN 0x02
  559. #define BCP_FMT_DATA_LEN 0x03
  560. #define BCP_FMT_TERMINATOR 0x04
  561. #define BCP_FMT_SERVER_COL 0x05
  562. #define BCP_FMT_COLLATION 0x06
  563. #define BCP_FMT_COLLATION_ID 0x07
  564. // The following options have been deprecated
  565. #define SQL_FAST_CONNECT (SQL_COPT_SS_BASE+0)
  566. // Defines for use with SQL_FAST_CONNECT - only useable before connecting
  567. #define SQL_FC_OFF 0L // Fast connect is off
  568. #define SQL_FC_ON 1L // Fast connect is on
  569. #define SQL_FC_DEFAULT SQL_FC_OFF
  570. #define SQL_COPT_SS_ANSI_OEM (SQL_COPT_SS_BASE+6)
  571. #define SQL_AO_OFF 0L
  572. #define SQL_AO_ON 1L
  573. #define SQL_AO_DEFAULT SQL_AO_OFF
  574. // Define old names
  575. #define SQL_REMOTE_PWD SQL_COPT_SS_REMOTE_PWD
  576. #define SQL_USE_PROCEDURE_FOR_PREPARE SQL_COPT_SS_USE_PROC_FOR_PREP
  577. #define SQL_INTEGRATED_SECURITY SQL_COPT_SS_INTEGRATED_SECURITY
  578. #define SQL_PRESERVE_CURSORS SQL_COPT_SS_PRESERVE_CURSORS
  579. #define SQL_TEXTPTR_LOGGING SQL_SOPT_SS_TEXTPTR_LOGGING
  580. #define SQL_CA_SS_BASE_COLUMN_NAME SQL_DESC_BASE_COLUMN_NAME
  581. #define SQLDECIMALN 0x6a
  582. #define SQLNUMERICN 0x6c
  583. #ifdef __cplusplus
  584. } /* End of extern "C" { */
  585. #endif /* __cplusplus */
  586. #endif
  587. // End of odbcss.h