7 #define indicator_set ind_type != NULL && ind_type->type != ECPGt_NO_INDICATOR
27 char *
new = strdup(
string);
141 return "ECPGt_unsigned_char";
144 return "ECPGt_short";
147 return "ECPGt_unsigned_short";
153 return "ECPGt_unsigned_int";
159 return "ECPGt_unsigned_long";
162 return "ECPGt_long_long";
165 return "ECPGt_unsigned_long_long";
168 return "ECPGt_float";
171 return "ECPGt_double";
177 return "ECPGt_varchar";
179 return "ECPGt_bytea";
181 return "ECPGt_NO_INDICATOR";
184 return "ECPGt_char_variable";
187 return "ECPGt_const";
190 return "ECPGt_decimal";
193 return "ECPGt_numeric";
196 return "ECPGt_interval";
199 return "ECPGt_descriptor";
202 return "ECPGt_sqlda";
208 return "ECPGt_timestamp";
211 return "ECPGt_string";
236 char *arrsize,
const char *
size,
const char *prefix,
int counter);
242 const char *ind_name,
struct ECPGtype *ind_type,
const int ind_brace_level,
243 const char *prefix,
const char *ind_prefix,
245 const char *ind_struct_sizeof)
259 if ((var->
type->type !=
type->type) ||
260 (var->
type->type_name && !
type->type_name) ||
261 (!var->
type->type_name &&
type->type_name) ||
262 (var->
type->type_name &&
type->type_name && strcmp(var->
type->type_name,
type->type_name) != 0))
288 switch (
type->u.element->type)
304 base_yyerror(
"internal error: unknown datatype, please report this to <" PACKAGE_BUGREPORT
">");
307 type->u.element->type,
308 type->u.element->size,
type->size, struct_sizeof ? struct_sizeof : NULL,
309 prefix,
type->u.element->counter);
355 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);
357 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);
359 free(str_varchar_one);
371 char *ind_type_neg_one =
mm_strdup(
"-1");
381 free(ind_type_neg_one);
391 char *ind_type_neg_one =
mm_strdup(
"-1");
396 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);
398 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);
401 free(ind_type_neg_one);
419 fprintf(o,
"\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ");
422 fprintf(o,
"\n\tECPGt_descriptor, %s, 1L, 1L, 1L, ",
name);
424 fprintf(o,
"\n\tECPGt_sqlda, &%s, 0L, 0L, 0L, ",
name);
428 char *
offset = (
char *)
mm_alloc(strlen(
name) + strlen(
"sizeof(struct varchar_)") + 1 + strlen(
varcharsize) +
sizeof(int) * CHAR_BIT * 10 / 3);
457 struct_name =
"struct varchar";
459 struct_name =
"struct bytea";
471 char *sizeof_name =
"char";
491 sizeof_name =
"char *";
568 if (
size == NULL || strlen(
size) == 0)
569 fprintf(o,
"\n\t%s,%s,(long)%s,(long)%s,%s, ",
get_type(
type),
variable,
varcharsize,
arrsize,
offset);
571 fprintf(o,
"\n\t%s,%s,(long)%s,(long)%s,%s, ",
get_type(
type),
variable,
varcharsize,
arrsize,
size);
589 char *pbuf = (
char *)
mm_alloc(strlen(
name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 3);
590 char *ind_pbuf = (
char *)
mm_alloc(strlen(ind_name) + ((ind_prefix == NULL) ? 0 : strlen(ind_prefix)) + 3);
592 if (atoi(arrsize) == 1)
593 sprintf(pbuf,
"%s%s.", prefix ? prefix :
"",
name);
595 sprintf(pbuf,
"%s%s->", prefix ? prefix :
"",
name);
601 else if (ind_type != NULL)
603 if (atoi(arrsize) == 1)
604 sprintf(ind_pbuf,
"%s%s.", ind_prefix ? ind_prefix :
"", ind_name);
606 sprintf(ind_pbuf,
"%s%s->", ind_prefix ? ind_prefix :
"", ind_name);
608 ind_prefix = ind_pbuf;
612 for (p =
type->u.members; p; p = p->
next)
615 (ind_p != NULL) ? ind_p->
name : NULL,
616 (ind_p != NULL) ? ind_p->
type : NULL,
618 prefix, ind_prefix, arrsize,
type->struct_sizeof,
623 if (ind_p == NULL && p->
next != NULL)
662 switch (
type->u.element->type)
665 base_yyerror(
"internal error: found multidimensional array\n");
675 base_yyerror(
"internal error: unknown datatype, please report this to <" PACKAGE_BUGREPORT
">");
698 return "ECPGd_count";
704 return "ECPGd_di_code";
707 return "ECPGd_di_precision";
710 return "ECPGd_indicator";
713 return "ECPGd_key_member";
716 return "ECPGd_length";
722 return "ECPGd_nullable";
725 return "ECPGd_octet";
728 return "ECPGd_precision";
731 return "ECPGd_ret_length";
733 return "ECPGd_ret_octet";
736 return "ECPGd_scale";
742 return "ECPGd_cardinality";
const char * ecpg_type_name(enum ECPGttype typ)
@ ECPGt_unsigned_long_long
#define IS_SIMPLE_TYPE(type)
void base_yyerror(const char *error)
void mmerror(int error_code, enum errortype type, const char *error,...) pg_attribute_printf(3
struct variable * find_variable(char *name)
#define INDICATOR_NOT_SIMPLE
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
static pg_noinline void Size size
struct ECPGstruct_member * next
struct ECPGstruct_member * members
struct ECPGtype * element
struct ECPGtype * ECPGmake_array_type(struct ECPGtype *type, char *size)
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)
struct ECPGtype * ECPGmake_simple_type(enum ECPGttype type, char *size, int counter)
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)
char * mm_strdup(const char *string)
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)
static const char * get_type(enum ECPGttype type)
void ECPGfree_struct_member(struct ECPGstruct_member *rm)
struct ECPGstruct_member * ECPGstruct_member_dup(struct ECPGstruct_member *rm)
struct ECPGtype * ECPGmake_struct_type(struct ECPGstruct_member *rm, enum ECPGttype type, char *type_name, char *struct_sizeof)
void ECPGfree_type(struct ECPGtype *type)
static struct ECPGstruct_member struct_no_indicator
const char * get_dtype(enum ECPGdtype type)
void * mm_alloc(size_t size)