1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-19 13:42:17 +03:00

Change "name" nonterminal in cursor-related productions to cursor_name.

This is a preparatory patch for allowing a dynamic cursor name be used in the
ECPG grammar.

Author: Zoltan Boszormenyi
This commit is contained in:
Alvaro Herrera
2009-11-11 20:31:26 +00:00
parent af054db6ef
commit e9984c47e9
3 changed files with 44 additions and 41 deletions

View File

@@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.7 2009/11/11 19:25:40 alvherre Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.8 2009/11/11 20:31:26 alvherre Exp $ */
ECPG: stmtClosePortalStmt block
{
@@ -211,32 +211,32 @@ ECPG: var_valueNumericOnly addon
free($1);
$1 = make_str("$0");
}
ECPG: fetch_argsname addon
ECPG: fetch_argscursor_name addon
add_additional_variables($1, false);
ECPG: fetch_argsfrom_inname addon
ECPG: fetch_argsfrom_incursor_name addon
add_additional_variables($2, false);
ECPG: fetch_argsNEXTopt_from_inname addon
ECPG: fetch_argsPRIORopt_from_inname addon
ECPG: fetch_argsFIRST_Popt_from_inname addon
ECPG: fetch_argsLAST_Popt_from_inname addon
ECPG: fetch_argsALLopt_from_inname addon
ECPG: fetch_argsFORWARDopt_from_inname addon
ECPG: fetch_argsBACKWARDopt_from_inname addon
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);
ECPG: fetch_argsSignedIconstopt_from_inname addon
ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
add_additional_variables($3, false);
if ($1[0] == '$')
{
free($1);
$1 = make_str("$0");
}
ECPG: fetch_argsFORWARDALLopt_from_inname addon
ECPG: fetch_argsBACKWARDALLopt_from_inname addon
ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
add_additional_variables($4, false);
ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon
ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_inname addon
ECPG: fetch_argsFORWARDSignedIconstopt_from_inname addon
ECPG: fetch_argsBACKWARDSignedIconstopt_from_inname addon
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 ($2[0] == '$')
{
@@ -257,7 +257,7 @@ ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block
}
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
{ $$ = $2; }
ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block
ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
{
struct cursor *ptr, *this;
char *comment;

View File

@@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.13 2009/11/05 23:24:27 tgl Exp $ */
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.14 2009/11/11 20:31:26 alvherre Exp $ */
statements: /*EMPTY*/
| statements statement
@@ -275,7 +275,7 @@ prepared_name: name {
* Declare a prepared cursor. The syntax is different from the standard
* declare statement, so we create a new rule.
*/
ECPGCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR prepared_name
ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared_name
{
struct cursor *ptr, *this;
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
@@ -947,7 +947,7 @@ ECPGFree: SQL_FREE name { $$ = $2; }
/*
* open is an open cursor, at the moment this has to be removed
*/
ECPGOpen: SQL_OPEN name opt_ecpg_using { $$ = $2; };
ECPGOpen: SQL_OPEN cursor_name opt_ecpg_using { $$ = $2; };
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
| ecpg_using { $$ = $1; }