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