diff --git a/src/interfaces/ecpg/ChangeLog b/src/interfaces/ecpg/ChangeLog index a601ee1eb8..03561b67ca 100644 --- a/src/interfaces/ecpg/ChangeLog +++ b/src/interfaces/ecpg/ChangeLog @@ -1464,6 +1464,10 @@ Fri May 30 10:29:49 CEST 2003 - Synced parser. - Added a dummy rule for EXEC SQL DESCRIBE that throws an error message. + +Fri May 30 15:19:39 CEST 2003 + + - Implemented prototype describe function. - Some minor cleanup/bug fixing. - Set ecpg version to 2.12.0. - Set ecpg library to 3.4.2. diff --git a/src/interfaces/ecpg/ecpglib/descriptor.c b/src/interfaces/ecpg/ecpglib/descriptor.c index cf8ba3435d..0a5e5a7195 100644 --- a/src/interfaces/ecpg/ecpglib/descriptor.c +++ b/src/interfaces/ecpg/ecpglib/descriptor.c @@ -1,6 +1,6 @@ /* dynamic SQL support routines * - * $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.1 2003/03/16 10:42:53 meskes Exp $ + * $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/descriptor.c,v 1.2 2003/05/30 13:22:02 meskes Exp $ */ #include "postgres_fe.h" @@ -447,3 +447,10 @@ ECPGdescriptor_lvalue(int line, const char *descriptor) ECPGraise(line, ECPG_UNKNOWN_DESCRIPTOR, (char *) descriptor); return NULL; } + +bool +ECPGdescribe(int line, bool input, const char *statement, ...) +{ + ECPGlog("ECPGdescribe called on line %d for %s in %s\n", line, (input) ? "input" : "output", statement); + return false; +} diff --git a/src/interfaces/ecpg/include/ecpglib.h b/src/interfaces/ecpg/include/ecpglib.h index 195a464dd9..679ff1a763 100644 --- a/src/interfaces/ecpg/include/ecpglib.h +++ b/src/interfaces/ecpg/include/ecpglib.h @@ -72,6 +72,8 @@ void ECPGraise(int line, int code, const char *str); bool ECPGget_desc_header(int, char *, int *); bool ECPGget_desc(int, char *, int,...); +bool ECPGdescribe(int, bool, const char *, ...); + /* dynamic result allocation */ void ECPGfree_auto_mem(void); diff --git a/src/interfaces/ecpg/preproc/output.c b/src/interfaces/ecpg/preproc/output.c index 7e626b1971..57509ea809 100644 --- a/src/interfaces/ecpg/preproc/output.c +++ b/src/interfaces/ecpg/preproc/output.c @@ -15,7 +15,7 @@ output_simple_statement(char *cmd) int i, j = strlen(cmd);; - /* do this char by char as we have to filter '\"' */ + /* output this char by char as we have to filter '\"' */ for (i = 0; i < j; i++) { if (cmd[i] != '"') @@ -111,7 +111,7 @@ output_statement(char *stmt, int mode, char *con) fprintf(yyout, "{ ECPGdo(__LINE__, %s, \"", con ? con : "NULL"); - /* do this char by char as we have to filter '\"' */ + /* output this char by char as we have to filter '\"' */ for (i = 0; i < j; i++) { if (stmt[i] != '"') diff --git a/src/interfaces/ecpg/preproc/preproc.y b/src/interfaces/ecpg/preproc/preproc.y index cb24adbb5d..e58a749b04 100644 --- a/src/interfaces/ecpg/preproc/preproc.y +++ b/src/interfaces/ecpg/preproc/preproc.y @@ -1,4 +1,4 @@ -/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.226 2003/05/30 08:39:01 meskes Exp $ */ +/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/preproc/Attic/preproc.y,v 1.227 2003/05/30 13:22:02 meskes Exp $ */ /* Copyright comment */ %{ @@ -438,18 +438,17 @@ create_questionmarks(char *name, bool array) %type ECPGFree ECPGDeclare ECPGVar opt_at enum_definition %type struct_union_type s_struct_union vt_declarations %type var_declaration type_declaration single_vt_declaration -%type ECPGSetAutocommit on_off variable_declarations +%type ECPGSetAutocommit on_off variable_declarations ECPGDescribe %type ECPGAllocateDescr ECPGDeallocateDescr symbol opt_output %type ECPGGetDescriptorHeader ECPGColLabel single_var_declaration %type reserved_keyword unreserved_keyword ecpg_interval %type col_name_keyword func_name_keyword precision opt_scale %type ECPGTypeName variablelist ECPGColLabelCommon c_variable -%type inf_val_list inf_col_list using_descriptor ECPGDescribe -%type into_descriptor +%type inf_val_list inf_col_list using_descriptor into_descriptor %type s_struct_union_symbol -%type ECPGGetDescriptor +%type ECPGGetDescriptor %type simple_type signed_type unsigned_type @@ -617,10 +616,12 @@ stmt: AlterDatabaseSetStmt { output_statement($1, 0, connection); } } | ECPGDescribe { - if (connection) - mmerror(PARSE_ERROR, ET_ERROR, "no at option for describe statement.\n"); - - fprintf(yyout, "{ /* ECPGdescribe(__LINE__, %s) */;", $1); + fprintf(yyout, "{ ECPGdescribe(__LINE__, %s,", $1); + dump_variables(argsresult, 1); + fputs("ECPGt_EORT);", yyout); + fprintf(yyout, "}"); + output_line_number(); + /* whenever_action(2); */ free($1); } @@ -5186,18 +5187,18 @@ ECPGPrepare: PREPARE name FROM execstring */ ECPGDescribe: SQL_DESCRIBE INPUT_P name using_descriptor { - mmerror(PARSE_ERROR, ET_ERROR, "using unsupported describe statement.\n"); - $$ = cat_str(3, make_str("input"), $3, $4); + mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement.\n"); + $$ = cat_str(3, make_str("1, ECPGprepared_statement(\""), $3, make_str("\")")); } | SQL_DESCRIBE opt_output name using_descriptor { - mmerror(PARSE_ERROR, ET_ERROR, "using unsupported describe statement.\n"); - $$ = cat_str(3, $2, $3, $4); + mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement.\n"); + $$ = cat_str(3, make_str("0, ECPGprepared_statement(\""), $3, make_str("\")")); } | SQL_DESCRIBE opt_output name into_descriptor { - mmerror(PARSE_ERROR, ET_ERROR, "using unsupported describe statement.\n"); - $$ = cat_str(3, $2, $3, $4); + mmerror(PARSE_ERROR, ET_WARNING, "using unsupported describe statement.\n"); + $$ = cat_str(3, make_str("0, ECPGprepared_statement(\""), $3, make_str("\")")); } ;