diff options
Diffstat (limited to 'src/interfaces/ecpg/ecpglib')
-rw-r--r-- | src/interfaces/ecpg/ecpglib/connect.c | 11 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/data.c | 38 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/descriptor.c | 54 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/execute.c | 88 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/extern.h | 138 | ||||
-rw-r--r-- | src/interfaces/ecpg/ecpglib/misc.c | 15 |
6 files changed, 185 insertions, 159 deletions
diff --git a/src/interfaces/ecpg/ecpglib/connect.c b/src/interfaces/ecpg/ecpglib/connect.c index 838cedf5c94..2dded3a17d4 100644 --- a/src/interfaces/ecpg/ecpglib/connect.c +++ b/src/interfaces/ecpg/ecpglib/connect.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.22 2004/06/10 22:26:21 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.23 2004/08/29 05:06:59 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -14,8 +14,9 @@ #ifdef ENABLE_THREAD_SAFETY static pthread_mutex_t connections_mutex = PTHREAD_MUTEX_INITIALIZER; -static pthread_key_t actual_connection_key; +static pthread_key_t actual_connection_key; static pthread_once_t actual_connection_key_once = PTHREAD_ONCE_INIT; + #else static struct connection *actual_connection = NULL; #endif @@ -25,7 +26,7 @@ static struct connection *all_connections = NULL; static void ecpg_actual_connection_init(void) { - pthread_key_create(&actual_connection_key, NULL); + pthread_key_create(&actual_connection_key, NULL); } #endif @@ -114,8 +115,8 @@ ecpg_finish(struct connection * act) } #ifdef ENABLE_THREAD_SAFETY - if( pthread_getspecific(actual_connection_key) == act ) - pthread_setspecific(actual_connection_key, all_connections); + if (pthread_getspecific(actual_connection_key) == act) + pthread_setspecific(actual_connection_key, all_connections); #else if (actual_connection == act) actual_connection = all_connections; diff --git a/src/interfaces/ecpg/ecpglib/data.c b/src/interfaces/ecpg/ecpglib/data.c index 04e944ce892..25738796fb2 100644 --- a/src/interfaces/ecpg/ecpglib/data.c +++ b/src/interfaces/ecpg/ecpglib/data.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.26 2004/07/04 15:02:22 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/data.c,v 1.27 2004/08/29 05:06:59 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -16,12 +16,16 @@ #include "pgtypes_timestamp.h" #include "pgtypes_interval.h" -static bool garbage_left(enum ARRAY_TYPE isarray, char *scan_length, enum COMPAT_MODE compat) +static bool +garbage_left(enum ARRAY_TYPE isarray, char *scan_length, enum COMPAT_MODE compat) { - /* INFORMIX allows for selecting a numeric into an int, the result is truncated */ - if (isarray == ECPG_ARRAY_NONE && INFORMIX_MODE(compat) && *scan_length == '.') + /* + * INFORMIX allows for selecting a numeric into an int, the result is + * truncated + */ + if (isarray == ECPG_ARRAY_NONE && INFORMIX_MODE(compat) && *scan_length == '.') return false; - + if (isarray == ECPG_ARRAY_ARRAY && *scan_length != ',' && *scan_length != '}') return true; @@ -44,7 +48,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, char *pval = (char *) PQgetvalue(results, act_tuple, act_field); int value_for_indicator = 0; - ECPGlog("ECPGget_data line %d: RESULT: %s offset: %ld array: %s\n", lineno, pval ? pval : "", offset, isarray?"Yes":"No"); + ECPGlog("ECPGget_data line %d: RESULT: %s offset: %ld array: %s\n", lineno, pval ? pval : "", offset, isarray ? "Yes" : "No"); /* pval is a pointer to the value */ /* let's check if it really is an array if it should be one */ @@ -228,7 +232,7 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, { *((unsigned long long int *) (var + offset * act_tuple)) = strtoull(pval, &scan_length, 10); if ((isarray && *scan_length != ',' && *scan_length != '}') - || (!isarray && !(INFORMIX_MODE(compat) && *scan_length == '.') && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */ + || (!isarray && !(INFORMIX_MODE(compat) && *scan_length == '.') && *scan_length != '\0' && *scan_length != ' ')) /* Garbage left */ { ECPGraise(lineno, ECPG_UINT_FORMAT, ECPG_SQLSTATE_DATATYPE_MISMATCH, pval); return (false); @@ -419,7 +423,10 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, if (INFORMIX_MODE(compat)) { - /* Informix wants its own NULL value here instead of an error */ + /* + * Informix wants its own NULL value here + * instead of an error + */ ECPGset_noind_null(ECPGt_numeric, nres); } else @@ -463,7 +470,10 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, { if (INFORMIX_MODE(compat)) { - /* Informix wants its own NULL value here instead of an error */ + /* + * Informix wants its own NULL value here + * instead of an error + */ ECPGset_noind_null(ECPGt_interval, ires); } else @@ -503,7 +513,10 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, { if (INFORMIX_MODE(compat)) { - /* Informix wants its own NULL value here instead of an error */ + /* + * Informix wants its own NULL value here + * instead of an error + */ ECPGset_noind_null(ECPGt_date, &ddres); } else @@ -542,7 +555,10 @@ ECPGget_data(const PGresult *results, int act_tuple, int act_field, int lineno, { if (INFORMIX_MODE(compat)) { - /* Informix wants its own NULL value here instead of an error */ + /* + * Informix wants its own NULL value here + * instead of an error + */ ECPGset_noind_null(ECPGt_timestamp, &tres); } else diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index bc56b0222bc..08c8d3479ce 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -1,6 +1,6 @@ /* dynamic SQL support routines * - * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.11 2004/07/05 09:45:53 meskes Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.12 2004/08/29 05:06:59 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL @@ -434,10 +434,10 @@ bool ECPGset_desc_header(int lineno, char *desc_name, int count) { struct descriptor *desc; - + for (desc = all_descriptors; desc; desc = desc->next) { - if (strcmp(desc_name, desc->name)==0) + if (strcmp(desc_name, desc->name) == 0) break; } @@ -461,7 +461,7 @@ ECPGset_desc(int lineno, char *desc_name, int index,...) for (desc = all_descriptors; desc; desc = desc->next) { - if (strcmp(desc_name, desc->name)==0) + if (strcmp(desc_name, desc->name) == 0) break; } @@ -486,7 +486,7 @@ ECPGset_desc(int lineno, char *desc_name, int index,...) } if (!(var = (struct variable *) ECPGalloc(sizeof(struct variable), lineno))) - return false; + return false; va_start(args, index); @@ -494,7 +494,7 @@ ECPGset_desc(int lineno, char *desc_name, int index,...) { enum ECPGdtype itemtype; enum ECPGttype type; - const char *tobeinserted = NULL; + const char *tobeinserted = NULL; bool malloced; itemtype = va_arg(args, enum ECPGdtype); @@ -508,17 +508,17 @@ ECPGset_desc(int lineno, char *desc_name, int index,...) switch (itemtype) { case ECPGd_data: - { - if (!ECPGstore_input(lineno, true, var, &tobeinserted, &malloced)) { - ECPGfree(var); - return false; + if (!ECPGstore_input(lineno, true, var, &tobeinserted, &malloced)) + { + ECPGfree(var); + return false; + } + + desc_item->data = (char *) tobeinserted; + tobeinserted = NULL; + break; } - - desc_item->data = (char *) tobeinserted; - tobeinserted = NULL; - break; - } case ECPGd_indicator: set_int_item(lineno, &desc_item->indicator, var->pointer, var->type); @@ -541,20 +541,20 @@ ECPGset_desc(int lineno, char *desc_name, int index,...) break; default: - { - char type_str[20]; - snprintf(type_str, sizeof(type_str), "%d", itemtype); - ECPGraise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, type_str); - ECPGfree(var); - return false; - } + { + char type_str[20]; + + snprintf(type_str, sizeof(type_str), "%d", itemtype); + ECPGraise(lineno, ECPG_UNKNOWN_DESCRIPTOR_ITEM, ECPG_SQLSTATE_ECPG_INTERNAL_ERROR, type_str); + ECPGfree(var); + return false; + } } - /*if (itemtype == ECPGd_data) - { - free(desc_item->data); - desc_item->data = NULL; - }*/ + /* + * if (itemtype == ECPGd_data) { free(desc_item->data); + * desc_item->data = NULL; } + */ } while (true); ECPGfree(var); diff --git a/src/interfaces/ecpg/ecpglib/execute.c b/src/interfaces/ecpg/ecpglib/execute.c index a3a601aed52..ac16e457dd8 100644 --- a/src/interfaces/ecpg/ecpglib/execute.c +++ b/src/interfaces/ecpg/ecpglib/execute.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.37 2004/07/05 09:45:53 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/execute.c,v 1.38 2004/08/29 05:06:59 momjian Exp $ */ /* * The aim is to get a simpler inteface to the database routines. @@ -70,7 +70,7 @@ quote_postgres(char *arg, int lineno) } void -ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable *var, bool indicator) +ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable * var, bool indicator) { var->type = type; var->pointer = va_arg(*ap, char *); @@ -78,15 +78,14 @@ ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable *var, bool in var->varcharsize = va_arg(*ap, long); var->arrsize = va_arg(*ap, long); var->offset = va_arg(*ap, long); - + if (var->arrsize == 0 || var->varcharsize == 0) var->value = *((char **) (var->pointer)); else var->value = var->pointer; /* - * negative values are used to indicate an array without given - * bounds + * negative values are used to indicate an array without given bounds */ /* reset to zero for us */ if (var->arrsize < 0) @@ -95,7 +94,7 @@ ECPGget_variable(va_list *ap, enum ECPGttype type, struct variable *var, bool in var->varcharsize = 0; var->next = NULL; - + if (indicator) { var->ind_type = va_arg(*ap, enum ECPGttype); @@ -245,19 +244,19 @@ ECPGtypeinfocache_push(struct ECPGtype_information_cache ** cache, int oid, bool { struct ECPGtype_information_cache *new_entry = (struct ECPGtype_information_cache *) ECPGalloc(sizeof(struct ECPGtype_information_cache), lineno); - + new_entry->oid = oid; new_entry->isarray = isarray; new_entry->next = *cache; *cache = new_entry; } - + static enum ARRAY_TYPE ECPGis_type_an_array(int type, const struct statement * stmt, const struct variable * var) { - char *array_query; - enum ARRAY_TYPE isarray = ECPG_ARRAY_NOT_SET; - PGresult *query; + char *array_query; + enum ARRAY_TYPE isarray = ECPG_ARRAY_NOT_SET; + PGresult *query; struct ECPGtype_information_cache *cache_entry; if ((stmt->connection->cache_head) == NULL) @@ -319,14 +318,14 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia if (cache_entry->oid == type) return cache_entry->isarray; } - + array_query = (char *) ECPGalloc(strlen("select typlen from pg_type where oid= and typelem<>0") + 11, stmt->lineno); sprintf(array_query, "select typlen from pg_type where oid=%d and typelem<>0", type); query = PQexec(stmt->connection->connection, array_query); ECPGfree(array_query); - if (PQresultStatus(query) == PGRES_TUPLES_OK ) + if (PQresultStatus(query) == PGRES_TUPLES_OK) { - if ( PQntuples(query) == 0 ) + if (PQntuples(query) == 0) isarray = ECPG_ARRAY_NONE; else { @@ -343,7 +342,7 @@ ECPGis_type_an_array(int type, const struct statement * stmt, const struct varia } PQclear(query); ECPGtypeinfocache_push(&(stmt->connection->cache_head), type, isarray, stmt->lineno); - ECPGlog("ECPGis_type_an_array line %d: TYPE database: %d C: %d array: %s\n", stmt->lineno, type, var->type, isarray?"Yes":"No"); + ECPGlog("ECPGis_type_an_array line %d: TYPE database: %d C: %d array: %s\n", stmt->lineno, type, var->type, isarray ? "Yes" : "No"); return isarray; } @@ -352,7 +351,7 @@ bool ECPGstore_result(const PGresult *results, int act_field, const struct statement * stmt, struct variable * var) { - enum ARRAY_TYPE isarray; + enum ARRAY_TYPE isarray; int act_tuple, ntuples = PQntuples(results); bool status = true; @@ -368,7 +367,7 @@ ECPGstore_result(const PGresult *results, int act_field, { ECPGlog("ECPGstore_result line %d: Incorrect number of matches: %d don't fit into array of %d\n", stmt->lineno, ntuples, var->arrsize); - ECPGraise(stmt->lineno, INFORMIX_MODE(stmt->compat)?ECPG_INFORMIX_SUBSELECT_NOT_ONE:ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL); + ECPGraise(stmt->lineno, INFORMIX_MODE(stmt->compat) ? ECPG_INFORMIX_SUBSELECT_NOT_ONE : ECPG_TOO_MANY_MATCHES, ECPG_SQLSTATE_CARDINALITY_VIOLATION, NULL); return false; } } @@ -797,7 +796,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia case ECPGt_unsigned_char: { /* set slen to string length if type is char * */ - int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize; + int slen = (var->varcharsize == 0) ? strlen((char *) var->value) : var->varcharsize; if (!(newcopy = ECPGalloc(slen + 1, lineno))) return false; @@ -1036,7 +1035,7 @@ ECPGstore_input(const int lineno, const bool force_indicator, const struct varia free(str); } break; - + case ECPGt_descriptor: break; @@ -1059,7 +1058,7 @@ ECPGexecute(struct statement * stmt) PGresult *results; PGnotify *notify; struct variable *var; - int desc_counter = 0; + int desc_counter = 0; copiedquery = ECPGstrdup(stmt->command, stmt->lineno); @@ -1074,32 +1073,39 @@ ECPGexecute(struct statement * stmt) while (var) { char *newcopy = NULL; - const char *tobeinserted; + const char *tobeinserted; char *p; - bool malloced = FALSE; - int hostvarl = 0; + bool malloced = FALSE; + int hostvarl = 0; tobeinserted = NULL; - - /* A descriptor is a special case since it contains many variables but is listed only once. */ + + /* + * A descriptor is a special case since it contains many variables + * but is listed only once. + */ if (var->type == ECPGt_descriptor) { - /* We create an additional variable list here, so the same logic applies. */ + /* + * We create an additional variable list here, so the same + * logic applies. + */ struct variable desc_inlist; struct descriptor *desc; struct descriptor_item *desc_item; + for (desc = all_descriptors; desc; desc = desc->next) { if (strcmp(var->pointer, desc->name) == 0) break; } - + if (desc == NULL) { ECPGraise(stmt->lineno, ECPG_UNKNOWN_DESCRIPTOR, ECPG_SQLSTATE_INVALID_SQL_DESCRIPTOR_NAME, var->pointer); return false; } - + desc_counter++; if (desc->count < 0 || desc->count >= desc_counter) { @@ -1129,7 +1135,7 @@ ECPGexecute(struct statement * stmt) } if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, &desc_inlist, &tobeinserted, &malloced)) return false; - + break; } } @@ -1145,12 +1151,12 @@ ECPGexecute(struct statement * stmt) if (!ECPGstore_input(stmt->lineno, stmt->force_indicator, var, &tobeinserted, &malloced)) return false; } - + if (tobeinserted) { /* - * Now tobeinserted points to an area that is to be inserted at - * the first %s + * Now tobeinserted points to an area that is to be inserted + * at the first %s */ if (!(newcopy = (char *) ECPGalloc(strlen(copiedquery) + strlen(tobeinserted) + 1, stmt->lineno))) return false; @@ -1159,8 +1165,8 @@ ECPGexecute(struct statement * stmt) if ((p = next_insert(newcopy + hostvarl)) == NULL) { /* - * We have an argument but we dont have the matched up string - * in the string + * We have an argument but we dont have the matched up + * string in the string */ ECPGraise(stmt->lineno, ECPG_TOO_MANY_ARGUMENTS, ECPG_SQLSTATE_USING_CLAUSE_DOES_NOT_MATCH_PARAMETERS, NULL); return false; @@ -1171,8 +1177,8 @@ ECPGexecute(struct statement * stmt) hostvarl = strlen(newcopy); /* - * The strange thing in the second argument is the rest of the - * string from the old string + * The strange thing in the second argument is the rest of + * the string from the old string */ strcat(newcopy, copiedquery @@ -1181,9 +1187,9 @@ ECPGexecute(struct statement * stmt) } /* - * Now everything is safely copied to the newcopy. Lets free the - * oldcopy and let the copiedquery get the var->value from the - * newcopy. + * Now everything is safely copied to the newcopy. Lets free + * the oldcopy and let the copiedquery get the var->value from + * the newcopy. */ if (malloced) { @@ -1194,9 +1200,9 @@ ECPGexecute(struct statement * stmt) ECPGfree(copiedquery); copiedquery = newcopy; } - + if (desc_counter == 0) - var = var->next; + var = var->next; } /* Check if there are unmatched things left. */ diff --git a/src/interfaces/ecpg/ecpglib/extern.h b/src/interfaces/ecpg/ecpglib/extern.h index 74a8b046c92..8a04ad0aaf1 100644 --- a/src/interfaces/ecpg/ecpglib/extern.h +++ b/src/interfaces/ecpg/ecpglib/extern.h @@ -7,42 +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); - -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 *); +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); + +struct descriptor *ecpggetdescp(int, char *); /* A generic varchar type. */ struct ECPGgeneric_varchar { - int len; - char arr[1]; + int len; + char arr[1]; }; /* @@ -51,81 +51,81 @@ 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; - int count; - struct descriptor_item *items; + 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; + 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_input(const int, const bool, const struct variable *, const char **, bool *); -void ECPGget_variable(va_list *, enum ECPGttype, struct variable *, bool); +bool ECPGstore_result(const PGresult *results, int act_field, + const struct statement * stmt, struct variable * var); +bool ECPGstore_input(const int, const bool, const struct variable *, const char **, bool *); +void ECPGget_variable(va_list *, enum ECPGttype, struct variable *, bool); /* SQLSTATE values generated or processed by ecpglib (intentionally * not exported -- users should refer to the codes directly) */ @@ -153,4 +153,4 @@ void ECPGget_variable(va_list *, enum ECPGttype, struct variable *, bool); #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 */ diff --git a/src/interfaces/ecpg/ecpglib/misc.c b/src/interfaces/ecpg/ecpglib/misc.c index 8faf6b2fdff..69789d9da17 100644 --- a/src/interfaces/ecpg/ecpglib/misc.c +++ b/src/interfaces/ecpg/ecpglib/misc.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.21 2004/06/27 12:28:40 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.22 2004/08/29 05:06:59 momjian Exp $ */ #define POSTGRES_ECPG_INTERNAL #include "postgres_fe.h" @@ -118,15 +118,18 @@ ECPGinit(const struct connection * con, const char *connection_name, const int l } #ifdef ENABLE_THREAD_SAFETY -static void ecpg_sqlca_key_destructor(void *arg) +static void +ecpg_sqlca_key_destructor(void *arg) { - if( arg != NULL ) - free(arg); /* sqlca structure allocated in ECPGget_sqlca */ + if (arg != NULL) + free(arg); /* sqlca structure allocated in + * ECPGget_sqlca */ } -static void ecpg_sqlca_key_init(void) +static void +ecpg_sqlca_key_init(void) { - pthread_key_create(&sqlca_key, ecpg_sqlca_key_destructor); + pthread_key_create(&sqlca_key, ecpg_sqlca_key_destructor); } #endif |