PostgreSQL Source Code  git master
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 bool ECPGdeclare(int, const char *, const char *);
59 bool ECPGopen(const char *, const char *, const int, const int, const int, const char *, const bool, const int, const char *,...);
60 bool ECPGfetch(const char *, const int, const int, const int, const char *, const bool, const int, const char *,...);
61 bool ECPGclose(const char *, const int, const int, const int, const char *, const bool, const 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 */
bool ECPGdeallocate_desc(int, const char *)
Definition: descriptor.c:755
bool ECPGdeallocate_all(int, int, const char *)
Definition: prepare.c:383
bool ECPGclose(const char *, const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: cursor.c:125
bool ECPGprepare(int, const char *, const bool, const char *, const char *)
Definition: prepare.c:228
bool ECPGdescribe(int, int, bool, const char *, const char *,...)
Definition: descriptor.c:857
bool ECPGget_desc(int, const char *, int,...)
Definition: descriptor.c:246
void ECPGfree_auto_mem(void)
Definition: memory.c:138
void ECPGset_noind_null(enum ECPGttype, void *)
Definition: misc.c:320
void * ECPGget_var(int number)
Definition: misc.c:586
bool ECPGset_desc_header(int, const char *, int)
Definition: descriptor.c:580
bool ECPGstatus(int, const char *)
Definition: misc.c:165
char * ECPGprepared_statement(const char *, const char *, int)
Definition: prepare.c:401
PGconn * ECPGget_PGconn(const char *)
Definition: connect.c:740
bool ECPGfetch(const char *, const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: cursor.c:83
bool ECPGopen(const char *, const char *, const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: cursor.c:28
void sqlprint(void)
Definition: error.c:343
bool ECPGdisconnect(int, const char *)
Definition: connect.c:686
bool ECPGis_noind_null(enum ECPGttype, const void *)
Definition: misc.c:391
bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int)
Definition: connect.c:271
void ECPGdebug(int, FILE *)
Definition: misc.c:243
PGTransactionStatusType ECPGtransactionStatus(const char *)
Definition: misc.c:183
#define pg_attribute_format_arg(a)
Definition: c.h:131
bool ECPGallocate_desc(int, const char *)
Definition: descriptor.c:802
#define ecpg_gettext(x)
Definition: ecpglib.h:18
bool ECPGset_desc(int, const char *, int,...)
Definition: descriptor.c:612
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:337
bool ECPGget_desc_header(int, const char *, int *)
Definition: descriptor.c:92
void ECPGset_var(int, void *, int)
Definition: misc.c:531
bool ECPGsetconn(int, const char *)
Definition: connect.c:202
bool ECPGdo_descriptor(int, const char *, const char *, const char *)
Definition: execute.c:2317
bool ECPGdeclare(int, const char *, const char *)
Definition: prepare.c:655
bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...)
Definition: execute.c:2279
bool ECPGtrans(int, const char *, const char *)
Definition: misc.c:199
ECPGttype
Definition: ecpgtype.h:41