diff options
| author | Michael Meskes <meskes@postgresql.org> | 2003-03-16 10:42:54 +0000 |
|---|---|---|
| committer | Michael Meskes <meskes@postgresql.org> | 2003-03-16 10:42:54 +0000 |
| commit | a4f25b6a9c2dbf5f38e498922e3761cb3bf46ba0 (patch) | |
| tree | 54ff23d698b18c898c8fd7903df29b76e95df9fb /src/interfaces/ecpg/ecpglib/extern.h | |
| parent | 48dfa0d057e0d9b2244ff1706dd72e91a0b45064 (diff) | |
Started working on a seperate pgtypes library. First test work. PLEASE test compilation on iother systems.
Diffstat (limited to 'src/interfaces/ecpg/ecpglib/extern.h')
| -rw-r--r-- | src/interfaces/ecpg/ecpglib/extern.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h new file mode 100644 index 00000000000..a5014512c9e --- /dev/null +++ b/src/interfaces/ecpg/ecpglib/extern.h @@ -0,0 +1,103 @@ +#ifndef _ECPG_LIB_EXTERN_H +#define _ECPG_LIB_EXTERN_H + +#include "postgres_fe.h" +#include "libpq-fe.h" + +/* Here are some methods used by the lib. */ + +/* Stores the backend error message for client access */ +void set_backend_err(const char *err, int lineon); + +/* Store and retrieve the backend error message for client access */ +void set_backend_err(const char *err, int lineon); +char *ECPGerrmsg(void); + +/* Returns a pointer to a string containing a simple type name. */ +void ECPGadd_mem(void *ptr, int lineno); + +bool ECPGget_data(const PGresult *, int, int, int, enum ECPGttype type, + enum ECPGttype, char *, char *, long, long, long, bool); +struct connection *ECPGget_connection(const char *); +void ECPGinit_sqlca(void); +char *ECPGalloc(long, int); +char *ECPGrealloc(void *, long, int); +void ECPGfree(void *); +bool ECPGinit(const struct connection *, const char *, const int); +char *ECPGstrdup(const char *, int); +const char *ECPGtype_name(enum ECPGttype); +unsigned int ECPGDynamicType(Oid); +void ECPGfree_auto_mem(void); +void ECPGclear_auto_mem(void); + +/* A generic varchar type. */ +struct ECPGgeneric_varchar +{ + int len; + char arr[1]; +}; + +/* + * type information cache + */ + +struct ECPGtype_information_cache +{ + struct ECPGtype_information_cache *next; + int oid; + bool isarray; +}; + +/* structure to store one statement */ +struct statement +{ + int lineno; + char *command; + struct connection *connection; + struct variable *inlist; + struct variable *outlist; +}; + +/* structure to store connections */ +struct connection +{ + char *name; + PGconn *connection; + bool committed; + int autocommit; + struct ECPGtype_information_cache *cache_head; + struct connection *next; +}; + +/* structure to store descriptors */ +struct descriptor +{ + char *name; + PGresult *result; + struct descriptor *next; +}; + +struct variable +{ + enum ECPGttype type; + void *value; + void *pointer; + long varcharsize; + long arrsize; + long offset; + enum ECPGttype ind_type; + void *ind_value; + void *ind_pointer; + long ind_varcharsize; + long ind_arrsize; + long ind_offset; + struct variable *next; +}; + +PGresult ** + ECPGdescriptor_lvalue(int line, const char *descriptor); + +bool ECPGstore_result(const PGresult *results, int act_field, + const struct statement * stmt, struct variable * var); + +#endif /* _ECPG_LIB_EXTERN_H */ |
