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
16extern 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
43extern "C"
44{
45#endif
46
47void ECPGdebug(int, FILE *);
48bool ECPGstatus(int, const char *);
49bool ECPGsetcommit(int, const char *, const char *);
50bool ECPGsetconn(int, const char *);
51bool ECPGconnect(int, int, const char *, const char *, const char *, const char *, int);
52bool ECPGdo(const int, const int, const int, const char *, const bool, const int, const char *,...);
53bool ECPGtrans(int, const char *, const char *);
54bool ECPGdisconnect(int, const char *);
55bool ECPGprepare(int, const char *, const bool, const char *, const char *);
56bool ECPGdeallocate(int, int, const char *, const char *);
57bool ECPGdeallocate_all(int, int, const char *);
58char *ECPGprepared_statement(const char *, const char *, int);
59PGconn *ECPGget_PGconn(const char *);
60PGTransactionStatusType ECPGtransactionStatus(const char *);
61
62char *ECPGerrmsg(void);
63
64 /* print an error message */
65void 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
74bool ECPGdo_descriptor(int, const char *, const char *, const char *);
75bool ECPGdeallocate_desc(int, const char *);
76bool ECPGallocate_desc(int, const char *);
77bool ECPGget_desc_header(int, const char *, int *);
78bool ECPGget_desc(int, const char *, int,...);
79bool ECPGset_desc_header(int, const char *, int);
80bool ECPGset_desc(int, const char *, int,...);
81
82void ECPGset_noind_null(enum ECPGttype, void *);
83bool ECPGis_noind_null(enum ECPGttype, const void *);
84bool ECPGdescribe(int, int, bool, const char *, const char *,...);
85
86void ECPGset_var(int, void *, int);
87void *ECPGget_var(int number);
88
89/* dynamic result allocation */
90void ECPGfree_auto_mem(void);
91
92#ifdef ENABLE_THREAD_SAFETY
93void ecpg_pthreads_init(void);
94#endif
95
96#ifdef __cplusplus
97}
98#endif
99
100#endif /* _ECPGLIB_H */
101