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 "libpq-fe.h"
11 #include "ecpg_config.h"
12 #include "ecpgtype.h"
13 #include "sqlca.h"
14 #include <string.h>
15 
16 /*
17  * This is a small extract from c.h since we don't want to leak all postgres
18  * definitions into ecpg programs; but we need to know what bool is.
19  */
20 #ifndef __cplusplus
21 
22 #ifdef PG_USE_STDBOOL
23 #include <stdbool.h>
24 #else
25 
26 /*
27  * We assume bool has been defined if true and false are. This avoids
28  * duplicate-typedef errors if this file is included after c.h.
29  */
30 #if !(defined(true) && defined(false))
31 typedef unsigned char bool;
32 #endif
33 
34 #ifndef true
35 #define true ((bool) 1)
36 #endif
37 
38 #ifndef false
39 #define false ((bool) 0)
40 #endif
41 
42 #endif /* not PG_USE_STDBOOL */
43 #endif /* not C++ */
44 
45 
46 #ifdef __cplusplus
47 extern "C"
48 {
49 #endif
50 
51 void ECPGdebug(int, FILE *);
52 bool ECPGstatus(int, const char *);
53 bool ECPGsetcommit(int, const char *, const char *);
54 bool ECPGsetconn(int, const char *);
55 bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
56 bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
57 bool ECPGtrans(int, const char *, const char *);
58 bool ECPGdisconnect(int, const char *);
59 bool ECPGprepare(int, const char *, const bool, const char *, const char *);
60 bool ECPGdeallocate(int, int, const char *, const char *);
61 bool ECPGdeallocate_all(int, int, const char *);
62 char *ECPGprepared_statement(const char *, const char *, int);
63 PGconn *ECPGget_PGconn(const char *);
65 
66  /* print an error message */
67 void sqlprint(void);
68 
69 /* define this for simplicity as well as compatibility */
70 
71 #define SQLCODE sqlca.sqlcode
72 #define SQLSTATE sqlca.sqlstate
73 
74 /* dynamic SQL */
75 
76 bool ECPGdo_descriptor(int, const char *, const char *, const char *);
77 bool ECPGdeallocate_desc(int, const char *);
78 bool ECPGallocate_desc(int, const char *);
79 bool ECPGget_desc_header(int, const char *, int *);
80 bool ECPGget_desc(int, const char *, int,...);
81 bool ECPGset_desc_header(int, const char *, int);
82 bool ECPGset_desc(int, const char *, int,...);
83 
84 void ECPGset_noind_null(enum ECPGttype, void *);
85 bool ECPGis_noind_null(enum ECPGttype, const void *);
86 bool ECPGdescribe(int, int, bool, const char *, const char *,...);
87 
88 void ECPGset_var(int, void *, int);
89 void *ECPGget_var(int number);
90 
91 /* dynamic result allocation */
92 void ECPGfree_auto_mem(void);
93 
94 #ifdef ENABLE_THREAD_SAFETY
95 void ecpg_pthreads_init(void);
96 #endif
97 
98 #ifdef __cplusplus
99 }
100 #endif
101 
102 #endif /* _ECPGLIB_H */
unsigned char bool
Definition: ecpglib.h:31
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:336
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:2291
bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: execute.c:2276
bool ECPGtrans(int, const char *, const char *)
Definition: misc.c:198
ECPGttype
Definition: ecpgtype.h:41