infxcli.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  1. /****************************************************************************
  2. * PROPRIETARY DATA
  3. *
  4. * Licensed Materials - Property of IBM and/or HCL
  5. *
  6. * IBM Informix Client-SDK
  7. *
  8. * (c) Copyright IBM Corporation 1997, 2011. All rights reserved.
  9. * (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved.
  10. *
  11. ** INFXCLI.H - This is the the main include for IBM Informix -CLI
  12. ** applications.
  13. **
  14. ** Preconditions:
  15. ** for Windows environment:
  16. ** #include "windows.h"
  17. **
  18. *********************************************************************/
  19. #ifndef __INFXCLI_H
  20. #define __INFXCLI_H
  21. #ifdef __cplusplus
  22. extern "C" { /* Assume C declarations for C++ */
  23. #endif /* __cplusplus */
  24. /*
  25. ** include sql.h and sqlext.h
  26. */
  27. #ifdef _WINDOWS_
  28. #include "sql.h"
  29. #include "sqlext.h"
  30. #else
  31. #include <stdlib.h>
  32. #include "infxsql.h"
  33. #endif /*_WINDOWS_*/
  34. #define SQL_TXN_LAST_COMMITTED 0x00000010L
  35. #define SQL_TRANSACTION_LAST_COMMITTED SQL_TXN_LAST_COMMITTED
  36. #define SQL_TXN_TRANSACTION 0x00000020L
  37. #define SQL_TRANSACTION_TRANSACTION SQL_TXN_TRANSACTION
  38. /* For extended errors */
  39. #define SQL_DIAG_ISAM_ERROR 13
  40. #define SQL_DIAG_XA_ERROR 14
  41. /* START -- Q+E Software's SQLSetStmtOption extensions (1040 to 1139) */
  42. /* defines here for backwards compatibility */
  43. #define SQL_STMTOPT_START 1040
  44. /* Get the rowid for the last row inserted */
  45. #define SQL_GET_ROWID (SQL_STMTOPT_START+8)
  46. /* Get the value for the serial column in the last row inserted */
  47. #define SQL_GET_SERIAL_VALUE (SQL_STMTOPT_START+9)
  48. /* END -- Q+E Software's SQLSetStmtOption extensions (1040 to 1139) */
  49. /*
  50. ** Informix extensions
  51. */
  52. /* Informix Column Attributes Flags Definitions */
  53. #define FDNULLABLE 0x0001 /* null allowed in field */
  54. #define FDDISTINCT 0x0002 /* distinct of all */
  55. #define FDDISTLVARCHAR 0x0004 /* distinct of SQLLVARCHAR */
  56. #define FDDISTBOOLEAN 0x0008 /* distinct of SQLBOOL */
  57. #define FDDISTSIMP 0x0010 /* distinct of simple type */
  58. #define FDCSTTYPE 0x0020 /* constructor type */
  59. #define FDNAMED 0x0040 /* named row type */
  60. #define ISNULLABLE( flags ) ( flags & FDNULLABLE ? 1 : 0)
  61. #define ISDISTINCT( flags ) ( flags & FDDISTINCT ? 1 : 0)
  62. /* Informix Type Estensions */
  63. #define SQL_INFX_UDT_FIXED -100
  64. #define SQL_INFX_UDT_VARYING -101
  65. #define SQL_INFX_UDT_BLOB -102
  66. #define SQL_INFX_UDT_CLOB -103
  67. #define SQL_INFX_UDT_LVARCHAR -104
  68. #define SQL_INFX_RC_ROW -105
  69. #define SQL_INFX_RC_COLLECTION -106
  70. #define SQL_INFX_RC_LIST -107
  71. #define SQL_INFX_RC_SET -108
  72. #define SQL_INFX_RC_MULTISET -109
  73. #define SQL_INFX_UNSUPPORTED -110
  74. #define SQL_INFX_C_SMARTLOB_LOCATOR -111
  75. #define SQL_INFX_QUALIFIER -112
  76. #define SQL_INFX_DECIMAL -113
  77. #define SQL_INFX_BIGINT -114
  78. typedef __int64 SQLINFX_BIGINT;
  79. typedef void * HINFX_RC; /* row & collection handle */
  80. /* Informix Connect Attributes Extensions */
  81. #define SQL_OPT_LONGID 2251
  82. #define SQL_INFX_ATTR_LONGID SQL_OPT_LONGID
  83. #define SQL_INFX_ATTR_LEAVE_TRAILING_SPACES 2252
  84. #define SQL_INFX_ATTR_DEFAULT_UDT_FETCH_TYPE 2253
  85. #define SQL_INFX_ATTR_ENABLE_SCROLL_CURSORS 2254
  86. #define SQL_ENABLE_INSERT_CURSOR 2255
  87. #define SQL_INFX_ATTR_ENABLE_INSERT_CURSORS SQL_ENABLE_INSERT_CURSOR
  88. #define SQL_INFX_ATTR_OPTIMIZE_AUTOCOMMIT 2256
  89. #define SQL_INFX_ATTR_ODBC_TYPES_ONLY 2257
  90. #define SQL_INFX_ATTR_FETCH_BUFFER_SIZE 2258
  91. #define SQL_INFX_ATTR_OPTOFC 2259
  92. #define SQL_INFX_ATTR_OPTMSG 2260
  93. #define SQL_INFX_ATTR_REPORT_KEYSET_CURSORS 2261
  94. #define SQL_INFX_ATTR_LO_AUTOMATIC 2262
  95. #define SQL_INFX_ATTR_AUTO_FREE 2263
  96. #define SQL_INFX_ATTR_DEFERRED_PREPARE 2265
  97. #define SQL_INFX_ATTR_PAM_FUNCTION 2266 /* void pamCallback
  98. (int msgStyle,
  99. void *responseBuf,
  100. int responseBufLen,
  101. int *responseLenPtr,
  102. void *challengeBuf,
  103. int challengeBufLen,
  104. int *challengeLenPtr) */
  105. #define SQL_INFX_ATTR_PAM_RESPONSE_BUF 2267 /* SQLPOINTER */
  106. #define SQL_INFX_ATTR_PAM_RESPONSE_BUF_LEN 2268 /* SQLINTEGER */
  107. #define SQL_INFX_ATTR_PAM_RESPONSE_LEN_PTR 2269 /* SQLPOINTER */
  108. #define SQL_INFX_ATTR_PAM_CHALLENGE_BUF 2270 /* SQLPOINTER */
  109. #define SQL_INFX_ATTR_PAM_CHALLENGE_BUF_LEN 2271 /* SQLINTEGER */
  110. #define SQL_INFX_ATTR_PAM_CHALLENGE_LEN_PTR 2272 /* SQLINTEGER * - number of bytes in challenge */
  111. #define SQL_INFX_ATTR_DELIMIDENT 2273 /* As of now this attribute is only being used
  112. in .NET Provider since it is sitting on top
  113. of ODBC.*/
  114. #define SQL_INFX_ATTR_DBLOCALE 2275
  115. #define SQL_INFX_ATTR_LOCALIZE_DECIMALS 2276
  116. #define SQL_INFX_ATTR_DEFAULT_DECIMAL 2277
  117. #define SQL_INFX_ATTR_SKIP_PARSING 2278
  118. #define SQL_INFX_ATTR_CALL_FROM_DOTNET 2279
  119. #define SQL_INFX_ATTR_LENGTHINCHARFORDIAGRECW 2280
  120. #define SQL_INFX_ATTR_SENDTIMEOUT 2281
  121. #define SQL_INFX_ATTR_RECVTIMEOUT 2282
  122. #define SQL_INFX_ATTR_IDSISAMERRMSG 2283
  123. /*Attributes same as cli*/
  124. #define SQL_ATTR_USE_TRUSTED_CONTEXT 2561
  125. /* Informix Descriptor Extensions */
  126. #define SQL_INFX_ATTR_FLAGS 1900 /* UDWORD */
  127. #define SQL_INFX_ATTR_EXTENDED_TYPE_CODE 1901 /* UDWORD */
  128. #define SQL_INFX_ATTR_EXTENDED_TYPE_NAME 1902 /* UCHAR ptr */
  129. #define SQL_INFX_ATTR_EXTENDED_TYPE_OWNER 1903 /* UCHAR ptr */
  130. #define SQL_INFX_ATTR_EXTENDED_TYPE_ALIGNMENT 1904 /* UDWORD */
  131. #define SQL_INFX_ATTR_SOURCE_TYPE_CODE 1905 /* UDWORD */
  132. /* Informix Statement Attributes Extensions */
  133. #define SQL_VMB_CHAR_LEN 2325
  134. #define SQL_INFX_ATTR_VMB_CHAR_LEN SQL_VMB_CHAR_LEN
  135. #define SQL_INFX_ATTR_MAX_FET_ARR_SIZE 2326
  136. /* Informix fOption, SQL_VMB_CHAR_LEN vParam */
  137. #define SQL_VMB_CHAR_EXACT 0
  138. #define SQL_VMB_CHAR_ESTIMATE 1
  139. /* Informix row/collection traversal constants */
  140. #define SQL_INFX_RC_NEXT 1
  141. #define SQL_INFX_RC_PRIOR 2
  142. #define SQL_INFX_RC_FIRST 3
  143. #define SQL_INFX_RC_LAST 4
  144. #define SQL_INFX_RC_ABSOLUTE 5
  145. #define SQL_INFX_RC_RELATIVE 6
  146. #define SQL_INFX_RC_CURRENT 7
  147. /*******************************************************************************
  148. * Large Object (LO) related structures
  149. *
  150. * LO_SPEC: Large object spec structure
  151. * It is used for creating smartblobs. The user may examin and/or set certain
  152. * fields of LO_SPEC by using ifx_lo_spec[set|get]_* accessor functions.
  153. *
  154. * LO_PTR: Large object pointer structure
  155. * Identifies the LO and provides ancillary, security-related information.
  156. *
  157. * LO_STAT: Large object stat structure
  158. * It is used in querying attribtes of smartblobs. The user may examin fields
  159. * herein by using ifx_lo_stat[set|get]_* accessor functions.
  160. *
  161. * These structures are opaque to the user. Accessor functions are provided
  162. * for these structures.
  163. ******************************************************************************/
  164. /* Informix GetInfo Extensions to obtain length of LO related structures */
  165. #define SQL_INFX_LO_SPEC_LENGTH 2250 /* UWORD */
  166. #define SQL_INFX_LO_PTR_LENGTH 2251 /* UWORD */
  167. #define SQL_INFX_LO_STAT_LENGTH 2252 /* UWORD */
  168. /******************************************************************************
  169. * LO Open flags: (see documentation for further explanation)
  170. *
  171. * LO_APPEND - Positions the seek position to end-of-file + 1. By itself,
  172. * it is equivalent to write only mode followed by a seek to the
  173. * end of large object. Read opeartions will fail.
  174. * You can OR the LO_APPEND flag with another access mode.
  175. * LO_WRONLY - Only write operations are valid on the data.
  176. * LO_RDONLY - Only read operations are valid on the data.
  177. * LO_RDWR - Both read and write operations are valid on the data.
  178. *
  179. * LO_RANDOM - If set overrides optimizer decision. Indicates that I/O is
  180. * random and that the system should not read-ahead.
  181. * LO_SEQUENTIAL - If set overrides optimizer decision. Indicates that
  182. * reads are sequential in either forward or reverse direction.
  183. *
  184. * LO_FORWARD - Only used for sequential access. Indicates that the sequential
  185. * access will be in a forward direction, i.e. from low offset
  186. * to higher offset.
  187. * LO_REVERSE - Only used for sequential access. Indicates that the sequential
  188. * access will be in a reverse direction.
  189. *
  190. * LO_BUFFER - If set overrides optimizer decision. I/O goes through the
  191. * buffer pool.
  192. * LO_NOBUFFER - If set then I/O does not use the buffer pool.
  193. ******************************************************************************/
  194. #define LO_APPEND 0x1
  195. #define LO_WRONLY 0x2
  196. #define LO_RDONLY 0x4 /* default */
  197. #define LO_RDWR 0x8
  198. #define LO_RANDOM 0x20 /* default is determined by optimizer */
  199. #define LO_SEQUENTIAL 0x40 /* default is determined by optimizer */
  200. #define LO_FORWARD 0x80 /* default */
  201. #define LO_REVERSE 0x100
  202. #define LO_BUFFER 0x200 /* default is determined by optimizer */
  203. #define LO_NOBUFFER 0x400 /* default is determined by optimizer */
  204. #define LO_DIRTY_READ 0x10
  205. #define LO_NODIRTY_READ 0x800
  206. #define LO_LOCKALL 0x1000 /* default */
  207. #define LO_LOCKRANGE 0x2000
  208. /*******************************************************************************
  209. * LO create-time flags:
  210. *
  211. * Bitmask - Set/Get via ifx_lo_specset_flags() on LO_SPEC.
  212. ******************************************************************************/
  213. #define LO_ATTR_LOG 0x0001
  214. #define LO_ATTR_NOLOG 0x0002
  215. #define LO_ATTR_DELAY_LOG 0x0004
  216. #define LO_ATTR_KEEP_LASTACCESS_TIME 0x0008
  217. #define LO_ATTR_NOKEEP_LASTACCESS_TIME 0x0010
  218. #define LO_ATTR_HIGH_INTEG 0x0020
  219. #define LO_ATTR_MODERATE_INTEG 0x0040
  220. /*******************************************************************************
  221. * Symbolic constants for the "lseek" routine
  222. ******************************************************************************/
  223. #define LO_SEEK_SET 0 /* Set curr. pos. to "offset" */
  224. #define LO_SEEK_CUR 1 /* Set curr. pos. to current + "offset" */
  225. #define LO_SEEK_END 2 /* Set curr. pos. to EOF + "offset" */
  226. /*******************************************************************************
  227. * Symbolic constants for lo_lock and lo_unlock routines.
  228. ******************************************************************************/
  229. #define LO_SHARED_MODE 1
  230. #define LO_EXCLUSIVE_MODE 2
  231. /*******************************************************************************
  232. * Intersolv specific infoTypes for SQLGetInfo
  233. ******************************************************************************/
  234. #define SQL_RESERVED_WORDS 1011
  235. #define SQL_PSEUDO_COLUMNS 1012
  236. #define SQL_FROM_RESERVED_WORDS 1013
  237. #define SQL_WHERE_CLAUSE_TERMINATORS 1014
  238. #define SQL_COLUMN_FIRST_CHARS 1015
  239. #define SQL_COLUMN_MIDDLE_CHARS 1016
  240. #define SQL_TABLE_FIRST_CHARS 1018
  241. #define SQL_TABLE_MIDDLE_CHARS 1019
  242. #define SQL_FAST_SPECIAL_COLUMNS 1021
  243. #define SQL_ACCESS_CONFLICTS 1022
  244. #define SQL_LOCKING_SYNTAX 1023
  245. #define SQL_LOCKING_DURATION 1024
  246. #define SQL_RECORD_OPERATIONS 1025
  247. #define SQL_QUALIFIER_SYNTAX 1026
  248. /* Function for acquiring the xa_switch structure defined by Informix RM */
  249. struct xa_switch_t * _fninfx_xa_switch( void );
  250. /* Function for obtaining the Environment handle associated with an XA
  251. Connection */
  252. RETCODE IFMX_SQLGetXaHenv(int, HENV *);
  253. /*Function for obtaining the Database handle associated with an XA Connection */
  254. RETCODE IFMX_SQLGetXaHdbc(int, HDBC *);
  255. #ifdef __cplusplus
  256. } /* End of extern "C" { */
  257. #endif /* __cplusplus */
  258. #endif /* __INFXCLI_H */