mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Added SET DESCRIPTOR command.
Note that this still has some bugs. The functionality is there though, it's just a matter of fixing the bugs now. Cleaned up error handling in preprocessor.
This commit is contained in:
@ -7,39 +7,42 @@
|
||||
|
||||
enum COMPAT_MODE
|
||||
{
|
||||
ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE
|
||||
ECPG_COMPAT_PGSQL = 0, ECPG_COMPAT_INFORMIX, ECPG_COMPAT_INFORMIX_SE
|
||||
};
|
||||
|
||||
#define INFORMIX_MODE(X) ((X) == ECPG_COMPAT_INFORMIX || (X) == ECPG_COMPAT_INFORMIX_SE)
|
||||
|
||||
enum ARRAY_TYPE
|
||||
{
|
||||
ECPG_ARRAY_NOT_SET, ECPG_ARRAY_ARRAY, ECPG_ARRAY_VECTOR, ECPG_ARRAY_NONE
|
||||
ECPG_ARRAY_NOT_SET, ECPG_ARRAY_ARRAY, ECPG_ARRAY_VECTOR, ECPG_ARRAY_NONE
|
||||
};
|
||||
|
||||
/* Here are some methods used by the lib. */
|
||||
|
||||
/* Returns a pointer to a string containing a simple type name. */
|
||||
void ECPGadd_mem(void *ptr, int lineno);
|
||||
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, enum ARRAY_TYPE, enum COMPAT_MODE, bool);
|
||||
struct connection *ECPGget_connection(const char *);
|
||||
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);
|
||||
bool ECPGget_data (const PGresult *, int, int, int, enum ECPGttype type,
|
||||
enum ECPGttype, char *, char *, long, long, long,
|
||||
enum ARRAY_TYPE, enum COMPAT_MODE, bool);
|
||||
struct connection *ECPGget_connection (const char *);
|
||||
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);
|
||||
|
||||
struct descriptor *ecpggetdescp (int, char *);
|
||||
|
||||
/* A generic varchar type. */
|
||||
struct ECPGgeneric_varchar
|
||||
{
|
||||
int len;
|
||||
char arr[1];
|
||||
int len;
|
||||
char arr[1];
|
||||
};
|
||||
|
||||
/*
|
||||
@ -48,64 +51,79 @@ struct ECPGgeneric_varchar
|
||||
|
||||
struct ECPGtype_information_cache
|
||||
{
|
||||
struct ECPGtype_information_cache *next;
|
||||
int oid;
|
||||
bool isarray;
|
||||
struct ECPGtype_information_cache *next;
|
||||
int oid;
|
||||
bool isarray;
|
||||
};
|
||||
|
||||
/* structure to store one statement */
|
||||
struct statement
|
||||
{
|
||||
int lineno;
|
||||
char *command;
|
||||
struct connection *connection;
|
||||
enum COMPAT_MODE compat;
|
||||
bool force_indicator;
|
||||
struct variable *inlist;
|
||||
struct variable *outlist;
|
||||
int lineno;
|
||||
char *command;
|
||||
struct connection *connection;
|
||||
enum COMPAT_MODE compat;
|
||||
bool force_indicator;
|
||||
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;
|
||||
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;
|
||||
char *name;
|
||||
PGresult *result;
|
||||
struct descriptor *next;
|
||||
int count;
|
||||
struct descriptor_item *items;
|
||||
};
|
||||
|
||||
extern struct descriptor *all_descriptors;
|
||||
|
||||
struct descriptor_item
|
||||
{
|
||||
int num;
|
||||
char *data;
|
||||
int indicator;
|
||||
int length;
|
||||
int precision;
|
||||
int scale;
|
||||
int type;
|
||||
struct descriptor_item *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;
|
||||
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);
|
||||
PGresult **ECPGdescriptor_lvalue (int line, const char *descriptor);
|
||||
|
||||
bool ECPGstore_result(const PGresult *results, int act_field,
|
||||
const struct statement * stmt, struct variable * var);
|
||||
bool ECPGstore_result (const PGresult * results, int act_field,
|
||||
const struct statement *stmt, struct variable *var);
|
||||
|
||||
/* SQLSTATE values generated or processed by ecpglib (intentionally
|
||||
* not exported -- users should refer to the codes directly) */
|
||||
@ -133,4 +151,4 @@ bool ECPGstore_result(const PGresult *results, int act_field,
|
||||
#define ECPG_SQLSTATE_ECPG_INTERNAL_ERROR "YE000"
|
||||
#define ECPG_SQLSTATE_ECPG_OUT_OF_MEMORY "YE001"
|
||||
|
||||
#endif /* _ECPG_LIB_EXTERN_H */
|
||||
#endif /* _ECPG_LIB_EXTERN_H */
|
||||
|
Reference in New Issue
Block a user