diff options
Diffstat (limited to 'src/interfaces/ecpg/preproc')
| -rw-r--r-- | src/interfaces/ecpg/preproc/pgc.l | 3 | ||||
| -rw-r--r-- | src/interfaces/ecpg/preproc/preproc.y | 8 | ||||
| -rw-r--r-- | src/interfaces/ecpg/preproc/type.c | 31 |
3 files changed, 24 insertions, 18 deletions
diff --git a/src/interfaces/ecpg/preproc/pgc.l b/src/interfaces/ecpg/preproc/pgc.l index 847a5437334..82daf7188d5 100644 --- a/src/interfaces/ecpg/preproc/pgc.l +++ b/src/interfaces/ecpg/preproc/pgc.l @@ -12,7 +12,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.57 2000/03/30 11:41:40 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/pgc.l,v 1.58 2000/04/05 09:05:34 meskes Exp $ * *------------------------------------------------------------------------- */ @@ -827,6 +827,7 @@ lex_init(void) braces_open = 0; preproc_tos = 0; + yylineno = 0; ifcond = TRUE; stacked_if_value[preproc_tos].condition = ifcond; stacked_if_value[preproc_tos].else_branch = FALSE; diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index ac98aa333c4..266745c3d64 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -325,7 +325,7 @@ make_name(void) %type <str> TriggerActionTime CreateTrigStmt DropPLangStmt PLangTrusted %type <str> CreatePLangStmt IntegerOnly TriggerFuncArgs TriggerFuncArg %type <str> ViewStmt LoadStmt CreatedbStmt createdb_opt_encoding -%type <str> createdb_opt_location opt_encoding AlterTableStmt +%type <str> createdb_opt_location opt_encoding %type <str> DropdbStmt ClusterStmt grantee RevokeStmt table_expr Bit bit %type <str> GrantStmt privileges operation_commalist operation %type <str> opt_cursor opt_lmode ConstraintsSetStmt comment_tg @@ -333,7 +333,7 @@ make_name(void) %type <str> select_clause opt_select_limit select_limit_value ConstraintTimeSpec %type <str> select_offset_value using_expr join_expr ReindexStmt %type <str> using_list from_expr join_clause join_type -%type <str> join_qual update_list join_clause join_clause_with_union +%type <str> join_qual update_list join_clause_with_union %type <str> opt_level opt_lock lock_type users_in_new_group_clause %type <str> OptConstrFromTable comment_op OptTempTableName %type <str> constraints_set_list constraints_set_namelist comment_fn @@ -359,7 +359,7 @@ make_name(void) %type <str> enum_type civariableonly ECPGCursorStmt ECPGDeallocate %type <str> ECPGFree ECPGDeclare ECPGVar opt_at enum_definition %type <str> struct_type s_struct declaration declarations variable_declarations -%type <str> s_struct s_union union_type ECPGSetAutocommit on_off +%type <str> s_union union_type ECPGSetAutocommit on_off %type <str> ECPGAllocateDescr ECPGDeallocateDescr symbol opt_symbol %type <str> ECPGGetDescriptorHeader ECPGColId ECPGColLabel ECPGTypeName %type <str> ECPGLabelTypeName @@ -4349,7 +4349,7 @@ variable: opt_pointer ECPGColLabel opt_array_bounds opt_initializer $$ = cat_str(4, $1, mm_strdup($2), $3.str, $4); break; case ECPGt_varchar: - if (dimension == -1) + if (dimension < 0) type = ECPGmake_simple_type(actual_type[struct_level].type_enum, length); else type = ECPGmake_array_type(ECPGmake_simple_type(actual_type[struct_level].type_enum, length), dimension); diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index eff50f6a812..95c79e3f09e 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -198,13 +198,6 @@ static void ECPGdump_a_struct(FILE *o, const char *name, const char *ind_name, l void ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *ind_name, struct ECPGtype * ind_typ, const char *prefix, const char *ind_prefix) { -#if 0 - if (ind_typ == NULL) - { - ind_typ = &ecpg_no_indicator; - ind_name = "no_indicator"; - } -#endif switch (typ->typ) { case ECPGt_array: @@ -273,23 +266,35 @@ ECPGdump_a_simple(FILE *o, const char *name, enum ECPGttype typ, char *variable = (char *) mm_alloc(strlen(name) + ((prefix == NULL) ? 0 : strlen(prefix)) + 4); char *offset = (char *) mm_alloc(strlen(name) + strlen("sizeof(struct varchar_)") + 1); - /* we have to use the pointer except for arrays with given bounds */ - if (arrsize > 0) - sprintf(variable, "(%s%s)", prefix ? prefix : "", name); - else - sprintf(variable, "&(%s%s)", prefix ? prefix : "", name); - switch (typ) { case ECPGt_varchar: + /* we have to use the pointer except for arrays with given bounds */ + if (arrsize > 0) + sprintf(variable, "(%s%s)", prefix ? prefix : "", name); + else + sprintf(variable, "&(%s%s)", prefix ? prefix : "", name); + sprintf(offset, "sizeof(struct varchar_%s)", name); break; case ECPGt_char: case ECPGt_unsigned_char: case ECPGt_char_variable: + /* we have to use the pointer except for arrays with given bounds */ + if (varcharsize > 1 || arrsize > 0) + sprintf(variable, "(%s%s)", prefix ? prefix : "", name); + else + sprintf(variable, "&(%s%s)", prefix ? prefix : "", name); + sprintf(offset, "%ld*sizeof(char)", varcharsize == 0 ? 1 : varcharsize); break; default: + /* we have to use the pointer except for arrays with given bounds */ + if (arrsize > 0) + sprintf(variable, "(%s%s)", prefix ? prefix : "", name); + else + sprintf(variable, "&(%s%s)", prefix ? prefix : "", name); + sprintf(offset, "sizeof(%s)", ECPGtype_name(typ)); break; } |
