codekingpro/portable-devtools
114k
1/*2 * Client-visible declarations for ecpglib3 *4 * src/interfaces/ecpg/include/ecpglib.h5 */6 7#ifndef _ECPGLIB_H8#define _ECPGLIB_H9 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 postgres19 * definitions into ecpg programs; but we need to know what bool is.20 */21#ifndef __cplusplus22 23#ifdef PG_USE_STDBOOL24#include <stdbool.h>25#else26 27/*28 * We assume bool has been defined if true and false are. This avoids29 * duplicate-typedef errors if this file is included after c.h.30 */31#if !(defined(true) && defined(false))32typedef unsigned char bool;33#endif34 35#ifndef true36#define true ((bool) 1)37#endif38 39#ifndef false40#define false ((bool) 0)41#endif42 43#endif /* not PG_USE_STDBOOL */44#endif /* not C++ */45 46 47#ifdef __cplusplus48extern "C"49{50#endif51 52void ECPGdebug(int n, FILE *dbgs);53bool ECPGstatus(int lineno, const char *connection_name);54bool ECPGsetcommit(int lineno, const char *mode, const char *connection_name);55bool ECPGsetconn(int lineno, const char *connection_name);56bool ECPGconnect(int lineno, int c, const char *name, const char *user,57 const char *passwd, const char *connection_name, int autocommit);58bool ECPGdo(const int lineno, const int compat, const int force_indicator,59 const char *connection_name, const bool questionmarks,60 const int st, const char *query,...);61bool ECPGtrans(int lineno, const char *connection_name, const char *transaction);62bool ECPGdisconnect(int lineno, const char *connection_name);63bool ECPGprepare(int lineno, const char *connection_name, const bool questionmarks,64 const char *name, const char *variable);65bool ECPGdeallocate(int lineno, int c, const char *connection_name, const char *name);66bool ECPGdeallocate_all(int lineno, int compat, const char *connection_name);67char *ECPGprepared_statement(const char *connection_name, const char *name, int lineno);68PGconn *ECPGget_PGconn(const char *connection_name);69PGTransactionStatusType ECPGtransactionStatus(const char *connection_name);70 71 /* print an error message */72void sqlprint(void);73 74/* define this for simplicity as well as compatibility */75 76#define SQLCODE sqlca.sqlcode77#define SQLSTATE sqlca.sqlstate78 79/* dynamic SQL */80 81bool ECPGdo_descriptor(int line, const char *connection,82 const char *descriptor, const char *query);83bool ECPGdeallocate_desc(int line, const char *name);84bool ECPGallocate_desc(int line, const char *name);85bool ECPGget_desc_header(int lineno, const char *desc_name, int *count);86bool ECPGget_desc(int lineno, const char *desc_name, int index,...);87bool ECPGset_desc_header(int lineno, const char *desc_name, int count);88bool ECPGset_desc(int lineno, const char *desc_name, int index,...);89 90void ECPGset_noind_null(enum ECPGttype type, void *ptr);91bool ECPGis_noind_null(enum ECPGttype type, const void *ptr);92bool ECPGdescribe(int line, int compat, bool input,93 const char *connection_name, const char *stmt_name,...);94 95void ECPGset_var(int number, void *pointer, int lineno);96void *ECPGget_var(int number);97 98/* dynamic result allocation */99void ECPGfree_auto_mem(void);100 101#ifdef ENABLE_THREAD_SAFETY102void ecpg_pthreads_init(void);103#endif104 105#ifdef __cplusplus106}107#endif108 109#endif /* _ECPGLIB_H */110 