PostgreSQL Source Code  git master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
ecpglib.h
Go to the documentation of this file.
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 *);
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 ECPGget_desc_header(int, const char *, int *);
78 bool ECPGget_desc(int, const char *, int,...);
79 bool ECPGset_desc_header(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, 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 */
bool ECPGdeallocate_desc(int, const char *)
Definition: descriptor.c:712
bool ECPGdeallocate_all(int, int, const char *)
Definition: prepare.c:289
bool ECPGprepare(int, const char *, const bool, const char *, const char *)
Definition: prepare.c:161
bool ECPGdescribe(int, int, bool, const char *, const char *,...)
Definition: descriptor.c:814
bool ECPGget_desc(int, const char *, int,...)
Definition: descriptor.c:245
bool ECPGis_noind_null(enum ECPGttype, void *)
Definition: misc.c:382
void ECPGfree_auto_mem(void)
Definition: memory.c:138
void ECPGset_noind_null(enum ECPGttype, void *)
Definition: misc.c:314
void * ECPGget_var(int number)
Definition: misc.c:562
bool ECPGset_desc_header(int, const char *, int)
Definition: descriptor.c:556
bool ECPGstatus(int, const char *)
Definition: misc.c:165
char * ECPGprepared_statement(const char *, const char *, int)
Definition: prepare.c:306
PGconn * ECPGget_PGconn(const char *)
Definition: connect.c:719
void sqlprint(void)
Definition: error.c:336
bool ECPGdisconnect(int, const char *)
Definition: connect.c:669
bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int)
Definition: connect.c:271
void ECPGdebug(int, FILE *)
Definition: misc.c:237
PGTransactionStatusType ECPGtransactionStatus(const char *)
Definition: misc.c:183
#define pg_attribute_format_arg(a)
Definition: c.h:633
bool ECPGallocate_desc(int, const char *)
Definition: descriptor.c:759
#define ecpg_gettext(x)
Definition: ecpglib.h:18
bool ECPGset_desc(int, const char *, int,...)
Definition: descriptor.c:567
bool ECPGsetcommit(int, const char *, const char *)
Definition: connect.c:165
PGTransactionStatusType
Definition: libpq-fe.h:101
bool ECPGdeallocate(int, int, const char *, const char *)
Definition: prepare.c:253
char * ECPGerrmsg(void)
bool ECPGget_desc_header(int, const char *, int *)
Definition: descriptor.c:91
void ECPGset_var(int, void *, int)
Definition: misc.c:518
bool ECPGsetconn(int, const char *)
Definition: connect.c:202
bool ECPGdo_descriptor(int, const char *, const char *, const char *)
Definition: execute.c:2045
bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: execute.c:2030
bool ECPGtrans(int, const char *, const char *)
Definition: misc.c:199
ECPGttype
Definition: ecpgtype.h:41