diff options
Diffstat (limited to 'src/interfaces/ecpg/preproc')
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.addons | 16 | ||||
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.trailer | 7 |
2 files changed, 18 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons index d864dfbdf7a..884ce9eb836 100644 --- a/src/interfaces/ecpg/preproc/ecpg.addons +++ b/src/interfaces/ecpg/preproc/ecpg.addons @@ -1,4 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.4 2009/01/30 12:53:43 petere Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.5 2009/08/14 13:28:22 meskes Exp $ */ ECPG: stmtClosePortalStmt block { @@ -238,6 +238,7 @@ ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block { struct cursor *ptr, *this; + char *comment; for (ptr = cur; ptr != NULL; ptr = ptr->next) { @@ -257,10 +258,19 @@ ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt bloc argsinsert = argsresult = NULL; cur = this; + comment = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/")); + if (INFORMIX_MODE) - $$ = cat_str(5, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("/*"), mm_strdup(this->command), make_str("*/")); + { + if (braces_open > 0) /* we're in a function */ + { + $$ = cat_str(4, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), make_str("ECPG_informix_reset_sqlca();"), comment); + } + else + $$ = cat_str(3, adjust_informix(this->argsinsert), adjust_informix(this->argsresult), comment); + } else - $$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/")); + $$ = comment; } ECPG: opt_hold block { diff --git a/src/interfaces/ecpg/preproc/ecpg.trailer b/src/interfaces/ecpg/preproc/ecpg.trailer index 3b5d660fc41..6040a4b012d 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.10 2009/08/07 10:51:20 meskes Exp $ */ +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.11 2009/08/14 13:28:22 meskes Exp $ */ statements: /*EMPTY*/ | statements statement @@ -318,7 +318,10 @@ ECPGCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR prepared_name cur = this; - $$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/")); + if (INFORMIX_MODE && braces_open > 0) /* we're in a function */ + $$ = cat_str(4, make_str("ECPG_informix_reset_sqlca();"), make_str("/*"), mm_strdup(this->command), make_str("*/")); + else + $$ = cat_str(3, make_str("/*"), mm_strdup(this->command), make_str("*/")); } ; |