diff options
Diffstat (limited to 'src/interfaces/ecpg/preproc')
-rw-r--r-- | src/interfaces/ecpg/preproc/descriptor.c | 3 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/preproc.y | 28 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/type.c | 23 |
3 files changed, 35 insertions, 19 deletions
diff --git a/src/interfaces/ecpg/preproc/descriptor.c b/src/interfaces/ecpg/preproc/descriptor.c index 3db962b1c78..6c249f4a6a1 100644 --- a/src/interfaces/ecpg/preproc/descriptor.c +++ b/src/interfaces/ecpg/preproc/descriptor.c @@ -113,8 +113,7 @@ drop_descriptor(char *name, char *connection) } struct descriptor - * -lookup_descriptor(char *name, char *connection) +*lookup_descriptor(char *name, char *connection) { struct descriptor *i; diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index 6aae3c4d53f..804d3be4579 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -465,7 +465,15 @@ stmt: AlterSchemaStmt { output_statement($1, 0, NULL, connection); } if (connection) mmerror(ET_ERROR, "no at option for connect statement.\n"); - fprintf(yyout, "{ ECPGconnect(__LINE__, %s, %d);", $1, autocommit); + fputs("{ ECPGconnect(__LINE__,", yyout); + + if ($1[1] == '?') + fprintf(yyout, "%s, %s, %d);", argsinsert->variable->name, $1 + sizeof("\"?\","), autocommit); + else + fprintf(yyout, "%s, %d); ", $1, autocommit); + + reset_variables(); + whenever_action(2); free($1); } @@ -3965,10 +3973,10 @@ connection_target: database_name opt_server opt_port } | StringConst { - $$ = mm_strdup($1); - $$[0] = '\"'; - $$[strlen($$) - 1] = '\"'; - free($1); + if ($1[0] == '\"') + $$ = $1; + else + $$ = make3_str(make_str("\""), $1, make_str("\"")); } db_prefix: ident cvariable @@ -4032,12 +4040,18 @@ ora_user: user_name $$ = cat_str(3, $1, make_str(","), $3); } -user_name: UserId { if ($1[0] == '\"') +user_name: UserId { + if ($1[0] == '\"') + $$ = $1; + else + $$ = make3_str(make_str("\""), $1, make_str("\"")); + } + | StringConst { + if ($1[0] == '\"') $$ = $1; else $$ = make3_str(make_str("\""), $1, make_str("\"")); } - | StringConst { $$ = make3_str(make_str("\""), $1, make_str("\"")); } char_variable: cvariable { /* check if we have a char variable */ diff --git a/src/interfaces/ecpg/preproc/type.c b/src/interfaces/ecpg/preproc/type.c index b42e962e7ca..29899b72598 100644 --- a/src/interfaces/ecpg/preproc/type.c +++ b/src/interfaces/ecpg/preproc/type.c @@ -204,11 +204,11 @@ 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 (ind_typ == NULL) +/* if (ind_typ == NULL) { ind_typ = &ecpg_no_indicator; ind_name = "no_indicator"; - } + }*/ switch (typ->typ) { @@ -228,17 +228,20 @@ ECPGdump_a_type(FILE *o, const char *name, struct ECPGtype * typ, const char *in ECPGdump_a_simple(o, name, typ->u.element->typ, typ->u.element->size, typ->size, NULL, prefix); - if (ind_typ->typ == ECPGt_NO_INDICATOR) - ECPGdump_a_simple(o, ind_name, ind_typ->typ, ind_typ->size, -1, NULL, ind_prefix); - else + if (ind_typ != NULL) { - if (ind_typ->typ != ECPGt_array) + if (ind_typ->typ == ECPGt_NO_INDICATOR) + ECPGdump_a_simple(o, ind_name, ind_typ->typ, ind_typ->size, -1, NULL, ind_prefix); + else { - fprintf(stderr, "Indicator for an array has to be array too.\n"); - exit(INDICATOR_NOT_ARRAY); + if (ind_typ->typ != ECPGt_array) + { + fprintf(stderr, "Indicator for an array has to be array too.\n"); + exit(INDICATOR_NOT_ARRAY); + } + ECPGdump_a_simple(o, ind_name, ind_typ->u.element->typ, + ind_typ->u.element->size, ind_typ->size, NULL, prefix); } - ECPGdump_a_simple(o, ind_name, ind_typ->u.element->typ, - ind_typ->u.element->size, ind_typ->size, NULL, prefix); } } break; |