PostgreSQL Source Code  git master
ecpglib.h
Go to the documentation of this file.
1 /*
2  * Client-visible declarations for ecpglib
3  *
4  * src/interfaces/ecpg/include/ecpglib.h
5  */
6 
7 #ifndef _ECPGLIB_H
8 #define _ECPGLIB_H
9 
10 #include <string.h>
11 
12 #include "ecpg_config.h"
13 #include "ecpgtype.h"
14 #include "libpq-fe.h"
15 #include "sqlca.h"
16 
17 /*
18  * This is a small extract from c.h since we don't want to leak all postgres
19  * definitions into ecpg programs; but we need to know what bool is.
20  */
21 #ifndef __cplusplus
22 
23 #ifdef PG_USE_STDBOOL
24 #include <stdbool.h>
25 #else
26 
27 /*
28  * We assume bool has been defined if true and false are. This avoids
29  * duplicate-typedef errors if this file is included after c.h.
30  */
31 #if !(defined(true) && defined(false))
32 typedef unsigned char bool;
33 #endif
34 
35 #ifndef true
36 #define true ((bool) 1)
37 #endif
38 
39 #ifndef false
40 #define false ((bool) 0)
41 #endif
42 
43 #endif /* not PG_USE_STDBOOL */
44 #endif /* not C++ */
45 
46 
47 #ifdef __cplusplus
48 extern "C"
49 {
50 #endif
51 
52 void ECPGdebug(int, FILE *);
53 bool ECPGstatus(int, const char *);
54 bool ECPGsetcommit(int, const char *, const char *);
55 bool ECPGsetconn(int, const char *);
56 bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
57 bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
58 bool ECPGtrans(int, const char *, const char *);
59 bool ECPGdisconnect(int, const char *);
60 bool ECPGprepare(int, const char *, const bool, const char *, const char *);
61 bool ECPGdeallocate(int, int, const char *, const char *);
62 bool ECPGdeallocate_all(int, int, const char *);
63 char *ECPGprepared_statement(const char *, const char *, int);
64 PGconn *ECPGget_PGconn(const char *);
66 
67  /* print an error message */
68 void sqlprint(void);
69 
70 /* define this for simplicity as well as compatibility */
71 
72 #define SQLCODE sqlca.sqlcode
73 #define SQLSTATE sqlca.sqlstate
74 
75 /* dynamic SQL */
76 
77 bool ECPGdo_descriptor(int, const char *, const char *, const char *);
78 bool ECPGdeallocate_desc(int, const char *);
79 bool ECPGallocate_desc(int, const char *);
80 bool ECPGget_desc_header(int, const char *, int *);
81 bool ECPGget_desc(int, const char *, int,...);
82 bool ECPGset_desc_header(int, const char *, int);
83 bool ECPGset_desc(int, const char *, int,...);
84 
85 void ECPGset_noind_null(enum ECPGttype, void *);
86 bool ECPGis_noind_null(enum ECPGttype, const void *);
87 bool ECPGdescribe(int, int, bool, const char *, const char *,...);
88 
89 void ECPGset_var(int, void *, int);
90 void *ECPGget_var(int number);
91 
92 /* dynamic result allocation */
93 void ECPGfree_auto_mem(void);
94 
95 #ifdef ENABLE_THREAD_SAFETY
96 void ecpg_pthreads_init(void);
97 #endif
98 
99 #ifdef __cplusplus
100 }
101 #endif
102 
103 #endif /* _ECPGLIB_H */
unsigned char bool
Definition: ecpglib.h:32
bool ECPGdeallocate_desc(int, const char *)
Definition: descriptor.c:750
bool ECPGdeallocate_all(int, int, const char *)
Definition: prepare.c:350
bool ECPGprepare(int, const char *, const bool, const char *, const char *)
Definition: prepare.c:217
bool ECPGdescribe(int, int, bool, const char *, const char *,...)
Definition: descriptor.c:852
bool ECPGget_desc(int, const char *, int,...)
Definition: descriptor.c:241
void ECPGfree_auto_mem(void)
Definition: memory.c:138
void ECPGset_noind_null(enum ECPGttype, void *)
Definition: misc.c:319
void * ECPGget_var(int number)
Definition: misc.c:581
bool ECPGset_desc_header(int, const char *, int)
Definition: descriptor.c:575
bool ECPGstatus(int, const char *)
Definition: misc.c:164
char * ECPGprepared_statement(const char *, const char *, int)
Definition: prepare.c:368
PGconn * ECPGget_PGconn(const char *)
Definition: connect.c:734
void sqlprint(void)
Definition: error.c:335
bool ECPGdisconnect(int, const char *)
Definition: connect.c:684
bool ECPGis_noind_null(enum ECPGttype, const void *)
Definition: misc.c:388
bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int)
Definition: connect.c:271
void ECPGdebug(int, FILE *)
Definition: misc.c:242
PGTransactionStatusType ECPGtransactionStatus(const char *)
Definition: misc.c:182
bool ECPGallocate_desc(int, const char *)
Definition: descriptor.c:797
bool ECPGset_desc(int, const char *, int,...)
Definition: descriptor.c:607
bool ECPGsetcommit(int, const char *, const char *)
Definition: connect.c:165
PGTransactionStatusType
Definition: libpq-fe.h:103
bool ECPGdeallocate(int, int, const char *, const char *)
Definition: prepare.c:315
bool ECPGget_desc_header(int, const char *, int *)
Definition: descriptor.c:91
void ECPGset_var(int, void *, int)
Definition: misc.c:526
bool ECPGsetconn(int, const char *)
Definition: connect.c:202
bool ECPGdo_descriptor(int, const char *, const char *, const char *)
Definition: execute.c:2302
bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: execute.c:2287
bool ECPGtrans(int, const char *, const char *)
Definition: misc.c:198
ECPGttype
Definition: ecpgtype.h:41