ecpglib.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. /*
  2. * this is a small part of c.h since we don't want to leak all postgres
  3. * definitions into ecpg programs
  4. * src/interfaces/ecpg/include/ecpglib.h
  5. */
  6. #ifndef _ECPGLIB_H
  7. #define _ECPGLIB_H
  8. #include "libpq-fe.h"
  9. #include "ecpgtype.h"
  10. #include "sqlca.h"
  11. #include <string.h>
  12. #ifdef ENABLE_NLS
  13. extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1);
  14. #else
  15. #define ecpg_gettext(x) (x)
  16. #endif
  17. #ifndef __cplusplus
  18. #ifndef bool
  19. #define bool char
  20. #endif /* ndef bool */
  21. #ifndef true
  22. #define true ((bool) 1)
  23. #endif /* ndef true */
  24. #ifndef false
  25. #define false ((bool) 0)
  26. #endif /* ndef false */
  27. #endif /* not C++ */
  28. #ifndef TRUE
  29. #define TRUE 1
  30. #endif /* TRUE */
  31. #ifndef FALSE
  32. #define FALSE 0
  33. #endif /* FALSE */
  34. #ifdef __cplusplus
  35. extern "C"
  36. {
  37. #endif
  38. void ECPGdebug(int, FILE *);
  39. bool ECPGstatus(int, const char *);
  40. bool ECPGsetcommit(int, const char *, const char *);
  41. bool ECPGsetconn(int, const char *);
  42. bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
  43. bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
  44. bool ECPGtrans(int, const char *, const char *);
  45. bool ECPGdisconnect(int, const char *);
  46. bool ECPGprepare(int, const char *, const bool, const char *, const char *);
  47. bool ECPGdeallocate(int, int, const char *, const char *);
  48. bool ECPGdeallocate_all(int, int, const char *);
  49. char *ECPGprepared_statement(const char *, const char *, int);
  50. PGconn *ECPGget_PGconn(const char *);
  51. PGTransactionStatusType ECPGtransactionStatus(const char *);
  52. char *ECPGerrmsg(void);
  53. /* print an error message */
  54. void sqlprint(void);
  55. /* define this for simplicity as well as compatibility */
  56. #define SQLCODE sqlca.sqlcode
  57. #define SQLSTATE sqlca.sqlstate
  58. /* dynamic SQL */
  59. bool ECPGdo_descriptor(int, const char *, const char *, const char *);
  60. bool ECPGdeallocate_desc(int, const char *);
  61. bool ECPGallocate_desc(int, const char *);
  62. bool ECPGget_desc_header(int, const char *, int *);
  63. bool ECPGget_desc(int, const char *, int,...);
  64. bool ECPGset_desc_header(int, const char *, int);
  65. bool ECPGset_desc(int, const char *, int,...);
  66. void ECPGset_noind_null(enum ECPGttype, void *);
  67. bool ECPGis_noind_null(enum ECPGttype, void *);
  68. bool ECPGdescribe(int, int, bool, const char *, const char *,...);
  69. void ECPGset_var(int, void *, int);
  70. void *ECPGget_var(int number);
  71. /* dynamic result allocation */
  72. void ECPGfree_auto_mem(void);
  73. #ifdef ENABLE_THREAD_SAFETY
  74. void ecpg_pthreads_init(void);
  75. #endif
  76. #ifdef __cplusplus
  77. }
  78. #endif
  79. #endif /* _ECPGLIB_H */