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:
parent
af054db6ef
commit
e9984c47e9
@ -11,7 +11,7 @@
|
|||||||
*
|
*
|
||||||
*
|
*
|
||||||
* IDENTIFICATION
|
* IDENTIFICATION
|
||||||
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.691 2009/11/11 19:25:40 alvherre Exp $
|
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.692 2009/11/11 20:31:26 alvherre Exp $
|
||||||
*
|
*
|
||||||
* HISTORY
|
* HISTORY
|
||||||
* AUTHOR DATE MAJOR EVENT
|
* AUTHOR DATE MAJOR EVENT
|
||||||
@ -251,7 +251,7 @@ static TypeName *TableFuncTypeName(List *columns);
|
|||||||
|
|
||||||
%type <str> copy_file_name
|
%type <str> copy_file_name
|
||||||
database_name access_method_clause access_method attr_name
|
database_name access_method_clause access_method attr_name
|
||||||
index_name name file_name cluster_index_specification
|
index_name name cursor_name file_name cluster_index_specification
|
||||||
|
|
||||||
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
|
%type <list> func_name handler_name qual_Op qual_all_Op subquery_Op
|
||||||
opt_class opt_inline_handler opt_validator validator_clause
|
opt_class opt_inline_handler opt_validator validator_clause
|
||||||
@ -1941,7 +1941,7 @@ reloption_elem:
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
ClosePortalStmt:
|
ClosePortalStmt:
|
||||||
CLOSE name
|
CLOSE cursor_name
|
||||||
{
|
{
|
||||||
ClosePortalStmt *n = makeNode(ClosePortalStmt);
|
ClosePortalStmt *n = makeNode(ClosePortalStmt);
|
||||||
n->portalname = $2;
|
n->portalname = $2;
|
||||||
@ -4194,7 +4194,7 @@ FetchStmt: FETCH fetch_args
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
fetch_args: name
|
fetch_args: cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $1;
|
n->portalname = $1;
|
||||||
@ -4202,7 +4202,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| from_in name
|
| from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $2;
|
n->portalname = $2;
|
||||||
@ -4210,7 +4210,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| NEXT opt_from_in name
|
| NEXT opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4218,7 +4218,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| PRIOR opt_from_in name
|
| PRIOR opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4226,7 +4226,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| FIRST_P opt_from_in name
|
| FIRST_P opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4234,7 +4234,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| LAST_P opt_from_in name
|
| LAST_P opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4242,7 +4242,7 @@ fetch_args: name
|
|||||||
n->howMany = -1;
|
n->howMany = -1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ABSOLUTE_P SignedIconst opt_from_in name
|
| ABSOLUTE_P SignedIconst opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $4;
|
n->portalname = $4;
|
||||||
@ -4250,7 +4250,7 @@ fetch_args: name
|
|||||||
n->howMany = $2;
|
n->howMany = $2;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| RELATIVE_P SignedIconst opt_from_in name
|
| RELATIVE_P SignedIconst opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $4;
|
n->portalname = $4;
|
||||||
@ -4258,7 +4258,7 @@ fetch_args: name
|
|||||||
n->howMany = $2;
|
n->howMany = $2;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| SignedIconst opt_from_in name
|
| SignedIconst opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4266,7 +4266,7 @@ fetch_args: name
|
|||||||
n->howMany = $1;
|
n->howMany = $1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| ALL opt_from_in name
|
| ALL opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4274,7 +4274,7 @@ fetch_args: name
|
|||||||
n->howMany = FETCH_ALL;
|
n->howMany = FETCH_ALL;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| FORWARD opt_from_in name
|
| FORWARD opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4282,7 +4282,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| FORWARD SignedIconst opt_from_in name
|
| FORWARD SignedIconst opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $4;
|
n->portalname = $4;
|
||||||
@ -4290,7 +4290,7 @@ fetch_args: name
|
|||||||
n->howMany = $2;
|
n->howMany = $2;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| FORWARD ALL opt_from_in name
|
| FORWARD ALL opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $4;
|
n->portalname = $4;
|
||||||
@ -4298,7 +4298,7 @@ fetch_args: name
|
|||||||
n->howMany = FETCH_ALL;
|
n->howMany = FETCH_ALL;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| BACKWARD opt_from_in name
|
| BACKWARD opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $3;
|
n->portalname = $3;
|
||||||
@ -4306,7 +4306,7 @@ fetch_args: name
|
|||||||
n->howMany = 1;
|
n->howMany = 1;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| BACKWARD SignedIconst opt_from_in name
|
| BACKWARD SignedIconst opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $4;
|
n->portalname = $4;
|
||||||
@ -4314,7 +4314,7 @@ fetch_args: name
|
|||||||
n->howMany = $2;
|
n->howMany = $2;
|
||||||
$$ = (Node *)n;
|
$$ = (Node *)n;
|
||||||
}
|
}
|
||||||
| BACKWARD ALL opt_from_in name
|
| BACKWARD ALL opt_from_in cursor_name
|
||||||
{
|
{
|
||||||
FetchStmt *n = makeNode(FetchStmt);
|
FetchStmt *n = makeNode(FetchStmt);
|
||||||
n->portalname = $4;
|
n->portalname = $4;
|
||||||
@ -7108,7 +7108,7 @@ set_target_list:
|
|||||||
* CURSOR STATEMENTS
|
* CURSOR STATEMENTS
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
|
DeclareCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR SelectStmt
|
||||||
{
|
{
|
||||||
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
|
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
|
||||||
n->portalname = $2;
|
n->portalname = $2;
|
||||||
@ -7119,6 +7119,9 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
|
|||||||
}
|
}
|
||||||
;
|
;
|
||||||
|
|
||||||
|
cursor_name: name { $$ = $1; }
|
||||||
|
;
|
||||||
|
|
||||||
cursor_options: /*EMPTY*/ { $$ = 0; }
|
cursor_options: /*EMPTY*/ { $$ = 0; }
|
||||||
| cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; }
|
| cursor_options NO SCROLL { $$ = $1 | CURSOR_OPT_NO_SCROLL; }
|
||||||
| cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; }
|
| cursor_options SCROLL { $$ = $1 | CURSOR_OPT_SCROLL; }
|
||||||
|
@ -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
|
ECPG: stmtClosePortalStmt block
|
||||||
{
|
{
|
||||||
@ -211,32 +211,32 @@ ECPG: var_valueNumericOnly addon
|
|||||||
free($1);
|
free($1);
|
||||||
$1 = make_str("$0");
|
$1 = make_str("$0");
|
||||||
}
|
}
|
||||||
ECPG: fetch_argsname addon
|
ECPG: fetch_argscursor_name addon
|
||||||
add_additional_variables($1, false);
|
add_additional_variables($1, false);
|
||||||
ECPG: fetch_argsfrom_inname addon
|
ECPG: fetch_argsfrom_incursor_name addon
|
||||||
add_additional_variables($2, false);
|
add_additional_variables($2, false);
|
||||||
ECPG: fetch_argsNEXTopt_from_inname addon
|
ECPG: fetch_argsNEXTopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsPRIORopt_from_inname addon
|
ECPG: fetch_argsPRIORopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsFIRST_Popt_from_inname addon
|
ECPG: fetch_argsFIRST_Popt_from_incursor_name addon
|
||||||
ECPG: fetch_argsLAST_Popt_from_inname addon
|
ECPG: fetch_argsLAST_Popt_from_incursor_name addon
|
||||||
ECPG: fetch_argsALLopt_from_inname addon
|
ECPG: fetch_argsALLopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsFORWARDopt_from_inname addon
|
ECPG: fetch_argsFORWARDopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsBACKWARDopt_from_inname addon
|
ECPG: fetch_argsBACKWARDopt_from_incursor_name addon
|
||||||
add_additional_variables($3, false);
|
add_additional_variables($3, false);
|
||||||
ECPG: fetch_argsSignedIconstopt_from_inname addon
|
ECPG: fetch_argsSignedIconstopt_from_incursor_name addon
|
||||||
add_additional_variables($3, false);
|
add_additional_variables($3, false);
|
||||||
if ($1[0] == '$')
|
if ($1[0] == '$')
|
||||||
{
|
{
|
||||||
free($1);
|
free($1);
|
||||||
$1 = make_str("$0");
|
$1 = make_str("$0");
|
||||||
}
|
}
|
||||||
ECPG: fetch_argsFORWARDALLopt_from_inname addon
|
ECPG: fetch_argsFORWARDALLopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsBACKWARDALLopt_from_inname addon
|
ECPG: fetch_argsBACKWARDALLopt_from_incursor_name addon
|
||||||
add_additional_variables($4, false);
|
add_additional_variables($4, false);
|
||||||
ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon
|
ECPG: fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_inname addon
|
ECPG: fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsFORWARDSignedIconstopt_from_inname addon
|
ECPG: fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
|
||||||
ECPG: fetch_argsBACKWARDSignedIconstopt_from_inname addon
|
ECPG: fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
|
||||||
add_additional_variables($4, false);
|
add_additional_variables($4, false);
|
||||||
if ($2[0] == '$')
|
if ($2[0] == '$')
|
||||||
{
|
{
|
||||||
@ -257,7 +257,7 @@ ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block
|
|||||||
}
|
}
|
||||||
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
|
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
|
||||||
{ $$ = $2; }
|
{ $$ = $2; }
|
||||||
ECPG: DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block
|
ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
|
||||||
{
|
{
|
||||||
struct cursor *ptr, *this;
|
struct cursor *ptr, *this;
|
||||||
char *comment;
|
char *comment;
|
||||||
|
@ -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: /*EMPTY*/
|
||||||
| statements statement
|
| statements statement
|
||||||
@ -275,7 +275,7 @@ prepared_name: name {
|
|||||||
* Declare a prepared cursor. The syntax is different from the standard
|
* Declare a prepared cursor. The syntax is different from the standard
|
||||||
* declare statement, so we create a new rule.
|
* 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 cursor *ptr, *this;
|
||||||
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
|
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
|
* 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; }
|
opt_ecpg_using: /*EMPTY*/ { $$ = EMPTY; }
|
||||||
| ecpg_using { $$ = $1; }
|
| ecpg_using { $$ = $1; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user