| 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 | |
| 7 | #ifndef _ECPGLIB_H |
| 8 | #define _ECPGLIB_H |
| 9 | |
| 10 | #include "libpq-fe.h" |
| 11 | #include "ecpgtype.h" |
| 12 | #include "sqlca.h" |
| 13 | #include <string.h> |
| 14 | |
| 15 | #ifdef ENABLE_NLS |
| 16 | extern char *ecpg_gettext(const char *msgid) pg_attribute_format_arg(1); |
| 17 | #else |
| 18 | #define ecpg_gettext(x) (x) |
| 19 | #endif |
| 20 | |
| 21 | #ifndef __cplusplus |
| 22 | #ifndef bool |
| 23 | #define bool char |
| 24 | #endif /* ndef bool */ |
| 25 | |
| 26 | #ifndef true |
| 27 | #define true ((bool) 1) |
| 28 | #endif /* ndef true */ |
| 29 | #ifndef false |
| 30 | #define false ((bool) 0) |
| 31 | #endif /* ndef false */ |
| 32 | #endif /* not C++ */ |
| 33 | |
| 34 | #ifndef TRUE |
| 35 | #define TRUE 1 |
| 36 | #endif /* TRUE */ |
| 37 | |
| 38 | #ifndef FALSE |
| 39 | #define FALSE 0 |
| 40 | #endif /* FALSE */ |
| 41 | |
| 42 | #ifdef __cplusplus |
| 43 | extern "C" |
| 44 | { |
| 45 | #endif |
| 46 | |
| 47 | void ECPGdebug(int, FILE *); |
| 48 | bool ECPGstatus(int, const char *); |
| 49 | bool ECPGsetcommit(int, const char *, const char *); |
| 50 | bool ECPGsetconn(int, const char *); |
| 51 | bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int); |
| 52 | bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...); |
| 53 | bool ECPGtrans(int, const char *, const char *); |
| 54 | bool ECPGdisconnect(int, const char *); |
| 55 | bool ECPGprepare(int, const char *, const bool, const char *, const char *); |
| 56 | bool ECPGdeallocate(int, int, const char *, const char *); |
| 57 | bool ECPGdeallocate_all(int, int, const char *); |
| 58 | char *ECPGprepared_statement(const char *, const char *, int); |
| 59 | PGconn *ECPGget_PGconn(const char *); |
| 60 | PGTransactionStatusType ECPGtransactionStatus(const char *); |
| 61 | |
| 62 | char *ECPGerrmsg(void); |
| 63 | |
| 64 | /* print an error message */ |
| 65 | void sqlprint(void); |
| 66 | |
| 67 | /* define this for simplicity as well as compatibility */ |
| 68 | |
| 69 | #define SQLCODE sqlca.sqlcode |
| 70 | #define SQLSTATE sqlca.sqlstate |
| 71 | |
| 72 | /* dynamic SQL */ |
| 73 | |
| 74 | bool ECPGdo_descriptor(int, const char *, const char *, const char *); |
| 75 | bool ECPGdeallocate_desc(int, const char *); |
| 76 | bool ECPGallocate_desc(int, const char *); |
| 77 | bool (int, const char *, int *); |
| 78 | bool ECPGget_desc(int, const char *, int,...); |
| 79 | bool (int, const char *, int); |
| 80 | bool ECPGset_desc(int, const char *, int,...); |
| 81 | |
| 82 | void ECPGset_noind_null(enum ECPGttype, void *); |
| 83 | bool ECPGis_noind_null(enum ECPGttype, const void *); |
| 84 | bool ECPGdescribe(int, int, bool, const char *, const char *,...); |
| 85 | |
| 86 | void ECPGset_var(int, void *, int); |
| 87 | void *ECPGget_var(int number); |
| 88 | |
| 89 | /* dynamic result allocation */ |
| 90 | void ECPGfree_auto_mem(void); |
| 91 | |
| 92 | #ifdef ENABLE_THREAD_SAFETY |
| 93 | void ecpg_pthreads_init(void); |
| 94 | #endif |
| 95 | |
| 96 | #ifdef __cplusplus |
| 97 | } |
| 98 | #endif |
| 99 | |
| 100 | #endif /* _ECPGLIB_H */ |
| 101 | |