diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c index 06a8c26037e059e7789ad05462a35a38c41881a8..04083241c18c1c2964d0a2b8246c2456ee19f994 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -1,7 +1,7 @@ /* * functions needed for descriptor handling * - * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.31 2010/02/26 02:01:31 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/descriptor.c,v 1.32 2010/03/09 11:09:45 meskes Exp $ * * since descriptor might be either a string constant or a string var * we need to check for a constant if we expect a constant @@ -338,7 +338,7 @@ sqlda_variable(const char *name) p->type->size = NULL; p->type->struct_sizeof = NULL; p->type->u.element = NULL; - p->type->lineno = 0; + p->type->counter = 0; p->brace_level = 0; p->next = NULL; diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 167951295c92fb4066b0125a2cfa0317b1a65c53..6b05776ee583141e51c576fcdf683c8a639fb943 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.13 2010/01/29 16:28:13 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.header,v 1.14 2010/03/09 11:09:45 meskes Exp $ */ /* Copyright comment */ %{ @@ -44,6 +44,7 @@ static int pacounter = 1; static char pacounter_buffer[sizeof(int) * CHAR_BIT * 10 / 3]; /* a rough guess at the size we need */ static struct this_type actual_type[STRUCT_DEPTH]; static char *actual_startline[STRUCT_DEPTH]; +static int varchar_counter = 1; /* temporarily store struct members while creating the data structure */ struct ECPGstruct_member *struct_member_list[STRUCT_DEPTH] = { NULL }; @@ -275,12 +276,12 @@ adjust_outofscope_cursor_vars(struct cursor *cur) } else if ((ptr->variable->type->type != ECPGt_varchar && ptr->variable->type->type != ECPGt_char && ptr->variable->type->type != ECPGt_unsigned_char && ptr->variable->type->type != ECPGt_string) && atoi(ptr->variable->type->size) > 1) { - newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, make_str("1"), ptr->variable->type->u.element->lineno), ptr->variable->type->size), 0); + newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, make_str("1"), ptr->variable->type->u.element->counter), ptr->variable->type->size), 0); sprintf(temp, "%d, (", ecpg_internal_var++); } else if ((ptr->variable->type->type == ECPGt_varchar || ptr->variable->type->type == ECPGt_char || ptr->variable->type->type == ECPGt_unsigned_char || ptr->variable->type->type == ECPGt_string) && atoi(ptr->variable->type->size) > 1) { - newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0); + newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->counter), 0); if (ptr->variable->type->type == ECPGt_varchar) sprintf(temp, "%d, &(", ecpg_internal_var++); else @@ -302,13 +303,13 @@ adjust_outofscope_cursor_vars(struct cursor *cur) } else { - newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, ptr->variable->type->u.element->size, ptr->variable->type->u.element->lineno), ptr->variable->type->size), 0); + newvar = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, ptr->variable->type->u.element->size, ptr->variable->type->u.element->counter), ptr->variable->type->size), 0); sprintf(temp, "%d, &(", ecpg_internal_var++); } } else { - newvar = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->lineno), 0); + newvar = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->variable->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->variable->type->type, ptr->variable->type->size, ptr->variable->type->counter), 0); sprintf(temp, "%d, &(", ecpg_internal_var++); } @@ -343,18 +344,18 @@ adjust_outofscope_cursor_vars(struct cursor *cur) } else { - newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->size, ptr->indicator->type->u.element->lineno), ptr->indicator->type->size), 0); + newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->u.element->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_array_type(ECPGmake_simple_type(ptr->indicator->type->u.element->type, ptr->indicator->type->u.element->size, ptr->indicator->type->u.element->counter), ptr->indicator->type->size), 0); sprintf(temp, "%d, &(", ecpg_internal_var++); } } else if (atoi(ptr->indicator->type->size) > 1) { - newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0); + newind = new_variable(cat_str(4, make_str("("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->counter), 0); sprintf(temp, "%d, (", ecpg_internal_var++); } else { - newind = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->lineno), 0); + newind = new_variable(cat_str(4, make_str("*("), mm_strdup(ecpg_type_name(ptr->indicator->type->type)), make_str(" *)(ECPGget_var("), mm_strdup(temp)), ECPGmake_simple_type(ptr->indicator->type->type, ptr->indicator->type->size, ptr->variable->type->counter), 0); sprintf(temp, "%d, &(", ecpg_internal_var++); } diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 21d4e5d7583f0d453d2b71f9002f0ca19f5f8a9b..5c09cbbd8e6ad67ea10081a65155fe1449f6c11e 100644 --- a/src/interfaces/ecpg/preproc/ecpg.trailer +++ b/src/interfaces/ecpg/preproc/ecpg.trailer @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.20 2010/01/29 16:28:13 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.21 2010/03/09 11:09:45 meskes Exp $ */ statements: /*EMPTY*/ | statements statement @@ -855,9 +855,9 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initialize case ECPGt_varchar: if (atoi(dimension) < 0) - type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, yylineno); + type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length, varchar_counter); else - type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, yylineno), dimension); + type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length, varchar_counter), dimension); if (strcmp(dimension, "0") == 0 || abs(atoi(dimension)) == 1) *dim = '\0'; @@ -867,13 +867,14 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_bit_field opt_initialize if (atoi(length) < 0 || strcmp(length, "0") == 0) mmerror(PARSE_ERROR, ET_ERROR, "pointers to varchar are not implemented"); - /* make sure varchar struct name is unique by adding linenumer of its definition */ + /* make sure varchar struct name is unique by adding a unique counter to its definition */ vcn = (char *) mm_alloc(strlen($2) + sizeof(int) * CHAR_BIT * 10 / 3); - sprintf(vcn, "%s_%d", $2, yylineno); + sprintf(vcn, "%s_%d", $2, varchar_counter); if (strcmp(dimension, "0") == 0) $$ = cat_str(7, make2_str(make_str(" struct varchar_"), vcn), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } *"), mm_strdup($2), $4, $5); else $$ = cat_str(8, make2_str(make_str(" struct varchar_"), vcn), make_str(" { int len; char arr["), mm_strdup(length), make_str("]; } "), mm_strdup($2), mm_strdup(dim), $4, $5); + varchar_counter++; break; case ECPGt_char: diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index 4eb65e4eb9ee411fd72db24bc6ca508f972ed6c7..8442d08f51206128a99b4340130aaae9d1b13612 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.87 2010/01/26 09:07:31 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.c,v 1.88 2010/03/09 11:09:45 meskes Exp $ */ #include "postgres_fe.h" @@ -57,10 +57,10 @@ ECPGstruct_member_dup(struct ECPGstruct_member * rm) if (rm->type->u.element->type == ECPGt_struct) type = ECPGmake_struct_type(rm->type->u.element->u.members, rm->type->u.element->type, rm->type->u.element->type_name, rm->type->u.element->struct_sizeof); else - type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size, rm->type->u.element->lineno), rm->type->size); + type = ECPGmake_array_type(ECPGmake_simple_type(rm->type->u.element->type, rm->type->u.element->size, rm->type->u.element->counter), rm->type->size); break; default: - type = ECPGmake_simple_type(rm->type->type, rm->type->size, rm->type->lineno); + type = ECPGmake_simple_type(rm->type->type, rm->type->size, rm->type->counter); break; } @@ -93,7 +93,7 @@ ECPGmake_struct_member(char *name, struct ECPGtype * type, struct ECPGstruct_mem } struct ECPGtype * -ECPGmake_simple_type(enum ECPGttype type, char *size, int lineno) +ECPGmake_simple_type(enum ECPGttype type, char *size, int counter) { struct ECPGtype *ne = (struct ECPGtype *) mm_alloc(sizeof(struct ECPGtype)); @@ -102,7 +102,7 @@ ECPGmake_simple_type(enum ECPGttype type, char *size, int lineno) ne->size = size; ne->u.element = NULL; ne->struct_sizeof = NULL; - ne->lineno = lineno; /* only needed for varchar */ + ne->counter = counter; /* only needed for varchar */ return ne; } @@ -267,7 +267,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, ECPGdump_a_simple(o, name, type->u.element->type, - type->u.element->size, type->size, NULL, prefix, type->u.element->lineno); + type->u.element->size, type->size, NULL, prefix, type->u.element->counter); if (ind_type != NULL) { @@ -310,7 +310,7 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * type, if (indicator_set && (ind_type->type == ECPGt_struct || ind_type->type == ECPGt_array)) mmerror(INDICATOR_NOT_SIMPLE, ET_FATAL, "indicator for simple data type has to be simple"); - ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), struct_sizeof, prefix, type->lineno); + ECPGdump_a_simple(o, name, type->type, type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), struct_sizeof, prefix, type->counter); if (ind_type != NULL) ECPGdump_a_simple(o, ind_name, ind_type->type, ind_type->size, (arr_str_siz && strcmp(arr_str_siz, "0") != 0) ? arr_str_siz : make_str("-1"), ind_struct_sizeof, ind_prefix, 0); break; @@ -326,7 +326,7 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, char *arrsize, const char *siz, const char *prefix, - int lineno) + int counter) { if (type == ECPGt_NO_INDICATOR) fprintf(o, "\n\tECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, "); @@ -367,8 +367,8 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype type, ptr = strchr(var_name, '['); if (ptr) *ptr = '\0'; - if (lineno) - sprintf(offset, "sizeof(struct varchar_%s_%d)", var_name, lineno); + if (counter) + sprintf(offset, "sizeof(struct varchar_%s_%d)", var_name, counter); else sprintf(offset, "sizeof(struct varchar_%s)", var_name); free(var_name); diff --git a/src/interfaces/ecpg/preproc/type.h b/src/interfaces/ecpg/preproc/type.h index 5cca1816c2c5cfd921f678fe63f40052c11472fe..d5d26eb1d964f3cd80bc3a8f418bef6415c151c6 100644 --- a/src/interfaces/ecpg/preproc/type.h +++ b/src/interfaces/ecpg/preproc/type.h @@ -1,5 +1,5 @@ /* - * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.h,v 1.53 2010/02/26 02:01:31 momjian Exp $ + * $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/type.h,v 1.54 2010/03/09 11:09:45 meskes Exp $ */ #ifndef _ECPG_PREPROC_TYPE_H #define _ECPG_PREPROC_TYPE_H @@ -30,7 +30,7 @@ struct ECPGtype struct ECPGstruct_member *members; /* A pointer to a list of * members. */ } u; - int lineno; + int counter; }; /* Everything is malloced. */ diff --git a/src/interfaces/ecpg/preproc/variable.c b/src/interfaces/ecpg/preproc/variable.c index 001accd3284a89954b1efd17138226fcb548ce4e..38832ee1d0a67194aa05a40410ebf072b7dda9a6 100644 --- a/src/interfaces/ecpg/preproc/variable.c +++ b/src/interfaces/ecpg/preproc/variable.c @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.53 2010/02/26 02:01:31 momjian Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/variable.c,v 1.54 2010/03/09 11:09:45 meskes Exp $ */ #include "postgres_fe.h" @@ -44,12 +44,12 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in switch (members->type->type) { case ECPGt_array: - return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), members->type->size), brace_level)); + return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), members->type->size), brace_level)); case ECPGt_struct: case ECPGt_union: return (new_variable(name, ECPGmake_struct_type(members->type->u.members, members->type->type, members->type->type_name, members->type->struct_sizeof), brace_level)); default: - return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->lineno), brace_level)); + return (new_variable(name, ECPGmake_simple_type(members->type->type, members->type->size, members->type->counter), brace_level)); } } else @@ -91,12 +91,12 @@ find_struct_member(char *name, char *str, struct ECPGstruct_member * members, in switch (members->type->u.element->type) { case ECPGt_array: - return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->lineno), members->type->u.element->size), brace_level)); + return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(members->type->u.element->u.element->type, members->type->u.element->u.element->size, members->type->u.element->u.element->counter), members->type->u.element->size), brace_level)); case ECPGt_struct: case ECPGt_union: return (new_variable(name, ECPGmake_struct_type(members->type->u.element->u.members, members->type->u.element->type, members->type->u.element->type_name, members->type->u.element->struct_sizeof), brace_level)); default: - return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->lineno), brace_level)); + return (new_variable(name, ECPGmake_simple_type(members->type->u.element->type, members->type->u.element->size, members->type->u.element->counter), brace_level)); } break; case '-': @@ -232,12 +232,12 @@ find_variable(char *name) switch (p->type->u.element->type) { case ECPGt_array: - return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->lineno), p->type->u.element->size), p->brace_level)); + return (new_variable(name, ECPGmake_array_type(ECPGmake_simple_type(p->type->u.element->u.element->type, p->type->u.element->u.element->size, p->type->u.element->u.element->counter), p->type->u.element->size), p->brace_level)); case ECPGt_struct: case ECPGt_union: return (new_variable(name, ECPGmake_struct_type(p->type->u.element->u.members, p->type->u.element->type, p->type->u.element->type_name, p->type->u.element->struct_sizeof), p->brace_level)); default: - return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->lineno), p->brace_level)); + return (new_variable(name, ECPGmake_simple_type(p->type->u.element->type, p->type->u.element->size, p->type->u.element->counter), p->brace_level)); } } } diff --git a/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c index 2ef12693fa942230cad217ccd08261ebd2555e9b..91c8ad55fe8cafb468ec9d0986ec122f281ddf30 100644 --- a/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c +++ b/src/interfaces/ecpg/test/expected/preproc-array_of_struct.c @@ -32,7 +32,7 @@ typedef struct { #line 12 "array_of_struct.pgc" - struct varchar_name_12 { int len; char arr[ 50 ]; } name ; + struct varchar_name_1 { int len; char arr[ 50 ]; } name ; #line 13 "array_of_struct.pgc" int phone ; @@ -61,7 +61,7 @@ int main() typedef struct { #line 30 "array_of_struct.pgc" - struct varchar_name_30 { int len; char arr[ 50 ]; } name ; + struct varchar_name_2 { int len; char arr[ 50 ]; } name ; #line 31 "array_of_struct.pgc" int phone ; @@ -95,7 +95,7 @@ int main() #line 38 "array_of_struct.pgc" struct customer3 { #line 36 "array_of_struct.pgc" - struct varchar_name_36 { int len; char arr[ 50 ]; } name ; + struct varchar_name_3 { int len; char arr[ 50 ]; } name ; #line 37 "array_of_struct.pgc" int phone ; @@ -104,7 +104,7 @@ int main() #line 43 "array_of_struct.pgc" struct customer4 { #line 41 "array_of_struct.pgc" - struct varchar_name_41 { int len; char arr[ 50 ]; } name ; + struct varchar_name_4 { int len; char arr[ 50 ]; } name ; #line 42 "array_of_struct.pgc" int phone ; @@ -114,7 +114,7 @@ int main() int r ; #line 45 "array_of_struct.pgc" - struct varchar_onlyname_45 { int len; char arr[ 50 ]; } onlyname [2] ; + struct varchar_onlyname_5 { int len; char arr[ 50 ]; } onlyname [2] ; /* exec sql end declare section */ #line 46 "array_of_struct.pgc" @@ -235,7 +235,7 @@ if (sqlca.sqlcode < 0) sqlprint();} } { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select * from customers limit 1", ECPGt_EOIT, - ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof(struct varchar_name_41), + ECPGt_varchar,&(custs4.name),(long)50,(long)1,sizeof(struct varchar_name_4), ECPGt_short,&(inds[0].name_ind),(long)1,(long)1,sizeof(short), ECPGt_int,&(custs4.phone),(long)1,(long)1,sizeof(int), ECPGt_short,&(inds[0].phone_ind),(long)1,(long)1,sizeof(short), ECPGt_EORT); @@ -255,7 +255,7 @@ if (sqlca.sqlcode < 0) sqlprint();} printf( "phone - %d\n", custs4.phone ); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "select c from customers limit 2", ECPGt_EOIT, - ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_onlyname_45), + ECPGt_varchar,(onlyname),(long)50,(long)2,sizeof(struct varchar_onlyname_5), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EORT); #line 85 "array_of_struct.pgc" diff --git a/src/interfaces/ecpg/test/expected/preproc-cursor.c b/src/interfaces/ecpg/test/expected/preproc-cursor.c index b61900c9f9f9e3103e868077b76cd895182ec1e8..e755c57461322d3cda2c273b41c9d9dfcd2118fb 100644 --- a/src/interfaces/ecpg/test/expected/preproc-cursor.c +++ b/src/interfaces/ecpg/test/expected/preproc-cursor.c @@ -74,7 +74,7 @@ main (void) char * curname3 = CURNAME ; #line 27 "cursor.pgc" - struct varchar_curname4_27 { int len; char arr[ 50 ]; } curname4 ; + struct varchar_curname4_1 { int len; char arr[ 50 ]; } curname4 ; #line 28 "cursor.pgc" int count ; @@ -602,7 +602,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "open"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare $0 cursor for $1", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_char_variable,(ECPGprepared_statement(NULL, "st_id2", __LINE__)),(long)1,(long)1,(1)*sizeof(char), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); @@ -614,7 +614,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "fetch from"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch from $0", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(id),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, @@ -629,7 +629,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "fetch"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(id),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, @@ -644,7 +644,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "fetch 1 from"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 from $0", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(id),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, @@ -662,7 +662,7 @@ if (sqlca.sqlcode < 0) exit (1);} { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 from $0", ECPGt_int,&(count),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(id),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, @@ -677,7 +677,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "move"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "move absolute 0 $0", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); #line 216 "cursor.pgc" @@ -687,7 +687,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "fetch 1"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch 1 $0", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(id),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, @@ -705,7 +705,7 @@ if (sqlca.sqlcode < 0) exit (1);} { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch $0 $0", ECPGt_int,&(count),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_int,&(id),(long)1,(long)1,sizeof(int), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, @@ -720,7 +720,7 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "close"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close $0", - ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_27), + ECPGt_varchar,&(curname4),(long)50,(long)1,sizeof(struct varchar_curname4_1), ECPGt_NO_INDICATOR, NULL , 0L, 0L, 0L, ECPGt_EOIT, ECPGt_EORT); #line 228 "cursor.pgc" diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.c b/src/interfaces/ecpg/test/expected/preproc-variable.c index 6a63f5699d804d0eb3f17180a86bb41a460db095..9f8b36d8a7bb3e3cacb05799cb401025cd070c72 100644 --- a/src/interfaces/ecpg/test/expected/preproc-variable.c +++ b/src/interfaces/ecpg/test/expected/preproc-variable.c @@ -70,11 +70,12 @@ main (void) + #line 27 "variable.pgc" struct personal_struct { #line 25 "variable.pgc" - struct varchar_name_25 { int len; char arr[ BUFFERSIZ ]; } name ; + struct varchar_name_1 { int len; char arr[ BUFFERSIZ ]; } name ; #line 26 "variable.pgc" struct birthinfo birth ; @@ -91,27 +92,33 @@ main (void) #line 31 "variable.pgc" ind ind_children ; -/* exec sql end declare section */ + struct t1 { #line 32 "variable.pgc" + struct varchar_name_2 { int len; char arr[ BUFFERSIZ ]; } name ; + } ; struct t2 { +#line 32 "variable.pgc" + struct varchar_name_3 { int len; char arr[ BUFFERSIZ ]; } name ; + } ;/* exec sql end declare section */ +#line 33 "variable.pgc" -#line 34 "variable.pgc" +#line 35 "variable.pgc" char * married = NULL ; -#line 34 "variable.pgc" +#line 35 "variable.pgc" -#line 35 "variable.pgc" +#line 36 "variable.pgc" long ind_married ; -#line 35 "variable.pgc" +#line 36 "variable.pgc" -#line 36 "variable.pgc" +#line 37 "variable.pgc" ind children ; -#line 36 "variable.pgc" +#line 37 "variable.pgc" char msg[128]; @@ -120,78 +127,78 @@ main (void) strcpy(msg, "connect"); { ECPGconnect(__LINE__, 0, "regress1" , NULL, NULL , NULL, 0); -#line 43 "variable.pgc" +#line 44 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 43 "variable.pgc" +#line 44 "variable.pgc" strcpy(msg, "set"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "set datestyle to iso", ECPGt_EOIT, ECPGt_EORT); -#line 46 "variable.pgc" +#line 47 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 46 "variable.pgc" +#line 47 "variable.pgc" strcpy(msg, "create"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer )", ECPGt_EOIT, ECPGt_EORT); -#line 49 "variable.pgc" +#line 50 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 49 "variable.pgc" +#line 50 "variable.pgc" strcpy(msg, "insert"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT); -#line 52 "variable.pgc" - -if (sqlca.sqlcode < 0) exit (1);} -#line 52 "variable.pgc" - - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT); #line 53 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 53 "variable.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 1' , 16 )", ECPGt_EOIT, ECPGt_EORT); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 )", ECPGt_EOIT, ECPGt_EORT); #line 54 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 54 "variable.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 2' , 14 )", ECPGt_EOIT, ECPGt_EORT); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 1' , 16 )", ECPGt_EOIT, ECPGt_EORT); #line 55 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 55 "variable.pgc" - { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 3' , 9 )", ECPGt_EOIT, ECPGt_EORT); + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 2' , 14 )", ECPGt_EOIT, ECPGt_EORT); #line 56 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} #line 56 "variable.pgc" + { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "insert into family ( name , age ) values ( 'Child 3' , 9 )", ECPGt_EOIT, ECPGt_EORT); +#line 57 "variable.pgc" + +if (sqlca.sqlcode < 0) exit (1);} +#line 57 "variable.pgc" + strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit"); -#line 59 "variable.pgc" +#line 60 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 59 "variable.pgc" +#line 60 "variable.pgc" strcpy(msg, "open"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "declare cur cursor for select name , born , age , married , children from family", ECPGt_EOIT, ECPGt_EORT); -#line 62 "variable.pgc" +#line 63 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 62 "variable.pgc" +#line 63 "variable.pgc" /* exec sql whenever not found break ; */ -#line 64 "variable.pgc" +#line 65 "variable.pgc" p=&personal; @@ -200,7 +207,7 @@ if (sqlca.sqlcode < 0) exit (1);} while (1) { strcpy(msg, "fetch"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "fetch cur", ECPGt_EOIT, - ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name_25), + ECPGt_varchar,&(p->name),(long)BUFFERSIZ,(long)1,sizeof(struct varchar_name_1), ECPGt_int,&(i->ind_name),(long)1,(long)1,sizeof(int), ECPGt_long,&(p->birth.born),(long)1,(long)1,sizeof(long), ECPGt_long,&(i->ind_birth.born),(long)1,(long)1,sizeof(long), @@ -210,13 +217,13 @@ if (sqlca.sqlcode < 0) exit (1);} ECPGt_long,&(ind_married),(long)1,(long)1,sizeof(long), ECPGt_int,&(children.integer),(long)1,(long)1,sizeof(int), ECPGt_short,&(ind_children.smallint),(long)1,(long)1,sizeof(short), ECPGt_EORT); -#line 71 "variable.pgc" +#line 72 "variable.pgc" if (sqlca.sqlcode == ECPG_NOT_FOUND) break; -#line 71 "variable.pgc" +#line 72 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 71 "variable.pgc" +#line 72 "variable.pgc" printf("%8.8s", personal.name.arr); if (i->ind_birth.born >= 0) @@ -235,34 +242,34 @@ if (sqlca.sqlcode < 0) exit (1);} strcpy(msg, "close"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "close cur", ECPGt_EOIT, ECPGt_EORT); -#line 88 "variable.pgc" +#line 89 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 88 "variable.pgc" +#line 89 "variable.pgc" strcpy(msg, "drop"); { ECPGdo(__LINE__, 0, 1, NULL, 0, ECPGst_normal, "drop table family", ECPGt_EOIT, ECPGt_EORT); -#line 91 "variable.pgc" +#line 92 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 91 "variable.pgc" +#line 92 "variable.pgc" strcpy(msg, "commit"); { ECPGtrans(__LINE__, NULL, "commit"); -#line 94 "variable.pgc" +#line 95 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 94 "variable.pgc" +#line 95 "variable.pgc" strcpy(msg, "disconnect"); { ECPGdisconnect(__LINE__, "CURRENT"); -#line 97 "variable.pgc" +#line 98 "variable.pgc" if (sqlca.sqlcode < 0) exit (1);} -#line 97 "variable.pgc" +#line 98 "variable.pgc" return (0); diff --git a/src/interfaces/ecpg/test/expected/preproc-variable.stderr b/src/interfaces/ecpg/test/expected/preproc-variable.stderr index 8f02a7686c479579fcfc8ec090d243466b816fe1..3ec974d3b03ff6fb991e01ce4ab3b3ec316a0a1f 100644 --- a/src/interfaces/ecpg/test/expected/preproc-variable.stderr +++ b/src/interfaces/ecpg/test/expected/preproc-variable.stderr @@ -2,167 +2,167 @@ [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ECPGconnect: opening database regress1 on <DEFAULT> port <DEFAULT> [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 46: query: set datestyle to iso; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 47: query: set datestyle to iso; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 46: using PQexec +[NO_PID]: ecpg_execute on line 47: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 46: OK: SET +[NO_PID]: ecpg_execute on line 47: OK: SET [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 49: query: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ); with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 50: query: create table family ( name char ( 8 ) , born integer , age smallint , married date , children integer ); with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 49: using PQexec +[NO_PID]: ecpg_execute on line 50: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 49: OK: CREATE TABLE +[NO_PID]: ecpg_execute on line 50: OK: CREATE TABLE [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 52: query: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ); with 0 parameter(s) on connection regress1 -[NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 52: using PQexec -[NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 52: OK: INSERT 0 1 -[NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 53: query: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ); with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 53: query: insert into family ( name , married , children ) values ( 'Mum' , '19870714' , 3 ); with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 53: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 53: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 54: query: insert into family ( name , age ) values ( 'Child 1' , 16 ); with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 54: query: insert into family ( name , born , married , children ) values ( 'Dad' , '19610721' , '19870714' , 3 ); with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 54: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 54: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 55: query: insert into family ( name , age ) values ( 'Child 2' , 14 ); with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 55: query: insert into family ( name , age ) values ( 'Child 1' , 16 ); with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 55: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 55: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 56: query: insert into family ( name , age ) values ( 'Child 3' , 9 ); with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 56: query: insert into family ( name , age ) values ( 'Child 2' , 14 ); with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 56: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_execute on line 56: OK: INSERT 0 1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans on line 59: action "commit"; connection "regress1" +[NO_PID]: ecpg_execute on line 57: query: insert into family ( name , age ) values ( 'Child 3' , 9 ); with 0 parameter(s) on connection regress1 +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 57: using PQexec +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ecpg_execute on line 57: OK: INSERT 0 1 +[NO_PID]: sqlca: code: 0, state: 00000 +[NO_PID]: ECPGtrans on line 60: action "commit"; connection "regress1" [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 62: query: declare cur cursor for select name , born , age , married , children from family; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 63: query: declare cur cursor for select name , born , age , married , children from family; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 62: using PQexec +[NO_PID]: ecpg_execute on line 63: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 62: OK: DECLARE CURSOR +[NO_PID]: ecpg_execute on line 63: OK: DECLARE CURSOR [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: query: fetch cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: using PQexec +[NO_PID]: ecpg_execute on line 72: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: correctly got 1 tuples with 5 fields +[NO_PID]: ecpg_execute on line 72: correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: Mum offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: Mum offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_store_result on line 71: allocating memory for 1 tuples +[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 1987-07-14 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 1987-07-14 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 3 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 3 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: query: fetch cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: using PQexec +[NO_PID]: ecpg_execute on line 72: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: correctly got 1 tuples with 5 fields +[NO_PID]: ecpg_execute on line 72: correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: Dad offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: Dad offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 19610721 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 19610721 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_store_result on line 71: allocating memory for 1 tuples +[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 1987-07-14 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 1987-07-14 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 3 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 3 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: query: fetch cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: using PQexec +[NO_PID]: ecpg_execute on line 72: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: correctly got 1 tuples with 5 fields +[NO_PID]: ecpg_execute on line 72: correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: Child 1 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: Child 1 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 16 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 16 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_store_result on line 71: allocating memory for 1 tuples +[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: query: fetch cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: using PQexec +[NO_PID]: ecpg_execute on line 72: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: correctly got 1 tuples with 5 fields +[NO_PID]: ecpg_execute on line 72: correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: Child 2 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: Child 2 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 14 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 14 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_store_result on line 71: allocating memory for 1 tuples +[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: query: fetch cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: using PQexec +[NO_PID]: ecpg_execute on line 72: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: correctly got 1 tuples with 5 fields +[NO_PID]: ecpg_execute on line 72: correctly got 1 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: Child 3 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: Child 3 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: 9 offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: 9 offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_store_result on line 71: allocating memory for 1 tuples +[NO_PID]: ecpg_store_result on line 72: allocating memory for 1 tuples [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_get_data on line 71: RESULT: offset: -1; array: no +[NO_PID]: ecpg_get_data on line 72: RESULT: offset: -1; array: no [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: query: fetch cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 72: query: fetch cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: using PQexec +[NO_PID]: ecpg_execute on line 72: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 71: correctly got 0 tuples with 5 fields +[NO_PID]: ecpg_execute on line 72: correctly got 0 tuples with 5 fields [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: raising sqlcode 100 on line 71: no data found on line 71 +[NO_PID]: raising sqlcode 100 on line 72: no data found on line 72 [NO_PID]: sqlca: code: 100, state: 02000 -[NO_PID]: ecpg_execute on line 88: query: close cur; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 89: query: close cur; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 88: using PQexec +[NO_PID]: ecpg_execute on line 89: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 88: OK: CLOSE CURSOR +[NO_PID]: ecpg_execute on line 89: OK: CLOSE CURSOR [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 91: query: drop table family; with 0 parameter(s) on connection regress1 +[NO_PID]: ecpg_execute on line 92: query: drop table family; with 0 parameter(s) on connection regress1 [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 91: using PQexec +[NO_PID]: ecpg_execute on line 92: using PQexec [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ecpg_execute on line 91: OK: DROP TABLE +[NO_PID]: ecpg_execute on line 92: OK: DROP TABLE [NO_PID]: sqlca: code: 0, state: 00000 -[NO_PID]: ECPGtrans on line 94: action "commit"; connection "regress1" +[NO_PID]: ECPGtrans on line 95: action "commit"; connection "regress1" [NO_PID]: sqlca: code: 0, state: 00000 [NO_PID]: ecpg_finish: connection regress1 closed [NO_PID]: sqlca: code: 0, state: 00000 diff --git a/src/interfaces/ecpg/test/preproc/variable.pgc b/src/interfaces/ecpg/test/preproc/variable.pgc index dcc575f8b4b627dfac1f761e962762cab788e9c6..71efa0ddaf1ecb6dab6522992363e855af2fa948 100644 --- a/src/interfaces/ecpg/test/preproc/variable.pgc +++ b/src/interfaces/ecpg/test/preproc/variable.pgc @@ -29,6 +29,7 @@ exec sql begin declare section; struct birthinfo ind_birth; } ind_personal, *i; ind ind_children; + struct t1 { str name; }; struct t2 { str name; }; exec sql end declare section; exec sql char *married = NULL;