diff options
Diffstat (limited to 'src/interfaces/ecpg/preproc/ecpg.addons')
-rw-r--r-- | src/interfaces/ecpg/preproc/ecpg.addons | 100 |
1 files changed, 95 insertions, 5 deletions
diff --git a/src/interfaces/ecpg/preproc/ecpg.addons b/src/interfaces/ecpg/preproc/ecpg.addons index 1c610f3dd56..f7a68f69f13 100644 --- a/src/interfaces/ecpg/preproc/ecpg.addons +++ b/src/interfaces/ecpg/preproc/ecpg.addons @@ -1,5 +1,4 @@ -/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.8 2009/11/11 20:31:26 alvherre Exp $ */ - +/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.9 2009/11/26 15:06:47 meskes Exp $ */ ECPG: stmtClosePortalStmt block { if (INFORMIX_MODE) @@ -213,18 +212,36 @@ ECPG: var_valueNumericOnly addon } ECPG: fetch_argscursor_name addon add_additional_variables($1, false); + if ($1[0] == ':') + { + free($1); + $1 = make_str("$0"); + } ECPG: fetch_argsfrom_incursor_name addon add_additional_variables($2, false); + if ($2[0] == ':') + { + free($2); + $2 = make_str("$0"); + } ECPG: fetch_argsNEXTopt_from_incursor_name addon ECPG: fetch_argsPRIORopt_from_incursor_name addon ECPG: fetch_argsFIRST_Popt_from_incursor_name addon ECPG: fetch_argsLAST_Popt_from_incursor_name addon ECPG: fetch_argsALLopt_from_incursor_name addon -ECPG: fetch_argsFORWARDopt_from_incursor_name addon -ECPG: fetch_argsBACKWARDopt_from_incursor_name addon add_additional_variables($3, false); + if ($3[0] == ':') + { + free($3); + $3 = make_str("$0"); + } ECPG: fetch_argsSignedIconstopt_from_incursor_name addon add_additional_variables($3, false); + if ($3[0] == ':') + { + free($3); + $3 = make_str("$0"); + } if ($1[0] == '$') { free($1); @@ -233,16 +250,35 @@ ECPG: fetch_argsSignedIconstopt_from_incursor_name addon ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon add_additional_variables($4, false); + if ($4[0] == ':') + { + free($4); + $4 = make_str("$0"); + } ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon add_additional_variables($4, false); + if ($4[0] == ':') + { + free($4); + $4 = make_str("$0"); + } if ($2[0] == '$') { free($2); $2 = make_str("$0"); } +ECPG: cursor_namename rule + | char_civar + { + char *curname = mm_alloc(strlen($1) + 2); + sprintf(curname, ":%s", $1); + free($1); + $1 = curname; + $$ = $1; + } ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block { $$.name = $2; @@ -260,6 +296,7 @@ ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block { struct cursor *ptr, *this; + char *cursor_marker = $2[0] == ':' ? make_str("$0") : mm_strdup($2); char *comment; for (ptr = cur; ptr != NULL; ptr = ptr->next) @@ -274,7 +311,7 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt this->name = $2; this->connection = connection; this->opened = false; - this->command = cat_str(7, make_str("declare"), mm_strdup($2), $3, make_str("cursor"), $5, make_str("for"), $7); + this->command = cat_str(7, make_str("declare"), cursor_marker, $3, make_str("cursor"), $5, make_str("for"), $7); this->argsinsert = argsinsert; this->argsresult = argsresult; argsinsert = argsresult = NULL; @@ -294,6 +331,11 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt else $$ = comment; } +ECPG: ClosePortalStmtCLOSEcursor_name block + { + char *cursor_marker = $2[0] == ':' ? make_str("$0") : $2; + $$ = cat2_str(make_str("close"), cursor_marker); + } ECPG: opt_hold block { if (compat == ECPG_COMPAT_INFORMIX_SE && autocommit == true) @@ -363,6 +405,54 @@ ECPG: FetchStmtMOVEfetch_args rule { $$ = cat2_str(make_str("fetch"), $2); } + | FETCH FORWARD cursor_name opt_ecpg_into + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("fetch forward"), cursor_marker); + } + | FETCH FORWARD from_in cursor_name opt_ecpg_into + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("fetch forward from"), cursor_marker); + } + | FETCH BACKWARD cursor_name opt_ecpg_into + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("fetch backward"), cursor_marker); + } + | FETCH BACKWARD from_in cursor_name opt_ecpg_into + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("fetch backward from"), cursor_marker); + } + | MOVE FORWARD cursor_name + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("move forward"), cursor_marker); + } + | MOVE FORWARD from_in cursor_name + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("move forward from"), cursor_marker); + } + | MOVE BACKWARD cursor_name + { + char *cursor_marker = $3[0] == ':' ? make_str("$0") : $3; + add_additional_variables($3, false); + $$ = cat_str(2, make_str("move backward"), cursor_marker); + } + | MOVE BACKWARD from_in cursor_name + { + char *cursor_marker = $4[0] == ':' ? make_str("$0") : $4; + add_additional_variables($4, false); + $$ = cat_str(2, make_str("move backward from"), cursor_marker); + } ECPG: select_limitLIMITselect_limit_value','select_offset_value block { mmerror(PARSE_ERROR, ET_WARNING, "no longer supported LIMIT #,# syntax passed to server"); |