7#define indicator_set ind_type != NULL && ind_type->type != ECPGt_NO_INDICATOR
118 return "ECPGt_unsigned_char";
121 return "ECPGt_short";
124 return "ECPGt_unsigned_short";
130 return "ECPGt_unsigned_int";
136 return "ECPGt_unsigned_long";
139 return "ECPGt_long_long";
142 return "ECPGt_unsigned_long_long";
145 return "ECPGt_float";
148 return "ECPGt_double";
154 return "ECPGt_varchar";
156 return "ECPGt_bytea";
158 return "ECPGt_NO_INDICATOR";
161 return "ECPGt_char_variable";
164 return "ECPGt_const";
167 return "ECPGt_decimal";
170 return "ECPGt_numeric";
173 return "ECPGt_interval";
176 return "ECPGt_descriptor";
179 return "ECPGt_sqlda";
185 return "ECPGt_timestamp";
188 return "ECPGt_string";
213 char *arrsize,
const char *
size,
const char *prefix,
int counter);
219 const char *ind_name,
struct ECPGtype *ind_type,
const int ind_brace_level,
220 const char *prefix,
const char *ind_prefix,
222 const char *ind_struct_sizeof)
236 if ((var->
type->type !=
type->type) ||
237 (var->
type->type_name && !
type->type_name) ||
238 (!var->
type->type_name &&
type->type_name) ||
239 (var->
type->type_name &&
type->type_name && strcmp(var->
type->type_name,
type->type_name) != 0))
265 switch (
type->u.element->type)
281 base_yyerror(
"internal error: unknown datatype, please report this to <" PACKAGE_BUGREPORT
">");
284 type->u.element->type,
285 type->u.element->size,
type->size, struct_sizeof ? struct_sizeof : NULL,
286 prefix,
type->u.element->counter);
332 ECPGdump_a_simple(o,
name,
type->type, str_varchar_one, (arr_str_size && strcmp(arr_str_size,
"0") != 0) ? arr_str_size : str_arr_one, struct_sizeof, prefix, 0);
334 ECPGdump_a_simple(o, ind_name,
ind_type->type,
ind_type->size, (arr_str_size && strcmp(arr_str_size,
"0") != 0) ? arr_str_size : str_neg_one, ind_struct_sizeof, ind_prefix, 0);
336 free(str_varchar_one);
348 char *ind_type_neg_one =
mm_strdup(
"-1");
358 free(ind_type_neg_one);
368 char *ind_type_neg_one =
mm_strdup(
"-1");
373 ECPGdump_a_simple(o,
name,
type->type,
type->size, (arr_str_size && strcmp(arr_str_size,
"0") != 0) ? arr_str_size : str_neg_one, struct_sizeof, prefix,
type->counter);
375 ECPGdump_a_simple(o, ind_name,
ind_type->type,
ind_type->size, (arr_str_size && strcmp(arr_str_size,
"0") != 0) ? arr_str_size : ind_type_neg_one, ind_struct_sizeof, ind_prefix, 0);
378 free(ind_type_neg_one);
396 fprintf(o,
"\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
399 fprintf(o,
"\n\tECPGt_descriptor, %s, 1L, 1L, 1L, ",
name);
401 fprintf(o,
"\n\tECPGt_sqlda, &%s, 0L, 0L, 0L, ",
name);
405 char *
offset = (
char *)
mm_alloc(strlen(
name) + strlen(
"sizeof(struct varchar_)") + 1 + strlen(
varcharsize) +
sizeof(int) * CHAR_BIT * 10 / 3);
434 struct_name =
"struct varchar";
436 struct_name =
"struct bytea";
448 char *sizeof_name =
"char";
468 sizeof_name =
"char *";
545 if (
size == NULL || strlen(
size) == 0)
546 fprintf(o,
"\n\t%s,%s,(long)%s,(long)%s,%s, ",
get_type(
type),
variable,
varcharsize,
arrsize,
offset);
548 fprintf(o,
"\n\t%s,%s,(long)%s,(long)%s,%s, ",
get_type(
type),
variable,
varcharsize,
arrsize,
size);
566 char *pbuf = (
char *)
mm_alloc(strlen(
name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 3);
567 char *ind_pbuf = (
char *)
mm_alloc(strlen(ind_name) + ((ind_prefix == NULL) ? 0 : strlen(ind_prefix)) + 3);
569 if (atoi(arrsize) == 1)
570 sprintf(pbuf,
"%s%s.", prefix ? prefix :
"",
name);
572 sprintf(pbuf,
"%s%s->", prefix ? prefix :
"",
name);
578 else if (ind_type != NULL)
580 if (atoi(arrsize) == 1)
581 sprintf(ind_pbuf,
"%s%s.", ind_prefix ? ind_prefix :
"", ind_name);
583 sprintf(ind_pbuf,
"%s%s->", ind_prefix ? ind_prefix :
"", ind_name);
585 ind_prefix = ind_pbuf;
589 for (p =
type->u.members; p; p = p->
next)
592 (ind_p != NULL) ? ind_p->
name : NULL,
593 (ind_p != NULL) ? ind_p->
type : NULL,
595 prefix, ind_prefix, arrsize,
type->struct_sizeof,
600 if (ind_p == NULL && p->
next != NULL)
639 switch (
type->u.element->type)
642 base_yyerror(
"internal error: found multidimensional array\n");
651 base_yyerror(
"internal error: unknown datatype, please report this to <" PACKAGE_BUGREPORT
">");
677 return "ECPGd_count";
683 return "ECPGd_di_code";
686 return "ECPGd_di_precision";
689 return "ECPGd_indicator";
692 return "ECPGd_key_member";
695 return "ECPGd_length";
701 return "ECPGd_nullable";
704 return "ECPGd_octet";
707 return "ECPGd_precision";
710 return "ECPGd_ret_length";
712 return "ECPGd_ret_octet";
715 return "ECPGd_scale";
721 return "ECPGd_cardinality";
#define fprintf(file, fmt, msg)
const char * ecpg_type_name(enum ECPGttype typ)
@ ECPGt_unsigned_long_long
#define IS_SIMPLE_TYPE(type)
char * mm_strdup(const char *string)
void base_yyerror(const char *error)
void mmerror(int error_code, enum errortype type, const char *error,...) pg_attribute_printf(3
#define INDICATOR_NOT_SIMPLE
void * mm_alloc(size_t size)
void void mmfatal(int error_code, const char *error,...) pg_attribute_printf(2
#define INDICATOR_NOT_STRUCT
struct ECPGtype ecpg_no_indicator
#define INDICATOR_NOT_ARRAY
struct variable * find_variable(const char *name)
static pg_noinline void Size size
struct ECPGstruct_member * next
struct ECPGstruct_member * members
struct ECPGtype * element
static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, char *arrsize, struct ECPGtype *type, struct ECPGtype *ind_type, const char *prefix, const char *ind_prefix)
void ECPGmake_struct_member(const char *name, struct ECPGtype *type, struct ECPGstruct_member **start)
static void ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, char *varcharsize, char *arrsize, const char *size, const char *prefix, int counter)
struct ECPGtype * ECPGmake_simple_type(enum ECPGttype type, const char *size, int counter)
const char * get_dtype(enum ECPGdtype type)
static const char * get_type(enum ECPGttype type)
void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype *type, const int brace_level, const char *ind_name, struct ECPGtype *ind_type, const int ind_brace_level, const char *prefix, const char *ind_prefix, char *arr_str_size, const char *struct_sizeof, const char *ind_struct_sizeof)
void ECPGfree_struct_member(struct ECPGstruct_member *rm)
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *rm)
void ECPGfree_type(struct ECPGtype *type)
static struct ECPGstruct_member struct_no_indicator
struct ECPGtype * ECPGmake_array_type(struct ECPGtype *type, const char *size)
struct ECPGtype * ECPGmake_struct_type(struct ECPGstruct_member *rm, enum ECPGttype type, const char *type_name, const char *struct_sizeof)