Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commite9984c4

Browse files
committed
Change "name" nonterminal in cursor-related productions to cursor_name.
This is a preparatory patch for allowing a dynamic cursor name be used in theECPG grammar.Author: Zoltan Boszormenyi
1 parentaf054db commite9984c4

File tree

3 files changed

+44
-41
lines changed

3 files changed

+44
-41
lines changed

‎src/backend/parser/gram.y

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
*
1212
*
1313
* IDENTIFICATION
14-
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.691 2009/11/1119:25:40 alvherre Exp $
14+
* $PostgreSQL: pgsql/src/backend/parser/gram.y,v 2.692 2009/11/1120:31:26 alvherre Exp $
1515
*
1616
* HISTORY
1717
* AUTHORDATEMAJOR EVENT
@@ -251,7 +251,7 @@ static TypeName *TableFuncTypeName(List *columns);
251251

252252
%type<str>copy_file_name
253253
database_nameaccess_method_clauseaccess_methodattr_name
254-
index_namenamefile_namecluster_index_specification
254+
index_namenamecursor_namefile_namecluster_index_specification
255255

256256
%type<list>func_namehandler_namequal_Opqual_all_Opsubquery_Op
257257
opt_classopt_inline_handleropt_validatorvalidator_clause
@@ -1941,7 +1941,7 @@ reloption_elem:
19411941
*****************************************************************************/
19421942

19431943
ClosePortalStmt:
1944-
CLOSEname
1944+
CLOSEcursor_name
19451945
{
19461946
ClosePortalStmt *n = makeNode(ClosePortalStmt);
19471947
n->portalname =$2;
@@ -4194,127 +4194,127 @@ FetchStmt:FETCH fetch_args
41944194
}
41954195
;
41964196

4197-
fetch_args:name
4197+
fetch_args:cursor_name
41984198
{
41994199
FetchStmt *n = makeNode(FetchStmt);
42004200
n->portalname =$1;
42014201
n->direction = FETCH_FORWARD;
42024202
n->howMany =1;
42034203
$$ = (Node *)n;
42044204
}
4205-
| from_inname
4205+
| from_incursor_name
42064206
{
42074207
FetchStmt *n = makeNode(FetchStmt);
42084208
n->portalname =$2;
42094209
n->direction = FETCH_FORWARD;
42104210
n->howMany =1;
42114211
$$ = (Node *)n;
42124212
}
4213-
| NEXT opt_from_inname
4213+
| NEXT opt_from_incursor_name
42144214
{
42154215
FetchStmt *n = makeNode(FetchStmt);
42164216
n->portalname =$3;
42174217
n->direction = FETCH_FORWARD;
42184218
n->howMany =1;
42194219
$$ = (Node *)n;
42204220
}
4221-
| PRIOR opt_from_inname
4221+
| PRIOR opt_from_incursor_name
42224222
{
42234223
FetchStmt *n = makeNode(FetchStmt);
42244224
n->portalname =$3;
42254225
n->direction = FETCH_BACKWARD;
42264226
n->howMany =1;
42274227
$$ = (Node *)n;
42284228
}
4229-
| FIRST_P opt_from_inname
4229+
| FIRST_P opt_from_incursor_name
42304230
{
42314231
FetchStmt *n = makeNode(FetchStmt);
42324232
n->portalname =$3;
42334233
n->direction = FETCH_ABSOLUTE;
42344234
n->howMany =1;
42354235
$$ = (Node *)n;
42364236
}
4237-
| LAST_P opt_from_inname
4237+
| LAST_P opt_from_incursor_name
42384238
{
42394239
FetchStmt *n = makeNode(FetchStmt);
42404240
n->portalname =$3;
42414241
n->direction = FETCH_ABSOLUTE;
42424242
n->howMany = -1;
42434243
$$ = (Node *)n;
42444244
}
4245-
| ABSOLUTE_P SignedIconst opt_from_inname
4245+
| ABSOLUTE_P SignedIconst opt_from_incursor_name
42464246
{
42474247
FetchStmt *n = makeNode(FetchStmt);
42484248
n->portalname =$4;
42494249
n->direction = FETCH_ABSOLUTE;
42504250
n->howMany =$2;
42514251
$$ = (Node *)n;
42524252
}
4253-
| RELATIVE_P SignedIconst opt_from_inname
4253+
| RELATIVE_P SignedIconst opt_from_incursor_name
42544254
{
42554255
FetchStmt *n = makeNode(FetchStmt);
42564256
n->portalname =$4;
42574257
n->direction = FETCH_RELATIVE;
42584258
n->howMany =$2;
42594259
$$ = (Node *)n;
42604260
}
4261-
| SignedIconst opt_from_inname
4261+
| SignedIconst opt_from_incursor_name
42624262
{
42634263
FetchStmt *n = makeNode(FetchStmt);
42644264
n->portalname =$3;
42654265
n->direction = FETCH_FORWARD;
42664266
n->howMany =$1;
42674267
$$ = (Node *)n;
42684268
}
4269-
| ALL opt_from_inname
4269+
| ALL opt_from_incursor_name
42704270
{
42714271
FetchStmt *n = makeNode(FetchStmt);
42724272
n->portalname =$3;
42734273
n->direction = FETCH_FORWARD;
42744274
n->howMany = FETCH_ALL;
42754275
$$ = (Node *)n;
42764276
}
4277-
| FORWARD opt_from_inname
4277+
| FORWARD opt_from_incursor_name
42784278
{
42794279
FetchStmt *n = makeNode(FetchStmt);
42804280
n->portalname =$3;
42814281
n->direction = FETCH_FORWARD;
42824282
n->howMany =1;
42834283
$$ = (Node *)n;
42844284
}
4285-
| FORWARD SignedIconst opt_from_inname
4285+
| FORWARD SignedIconst opt_from_incursor_name
42864286
{
42874287
FetchStmt *n = makeNode(FetchStmt);
42884288
n->portalname =$4;
42894289
n->direction = FETCH_FORWARD;
42904290
n->howMany =$2;
42914291
$$ = (Node *)n;
42924292
}
4293-
| FORWARD ALL opt_from_inname
4293+
| FORWARD ALL opt_from_incursor_name
42944294
{
42954295
FetchStmt *n = makeNode(FetchStmt);
42964296
n->portalname =$4;
42974297
n->direction = FETCH_FORWARD;
42984298
n->howMany = FETCH_ALL;
42994299
$$ = (Node *)n;
43004300
}
4301-
| BACKWARD opt_from_inname
4301+
| BACKWARD opt_from_incursor_name
43024302
{
43034303
FetchStmt *n = makeNode(FetchStmt);
43044304
n->portalname =$3;
43054305
n->direction = FETCH_BACKWARD;
43064306
n->howMany =1;
43074307
$$ = (Node *)n;
43084308
}
4309-
| BACKWARD SignedIconst opt_from_inname
4309+
| BACKWARD SignedIconst opt_from_incursor_name
43104310
{
43114311
FetchStmt *n = makeNode(FetchStmt);
43124312
n->portalname =$4;
43134313
n->direction = FETCH_BACKWARD;
43144314
n->howMany =$2;
43154315
$$ = (Node *)n;
43164316
}
4317-
| BACKWARD ALL opt_from_inname
4317+
| BACKWARD ALL opt_from_incursor_name
43184318
{
43194319
FetchStmt *n = makeNode(FetchStmt);
43204320
n->portalname =$4;
@@ -7108,7 +7108,7 @@ set_target_list:
71087108
*CURSOR STATEMENTS
71097109
*
71107110
*****************************************************************************/
7111-
DeclareCursorStmt: DECLAREname cursor_options CURSOR opt_hold FOR SelectStmt
7111+
DeclareCursorStmt: DECLAREcursor_name cursor_options CURSOR opt_hold FOR SelectStmt
71127112
{
71137113
DeclareCursorStmt *n = makeNode(DeclareCursorStmt);
71147114
n->portalname =$2;
@@ -7119,6 +7119,9 @@ DeclareCursorStmt: DECLARE name cursor_options CURSOR opt_hold FOR SelectStmt
71197119
}
71207120
;
71217121

7122+
cursor_name:name{$$ =$1; }
7123+
;
7124+
71227125
cursor_options:/*EMPTY*/{$$ =0; }
71237126
| cursor_options NO SCROLL{$$ =$1 | CURSOR_OPT_NO_SCROLL; }
71247127
| cursor_options SCROLL{$$ =$1 | CURSOR_OPT_SCROLL; }

‎src/interfaces/ecpg/preproc/ecpg.addons

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.7 2009/11/1119:25:40 alvherre Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.8 2009/11/1120:31:26 alvherre Exp $ */
22

33
ECPG: stmtClosePortalStmt block
44
{
@@ -211,32 +211,32 @@ ECPG: var_valueNumericOnly addon
211211
free($1);
212212
$1 = make_str("$0");
213213
}
214-
ECPG:fetch_argsname addon
214+
ECPG:fetch_argscursor_name addon
215215
add_additional_variables($1, false);
216-
ECPG:fetch_argsfrom_inname addon
216+
ECPG:fetch_argsfrom_incursor_name addon
217217
add_additional_variables($2, false);
218-
ECPG:fetch_argsNEXTopt_from_inname addon
219-
ECPG:fetch_argsPRIORopt_from_inname addon
220-
ECPG:fetch_argsFIRST_Popt_from_inname addon
221-
ECPG:fetch_argsLAST_Popt_from_inname addon
222-
ECPG:fetch_argsALLopt_from_inname addon
223-
ECPG:fetch_argsFORWARDopt_from_inname addon
224-
ECPG:fetch_argsBACKWARDopt_from_inname addon
218+
ECPG:fetch_argsNEXTopt_from_incursor_name addon
219+
ECPG:fetch_argsPRIORopt_from_incursor_name addon
220+
ECPG:fetch_argsFIRST_Popt_from_incursor_name addon
221+
ECPG:fetch_argsLAST_Popt_from_incursor_name addon
222+
ECPG:fetch_argsALLopt_from_incursor_name addon
223+
ECPG:fetch_argsFORWARDopt_from_incursor_name addon
224+
ECPG:fetch_argsBACKWARDopt_from_incursor_name addon
225225
add_additional_variables($3, false);
226-
ECPG:fetch_argsSignedIconstopt_from_inname addon
226+
ECPG:fetch_argsSignedIconstopt_from_incursor_name addon
227227
add_additional_variables($3, false);
228228
if ($1[0] == '$')
229229
{
230230
free($1);
231231
$1 = make_str("$0");
232232
}
233-
ECPG:fetch_argsFORWARDALLopt_from_inname addon
234-
ECPG:fetch_argsBACKWARDALLopt_from_inname addon
233+
ECPG:fetch_argsFORWARDALLopt_from_incursor_name addon
234+
ECPG:fetch_argsBACKWARDALLopt_from_incursor_name addon
235235
add_additional_variables($4, false);
236-
ECPG:fetch_argsABSOLUTE_PSignedIconstopt_from_inname addon
237-
ECPG:fetch_argsRELATIVE_PSignedIconstopt_from_inname addon
238-
ECPG:fetch_argsFORWARDSignedIconstopt_from_inname addon
239-
ECPG:fetch_argsBACKWARDSignedIconstopt_from_inname addon
236+
ECPG:fetch_argsABSOLUTE_PSignedIconstopt_from_incursor_name addon
237+
ECPG:fetch_argsRELATIVE_PSignedIconstopt_from_incursor_name addon
238+
ECPG:fetch_argsFORWARDSignedIconstopt_from_incursor_name addon
239+
ECPG:fetch_argsBACKWARDSignedIconstopt_from_incursor_name addon
240240
add_additional_variables($4, false);
241241
if ($2[0] == '$')
242242
{
@@ -257,7 +257,7 @@ ECPG: PrepareStmtPREPAREprepared_nameprep_type_clauseASPreparableStmt block
257257
}
258258
ECPG: ExecuteStmtEXECUTEprepared_nameexecute_param_clauseexecute_rest block
259259
{ $$ = $2; }
260-
ECPG:DeclareCursorStmtDECLAREnamecursor_optionsCURSORopt_holdFORSelectStmt block
260+
ECPG:DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectStmt block
261261
{
262262
struct cursor *ptr, *this;
263263
char *comment;

‎src/interfaces/ecpg/preproc/ecpg.trailer

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.13 2009/11/05 23:24:27 tgl Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.14 2009/11/11 20:31:26 alvherre Exp $ */
22

33
statements: /*EMPTY*/
44
| statements statement
@@ -275,7 +275,7 @@ prepared_name: name {
275275
* Declare a prepared cursor. The syntax is different from the standard
276276
* declare statement, so we create a new rule.
277277
*/
278-
ECPGCursorStmt: DECLAREname cursor_options CURSOR opt_hold FOR prepared_name
278+
ECPGCursorStmt: DECLAREcursor_name cursor_options CURSOR opt_hold FOR prepared_name
279279
{
280280
struct cursor *ptr, *this;
281281
struct variable *thisquery = (struct variable *)mm_alloc(sizeof(struct variable));
@@ -947,7 +947,7 @@ ECPGFree:SQL_FREE name{ $$ = $2; }
947947
/*
948948
* open is an open cursor, at the moment this has to be removed
949949
*/
950-
ECPGOpen: SQL_OPENname opt_ecpg_using { $$ = $2; };
950+
ECPGOpen: SQL_OPENcursor_name opt_ecpg_using { $$ = $2; };
951951

952952
opt_ecpg_using: /*EMPTY*/{ $$ = EMPTY; }
953953
| ecpg_using{ $$ = $1; }

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp