sqlhdr.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. /*
  2. * Licensed Materials - Property of IBM and/or HCL
  3. *
  4. * IBM Informix Dynamic Server
  5. * Copyright IBM Corporation 1996, 2011
  6. * (c) Copyright HCL Technologies Ltd. 2017. All Rights Reserved.
  7. *
  8. ***************************************************************************
  9. *
  10. * Title: sqlhdr.h
  11. * Description: header file for all embedded sql programs
  12. *
  13. ***************************************************************************
  14. */
  15. #ifndef _SQLHDR
  16. #define _SQLHDR
  17. #include "ifxtypes.h"
  18. #include "sqlda.h"
  19. #include "sqlca.h"
  20. #include "collct.h"
  21. #include "int8.h"
  22. #include "locator.h"
  23. #include "datetime.h"
  24. #include "value.h"
  25. #ifdef __cplusplus
  26. extern "C" {
  27. #endif
  28. typedef struct _ifx_squlist
  29. {
  30. char **_SQUulist; /* columns to be updated */
  31. struct _squlist *_SQUnext; /* next update list */
  32. mint _SQUid; /* update list id */
  33. } ifx_squlist_t;
  34. typedef struct _ifx_cursor
  35. {
  36. struct _ifx_cursor *_SQCcursptr; /* pointer to the statement/cursor block */
  37. int2 _SQCstmttype; /* SQ_SELECT, SQ_INSERT, etc. */
  38. int2 _SQCsqlid; /* SQL's id for this cursor */
  39. int2 _SQCnfields; /* number of result fields
  40. * (number supplied by SQL)
  41. */
  42. int2 _SQCnibind; /* number of input args */
  43. int2 _SQCnobind; /* number of output args */
  44. int2 _SQCnrettype; /* number of fields sent for the
  45. * rettype msg
  46. */
  47. int4 _SQCtcount; /* tuples remaining in buffer */
  48. int4 _SQCtsize; /* length of data expected from
  49. * SQL
  50. */
  51. int4 _SQCtbsize; /* tuple buffer size */
  52. int4 _SQCflags; /* CROPEN, CREOF, CRSINGLE, CRPREPARE */
  53. /* used for scroll cursors */
  54. int4 _SQCfirst; /* rowid of 1st tuple in buffer */
  55. int4 _SQClast; /* rowid of last tuple in buffer */
  56. ifx_sqlvar_t *_SQCibind; /* pointer to first in array of
  57. * binding structures for arguments
  58. * to be taken from the user
  59. * program and sent to SQL;
  60. */
  61. ifx_sqlvar_t *_SQCobind; /* pointer to first in array of
  62. * binding structures for values
  63. * to be received from SQL and
  64. * supplied to the user program;
  65. */
  66. ifx_sqlvar_t *_SQCrettype; /* pointer to first in array of
  67. * binding structure for values
  68. * to be sent thru the rettype
  69. * msg
  70. */
  71. ifx_sqlvar_t *_SQCfields; /* pointer to first in array of
  72. * structures describing the data
  73. * to be received from SQL;
  74. * (fields described by SQL)
  75. */
  76. ifx_sqlda_t *_SQCsqlda; /* pointer to sqlda */
  77. char **_SQCcommand; /* pointer to ptrs to pieces of
  78. * the command
  79. */
  80. char *_SQCstrtab; /* pointer to table of strings - the
  81. * names of the attributes to be
  82. * received from SQL
  83. * (table supplied by SQL)
  84. */
  85. char *_SQCtbuf; /* tuple buffer */
  86. char *_SQCtuple; /* pointer to current tuple within
  87. * buffer
  88. */
  89. char *_SQCname; /* cursor name */
  90. char *_SQCapiname; /* column name buffer when */
  91. /* DBAPICODE is set */
  92. mint _SQCposition; /* Used only for INSERT AT stmts */
  93. mint _SQCiscollstmt; /* Set if cursor or stmt is for */
  94. /* collection table */
  95. mint _SQCcl_putcnt; /* Number of variable length rows
  96. * inserted using an insert cursor.
  97. */
  98. ifx_collection_t *_SQCcollection; /* pointer to collection var */
  99. ifx_coll_cur_t _SQCcollcur; /* collection manager cursor block */
  100. ifx_cl_tupinfo_t *_SQCcl_tupleinfo; /* collection tuple information */
  101. ifx_literal_t *_SQClitvalues; /* pointer to the input values
  102. * specified for the collection table */
  103. ifx_literal_t *_SQC_savlitvalues; /* pointer to the saved
  104. * literal values that have
  105. * the QMARKBIND entries in
  106. * it */
  107. ifx_namelist_t *_SQCnamelist; /* Pointer to column names
  108. * specified in the projection
  109. * list for SELECT, UPDATE, INSERT
  110. * and DELETE */
  111. int2 _SQCcl_num; /* number of collection columns */
  112. /* the following 4 fields are for open-fetch-close optimization */
  113. int2 _SQCopen_state; /* see open_state below */
  114. char *_SQCdesc_name; /* saved sql desc name */
  115. ifx_sqlda_t *_SQCidesc; /* saved idesc value */
  116. int2 _SQCreopt; /* saved reoptimization flag */
  117. void *_SQCcls; /* reserved for fast path */
  118. void *_SQCcur7; /* points to the corresponding
  119. * 7.x cursor structure */
  120. int4 _SQCflags3; /* reserved flag for future use */
  121. void *_SQCreserved; /* reserved for future use */
  122. } ifx_cursor_t;
  123. typedef struct _ifx_statement
  124. {
  125. int2 _SQSstmttype; /* SQ_SELECT, SQ_INSERT, etc. */
  126. int2 _SQSsqlid; /* SQL's id for this cursor */
  127. void *_SQSreserved; /* reserved for future use */
  128. } ifx_statement_t;
  129. typedef struct _ifx_hostvar {
  130. char *hostaddr; /* address of host variable */
  131. int2 fieldtype; /* field entry requested by GET */
  132. int2 hosttype; /* host type */
  133. int4 hostlen; /* length of field type */
  134. int2 qualifier; /* qualifier for DATETIME/INTERVAL */
  135. char *btname; /* Base type name if provided in */
  136. /* host variable declaration */
  137. char *btownername; /* Base type owner name */
  138. char *cstr; /* collection or row host string */
  139. void *reserved; /* reserved for future use */
  140. } ifx_hostvar_t;
  141. /*
  142. * CURSOR state when (OPTOFC) Open-Fetch-Close Optimization is being used
  143. */
  144. #define CURSOR_NOT_OPEN 0
  145. #define CURSOR_USER_OPEN 1
  146. #define CURSOR_OPEN_FETCH 2
  147. #define CURSOR_FETCHING 3
  148. /*
  149. * SQL field type codes
  150. */
  151. #define XSQLD 0
  152. #define XSQLTYPE 1
  153. #define XSQLLEN 2
  154. #define XSQLPRECISION 3
  155. #define XSQLNULLABLE 4
  156. #define XSQLIND 5
  157. #define XSQLDATA 6
  158. #define XSQLNAME 7
  159. #define XSQLSCALE 8
  160. #define XSQLILEN 9
  161. #define XSQLITYPE 10
  162. #define XSQLIDATA 11
  163. #define XSQLXID 12
  164. #define XSQLTYPENAME 13
  165. #define XSQLTYPELEN 14
  166. #define XSQLOWNERLEN 15
  167. #define XSQLOWNERNAME 16
  168. #define XSQLSOURCETYPE 17
  169. #define XSQLSOURCEID 18
  170. /*
  171. * Specifications for FETCH
  172. */
  173. typedef struct _fetchspec
  174. {
  175. int4 fval; /* scroll quantity */
  176. mint fdir; /* direction of FETCH (NEXT, PREVIOUS..) */
  177. mint findchk; /* check for indicator? */
  178. } _FetchSpec;
  179. /*
  180. * Connection type
  181. */
  182. #define IFX_CONN_TYPE_NO_AUTH 0x0
  183. #define IFX_CONN_TYPE_USER_AUTH 0x1
  184. #define IFX_CONN_TYPE_CRED_AUTH 0x2
  185. /*
  186. * User connection structure
  187. */
  188. typedef struct ifx_user_struct
  189. {
  190. char *name;
  191. char *passwd;
  192. } ifx_user_t;
  193. /*
  194. * ASF connection structure
  195. */
  196. typedef struct ifx_connect_struct
  197. {
  198. int2 conn_type; /* connection type */
  199. void *conn_cred_hdl; /* connection credential handle */
  200. /* could be pointer to ifx_user_t */
  201. /* or any CSS supported credentials */
  202. } ifx_conn_t;
  203. /*
  204. * Types stored in csblock_t (iqutil.c)
  205. */
  206. #define IQ_CURSOR 0x0000
  207. #define IQ_STMT 0x0001
  208. #define IQ_ALL 0x0002
  209. #define IQ_SKIP_CUR_CHK 0x0100
  210. #define IQ_SKIP_DOWNSHIFT 0x0200
  211. /*
  212. * The following defines will be used to check the installed version of
  213. * the libraries against the ones used during compilation. A handshaking
  214. * method was introduced with shared libraries to indicate if the
  215. * API changed between one release of the library to the other.
  216. */
  217. #define IFX_GENLIB_ID 1 /* identifier for libgen.so */
  218. #define IFX_OSLIB_ID 2 /* identifier for libos.so */
  219. #define IFX_SQLILIB_ID 3 /* identifier for libsql.so */
  220. #define IFX_GLSLIB_ID 4 /* identifier for libgls.so */
  221. /*
  222. * provide macro definition for the library versions
  223. * being used while generating client's application executable.
  224. */
  225. #define CLIENT_GEN_VER 710 /* libgen.so used for compiling application */
  226. #define CLIENT_OS_VER 710 /* libos.so used for compiling application */
  227. #define CLIENT_SQLI_VER 720 /* libsql.so used for compiling application */
  228. #define CLIENT_GLS_VER 710 /* libgls.so used for compiling application */
  229. /*
  230. * provide error message codes if apis of library installed is different
  231. * than the one with which the application was compiled.
  232. */
  233. #define GEN_FAIL_CODE -1280 /* generate error message code for genlib */
  234. #define OS_FAIL_CODE -1281 /* generate error message code for oslib */
  235. #define SQLI_FAIL_CODE -1282 /* generate error message code for libsql */
  236. #define GLS_FAIL_CODE -1283 /* generate error message code for libgls */
  237. #ifdef IFX_THREAD
  238. /* defines for dynamic thread functions */
  239. #define TH_ONCE 0
  240. #define TH_MUTEXATTR_CREATE 1
  241. #define TH_MUTEXATTR_SETKIND 2
  242. #define TH_MUTEXATTR_DELETE 3
  243. #define TH_MUTEX_INIT 4
  244. #define TH_MUTEX_DESTROY 5
  245. #define TH_MUTEX_LOCK 6
  246. #define TH_MUTEX_UNLOCK 7
  247. #define TH_MUTEX_TRYLOCK 8
  248. #define TH_CONDATTR_CREATE 9
  249. #define TH_CONDATTR_DELETE 10
  250. #define TH_COND_INIT 11
  251. #define TH_COND_DESTROY 12
  252. #define TH_COND_TIMEDWAIT 13
  253. #define TH_KEYCREATE 14
  254. #define TH_GETSPECIFIC 15
  255. #define TH_SETSPECIFIC 16
  256. #define TH_SELF 17
  257. /* Number of dynamic thread functions */
  258. #define TH_MAXIMUM 18
  259. MI_EXT_DECL mint ifxOS_set_thrfunc(mint func, mulong (*funcptr)());
  260. #endif /* IFX_THREAD */
  261. #ifndef USEMEMCPY
  262. #ifndef NT
  263. #if defined(__cplusplus)
  264. MI_EXT_DECL void byfill(char *s, int n, char c);
  265. #endif /* defined (__cplusplus) */
  266. #endif /* !NT */
  267. #endif /* !USEMEMCPY */
  268. #ifdef NT_MI_SAPI
  269. #ifndef NT_SERVER /* byfill macro definition only for NT Blades */
  270. #define byfill(s,n,c) memset(s,c,n)
  271. #endif /* NT_SERVER */
  272. #endif /* NT_MI_SAPI */
  273. MI_EXT_DECL mlong ifx_get_row_xid(ifx_collection_t *collp, mint *colnum);
  274. MI_EXT_DECL char * ifx_get_row_extended_name(ifx_collection_t *collp);
  275. MI_EXT_DECL mint ifx_checkAPI(mint libver, mint libid);
  276. MI_EXT_DECL mint bycmpr(const char *st1, const char *st2, mint count);
  277. MI_EXT_DECL mint byleng(const char *beg, mint cnt);
  278. MI_EXT_DECL void ldchar(const char *from, mint count, char *to);
  279. #ifndef USEMEMCPY
  280. MI_EXT_DECL void bycopy(const char *s1, char *s2, mint n);
  281. #endif /* !USEMEMCPY */
  282. #ifdef NT /* We need this declaration on NT to export it */
  283. MI_EXT_DECL void bycopy(const char *s1, char *s2, mint n);
  284. #endif /*NT */
  285. MI_EXT_DECL void rdownshift(char *s);
  286. MI_EXT_DECL void rupshift(char *s);
  287. #ifndef USE_STRFUNS
  288. MI_EXT_DECL void stcat(const char *src, char *dst);
  289. MI_EXT_DECL void stcopy(const char *src, char *dst);
  290. MI_EXT_DECL mint stleng(const char *src);
  291. #endif /* !USE_STRFUNS */
  292. MI_EXT_DECL mint stcmpr(const char *s1, const char *s2);
  293. MI_EXT_DECL void stchar(const char *from, char *to, mint count);
  294. MI_EXT_DECL mint rstoi(char *s, mint *val);
  295. MI_EXT_DECL mint rstoi4(char *s, int4 *val);
  296. MI_EXT_DECL mint rdatestr(int4 jdate, char *str);
  297. MI_EXT_DECL mint rdayofweek(int4 date);
  298. MI_EXT_DECL mint rdefmtdate(int4 *pdate, char *fmtstring, char *input);
  299. MI_EXT_DECL mint ifx_defmtdate(int4 *pdate, char *fmtstring, char *input, char db_century);
  300. MI_EXT_DECL mint rfmtdate(int4 date, char *fmtstring, char *result);
  301. MI_EXT_DECL mint rfmtdec(struct decimal *dec, char *format, char *outbuf);
  302. MI_EXT_DECL mint rfmtdouble(double dvalue, char *format, char *outbuf);
  303. MI_EXT_DECL mint rfmtlong(int4 lvalue, char *format, char *outbuf);
  304. MI_EXT_DECL mint rgetmsg(mint msgnum, char *s, mint maxsize);
  305. MI_EXT_DECL mint rgetlmsg(int4 msgnum, char *s, mint maxsize, mint *msg_length);
  306. MI_EXT_DECL mint risnull(mint vtype, char *pcvar);
  307. MI_EXT_DECL mint rjulmdy(int4 jdate, int2 mdy[3]);
  308. MI_EXT_DECL mint rleapyear(mint year);
  309. MI_EXT_DECL mint rmdyjul(int2 mdy[3], int4 *jdate);
  310. MI_EXT_DECL mint rsetnull(mint vtype, char *pcvar);
  311. MI_EXT_DECL mint rstod(char *str, double *val);
  312. MI_EXT_DECL mint rstol(char *s, mlong *val);
  313. MI_EXT_DECL mint rstrdate(char *str, int4 *jdate);
  314. MI_EXT_DECL mint ifx_strdate(char *str, int4 *jdate, char db_century);
  315. MI_EXT_DECL void rtoday(int4 *today);
  316. #if MI_PTR_SIZE == 64 /* 64-bit pointer */
  317. MI_EXT_DECL mintptr rtypalign(mintptr offset, mint type);
  318. #else /* 32-bit pointer */
  319. MI_EXT_DECL mint rtypalign(mint offset, mint type);
  320. #endif /* MI_PTR_SIZE == 64 */
  321. MI_EXT_DECL mint rtypmsize(mint type, mint len);
  322. MI_EXT_DECL char *rtypname(mint type);
  323. MI_EXT_DECL mint rtypwidth(mint type, mint len);
  324. MI_EXT_DECL mint ifx_int8cmp(ifx_int8_t *op1, ifx_int8_t *op2);
  325. MI_EXT_DECL mint ifx_int8cvlong(int4 lng, ifx_int8_t *int8p);
  326. MI_EXT_DECL mint ifx_int8tolong(ifx_int8_t *int8p, int4 *lngp);
  327. MI_EXT_DECL mint ifx_int8toint4(ifx_int8_t *int8p, int4 *lngp);
  328. MI_EXT_DECL mint ifx_int8cvint(mint in, ifx_int8_t *int8p);
  329. MI_EXT_DECL mint ifx_int8toint(ifx_int8_t *int8p, mint *intp);
  330. MI_EXT_DECL mint ifx_int8toint2(ifx_int8_t *int8p, int2 *intp);
  331. MI_EXT_DECL mint ifx_int8cvasc(char *cp, mint len, ifx_int8_t *int8p);
  332. MI_EXT_DECL mint ifx_int8toasc(ifx_int8_t *int8p, char *cp, mint len);
  333. MI_EXT_DECL mint ifx_int8cvdec(dec_t *decp, ifx_int8_t *int8p);
  334. MI_EXT_DECL mint ifx_int8todec(ifx_int8_t *int8p, dec_t *decp);
  335. MI_EXT_DECL mint ifx_int8cvdbl(double dbl, ifx_int8_t *int8p);
  336. MI_EXT_DECL mint ifx_int8todbl(ifx_int8_t *int8p, double *dblp);
  337. MI_EXT_DECL mint ifx_int8cvflt(double flt, ifx_int8_t *int8p);
  338. MI_EXT_DECL mint ifx_int8toflt(ifx_int8_t *int8p, float *fltp);
  339. MI_EXT_DECL mint deccvint8(ifx_int8_t *int8p, dec_t *decp);
  340. MI_EXT_DECL mint ifx_int8sub(ifx_int8_t *int8op1, ifx_int8_t *int8op2, ifx_int8_t *int8result);
  341. MI_EXT_DECL mint ifx_int8add(ifx_int8_t *int8op1, ifx_int8_t *int8op2, ifx_int8_t *int8result);
  342. MI_EXT_DECL mint ifx_int8mul(ifx_int8_t *int8op1, ifx_int8_t *int8op2, ifx_int8_t *int8result);
  343. MI_EXT_DECL mint ifx_int8div(ifx_int8_t *int8op1, ifx_int8_t *int8op2, ifx_int8_t *int8result);
  344. MI_EXT_DECL void ifx_int8copy(ifx_int8_t *sint8p, ifx_int8_t *dint8p);
  345. #ifndef NOBIGINT
  346. MI_EXT_DECL mint biginttoint2(const bigint bigintv, int2 *int2p);
  347. MI_EXT_DECL mint bigintcvint2(const int2 int2v, bigint *bigintp);
  348. MI_EXT_DECL mint biginttoint4(const bigint bigintv, int4 *int4p);
  349. MI_EXT_DECL mint bigintcvint4(const int4 int4v, bigint *bigintp);
  350. MI_EXT_DECL mint biginttoasc(const bigint bigintv, char *cp, mint len, mint base);
  351. MI_EXT_DECL mint bigintcvasc(const char *cp, mint len, bigint *bigintp);
  352. MI_EXT_DECL mint bigintcvdec(const dec_t *decp, bigint *bigintp);
  353. MI_EXT_DECL mint biginttodec(const bigint bigintv, dec_t *decp);
  354. MI_EXT_DECL mint biginttodbl(const bigint bigintv,double *dbl);
  355. MI_EXT_DECL mint bigintcvdbl(const double dbl, bigint *bigintp);
  356. MI_EXT_DECL mint biginttoflt(const bigint bigintv, float *fltp);
  357. MI_EXT_DECL mint bigintcvflt(const double dbl, bigint *bigintp);
  358. MI_EXT_DECL mint bigintcvifx_int8(const ifx_int8_t *int8p, bigint *bigintp);
  359. MI_EXT_DECL void biginttoifx_int8(const bigint bigintv, ifx_int8_t *int8p);
  360. #endif /* NOBIGINT */
  361. MI_EXT_DECL mint sqlbreak(void);
  362. MI_EXT_DECL char *ifx_getcur_conn_name(void);
  363. MI_EXT_DECL mint sqldetach(void);
  364. MI_EXT_DECL mint sqlexit(void);
  365. MI_EXT_DECL mint sqlstart(void);
  366. MI_EXT_DECL void sqlsignal(mint sigvalue, void (*ldv)(void), mint mode);
  367. MI_EXT_DECL mint sqlbreakcallback(int4 timeout, void(*)(mint));
  368. /* PAM callback function */
  369. MI_EXT_DECL mint ifx_pam_callback(mint (*callbackfunc_ptr)(char *challenge,
  370. char *response, mint msg_style));
  371. MI_EXT_DECL mint ifx_cl_dealloc(ifx_collection_t **collection);
  372. MI_EXT_DECL mint ifx_xactevent(void *);
  373. MI_EXT_DECL mint ifx_getserowner(char *serowner);
  374. MI_EXT_DECL mint ifx_isius(void);
  375. MI_EXT_DECL char * ifx_get_msg_param(void);
  376. /*
  377. * Set of ifx_var_* functions for Fixed and Var Binary host vars.
  378. */
  379. MI_EXT_DECL mint ifx_var_flag(void **variable, int2 alloc_flag);
  380. MI_EXT_DECL mint ifx_var_alloc(void **variable, int4 size);
  381. MI_EXT_DECL mint ifx_var_dealloc(void **variable);
  382. MI_EXT_DECL mint ifx_var_setdata(void **variable, char *data, int4 size);
  383. MI_EXT_DECL mint ifx_var_isnull(void **variable);
  384. MI_EXT_DECL mint ifx_var_setnull(void **variable, mint flag);
  385. MI_EXT_DECL mint ifx_var_setlen(void **variable, int4 size);
  386. MI_EXT_DECL void *ifx_var_getdata(void **variable);
  387. MI_EXT_DECL mint ifx_var_init(void **variable);
  388. MI_EXT_DECL mint ifx_var_getlen(void **variable);
  389. MI_EXT_DECL mint ifx_lvar_alloc(mint alloc);
  390. /*
  391. * Set of ifx_lo_* accessors for opaque data types:
  392. * - ifx_lo_create_spec_t
  393. * - ifx_lo_stat_t
  394. *
  395. * See also: locator.h for description of possible values for arguments
  396. */
  397. /* smartblob create spec SET accessors: */
  398. MI_EXT_DECL mint ifx_lo_specset_flags(ifx_lo_create_spec_t *cspec, mint flags);
  399. MI_EXT_DECL mint ifx_lo_specset_def_open_flags(ifx_lo_create_spec_t *cspec,
  400. mint def_open_flags);
  401. MI_EXT_DECL mint ifx_lo_specset_estbytes(ifx_lo_create_spec_t *cspec,
  402. ifx_int8_t *size);
  403. MI_EXT_DECL mint ifx_lo_specset_maxbytes(ifx_lo_create_spec_t *cspec,
  404. ifx_int8_t *size);
  405. MI_EXT_DECL mint ifx_lo_specset_extsz(ifx_lo_create_spec_t *cspec, mint n);
  406. MI_EXT_DECL mint ifx_lo_specset_sbspace(ifx_lo_create_spec_t *cspec, const char *str);
  407. /* smartblob create spec GET accessors: */
  408. MI_EXT_DECL mint ifx_lo_specget_flags(ifx_lo_create_spec_t *cspec);
  409. MI_EXT_DECL mint ifx_lo_specget_def_open_flags(ifx_lo_create_spec_t *cspec);
  410. MI_EXT_DECL mint ifx_lo_specget_estbytes(ifx_lo_create_spec_t *cspec,
  411. ifx_int8_t *size);
  412. MI_EXT_DECL mint ifx_lo_specget_maxbytes(ifx_lo_create_spec_t *cspec,
  413. ifx_int8_t *size);
  414. MI_EXT_DECL mint ifx_lo_specget_extsz(ifx_lo_create_spec_t *cspec);
  415. MI_EXT_DECL mint ifx_lo_specget_sbspace(ifx_lo_create_spec_t *cspec,
  416. char *str, mint len);
  417. /* smartblob stat GET accessors: */
  418. MI_EXT_DECL mint ifx_lo_stat_size(ifx_lo_stat_t *lostat, ifx_int8_t *size);
  419. MI_EXT_DECL mint ifx_lo_stat_uid(ifx_lo_stat_t *lostat);
  420. MI_EXT_DECL mint ifx_lo_stat_atime(ifx_lo_stat_t *lostat);
  421. MI_EXT_DECL mint ifx_lo_stat_mtime_sec(ifx_lo_stat_t *lostat);
  422. MI_EXT_DECL mint ifx_lo_stat_mtime_usec(ifx_lo_stat_t *lostat);
  423. MI_EXT_DECL mint ifx_lo_stat_ctime(ifx_lo_stat_t *lostat);
  424. MI_EXT_DECL mint ifx_lo_stat_refcnt(ifx_lo_stat_t *lostat);
  425. MI_EXT_DECL ifx_lo_create_spec_t *ifx_lo_stat_cspec(ifx_lo_stat_t *lostat);
  426. /* smartblob spec and stat destructors: */
  427. MI_EXT_DECL mint ifx_lo_spec_free(ifx_lo_create_spec_t *cspec);
  428. MI_EXT_DECL mint ifx_lo_stat_free(ifx_lo_stat_t *lostat);
  429. /*
  430. * Set of ifx_lo_ functions for support of Large Objects
  431. */
  432. MI_EXT_DECL mint ifx_lo_col_info(char *column_name,ifx_lo_create_spec_t *create_spec);
  433. MI_EXT_DECL mint ifx_lo_def_create_spec(ifx_lo_create_spec_t **cspec);
  434. MI_EXT_DECL mint ifx_lo_create(ifx_lo_create_spec_t *create_spec, mint flags,
  435. ifx_lo_t *loptr, mint *error);
  436. MI_EXT_DECL mint ifx_lo_open(ifx_lo_t *loptr, mint flags, mint *error);
  437. MI_EXT_DECL mint ifx_lo_close(mint lofd);
  438. MI_EXT_DECL mint ifx_lo_seek(mint lofd, ifx_int8_t *off, mint whence,
  439. ifx_int8_t *seek_pos);
  440. MI_EXT_DECL mint ifx_lo_lock(mint lofd, ifx_int8_t *off, mint whence,
  441. ifx_int8_t *range, mint lockmode);
  442. MI_EXT_DECL mint ifx_lo_unlock(mint lofd, ifx_int8_t *off, mint whence,
  443. ifx_int8_t *range);
  444. MI_EXT_DECL mint ifx_lo_tell(mint lofd, ifx_int8_t *seek_pos);
  445. MI_EXT_DECL mint ifx_lo_truncate(mint lofd, ifx_int8_t *off);
  446. MI_EXT_DECL mint ifx_lo_filename(ifx_lo_t *loptr, char *fname,
  447. char *result, mint result_buffer_nbytes);
  448. MI_EXT_DECL mint ifx_lo_alter(ifx_lo_t *loptr, ifx_lo_create_spec_t *create_spec);
  449. MI_EXT_DECL mint ifx_lo_stat(mint lofd, ifx_lo_stat_t **lostat);
  450. MI_EXT_DECL mint ifx_lo_read(mint lofd, char *buf, mint nbytes, mint *error);
  451. MI_EXT_DECL mint ifx_lo_readwithseek(mint lofd, char *buf, mint nbytes,
  452. ifx_int8_t *off, mint whence, mint *error);
  453. MI_EXT_DECL mint ifx_lo_write(mint lofd, char *buf, mint nbytes, mint *error);
  454. MI_EXT_DECL mint ifx_lo_writewithseek(mint lofd, char *buf, mint nbytes,
  455. ifx_int8_t *off, mint whence, mint *error);
  456. MI_EXT_DECL mint ifx_lo_copy_to_lo(mint lofd, char *fname, mint flags);
  457. MI_EXT_DECL mint ifx_lo_copy_to_file(ifx_lo_t *loptr, char *fname, mint flags,
  458. char *result);
  459. MI_EXT_DECL mint ifx_lo_to_buffer(ifx_lo_t *loptr, mint size, char **buffer,
  460. mint *error);
  461. MI_EXT_DECL mint ifx_lo_from_buffer(ifx_lo_t *loptr, mint size, char *buffer,
  462. mint *error);
  463. MI_EXT_DECL mint ifx_lo_release(ifx_lo_t *loptr);
  464. MI_EXT_DECL int4 ifx_lo_numbytes_written(void);
  465. MI_EXT_DECL void * ifx_alloc_conn_user(char *username, char *passwd);
  466. MI_EXT_DECL void ifx_free_conn_user(ifx_conn_t **);
  467. MI_EXT_DECL void * ifx_alloc_conn_cred(void *);
  468. MI_EXT_DECL void ifx_free_conn_cred(ifx_conn_t **);
  469. MI_EXT_DECL mint ifx_cl_card(ifx_collection_t *colt, mint *isnull);
  470. #ifdef _REENTRANT
  471. MI_EXT_DECL int4 * ifx_sqlcode(void);
  472. MI_EXT_DECL char * ifx_sqlstate(void);
  473. MI_EXT_DECL struct sqlca_s *ifx_sqlca(void);
  474. #endif /* _REENTRANT */
  475. #ifdef USEMEMCPY
  476. #ifndef byfill
  477. #define byfill(s, n, c) memset(s, c, n)
  478. #endif /* byfill */
  479. #endif /* USEMEMCPY */
  480. /*
  481. * This global variable FetBufSize (Fetch Buffer Size) will allow
  482. * the application to over-ride cursor->_SQCtbsize which dictates the
  483. * size of the buffer that holds the data that the BE will fill.
  484. */
  485. extern int2 FetBufSize;
  486. /* FetArrSize is used to indicate the array size in in Array Fetch */
  487. extern int2 FetArrSize;
  488. /* OptMsg is used in conjunction with env. var. OPTMSG to activate OPTMSG */
  489. extern int2 OptMsg;
  490. /*
  491. * Set of ifxcdc_ functions to support the CDC log capture API
  492. */
  493. MI_EXT_DECL mint ifxcdc_valisnull(char* inbuf, mint inbuflen, mint sqltype,
  494. short *indicator);
  495. #ifdef __cplusplus
  496. }
  497. #endif
  498. #endif /* _SQLHDR */