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

Commite01c6ce

Browse files
author
Michael Meskes
committed
Give a more precise error message if a variable is re-used as cursor name in ecpg.
1 parentd174a4a commite01c6ce

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.18 2010/03/23 22:12:06 petere Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.addons,v 1.19 2010/03/31 08:45:18 meskes Exp $ */
22
ECPG: stmtClosePortalStmt block
33
{
44
if (INFORMIX_MODE)
@@ -306,7 +306,12 @@ ECPG: DeclareCursorStmtDECLAREcursor_namecursor_optionsCURSORopt_holdFORSelectSt
306306
for (ptr = cur; ptr != NULL; ptr = ptr->next)
307307
{
308308
if (strcmp($2, ptr->name) == 0)
309-
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
309+
{
310+
if ($2[0] == ':')
311+
mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
312+
else
313+
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
314+
}
310315
}
311316

312317
this = (struct cursor *) mm_alloc(sizeof(struct cursor));

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

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.23 2010/03/21 11:56:45 meskes Exp $ */
1+
/* $PostgreSQL: pgsql/src/interfaces/ecpg/preproc/ecpg.trailer,v 1.24 2010/03/31 08:45:18 meskes Exp $ */
22

33
statements: /*EMPTY*/
44
| statements statement
@@ -296,8 +296,13 @@ ECPGCursorStmt: DECLARE cursor_name cursor_options CURSOR opt_hold FOR prepared
296296
for (ptr = cur; ptr != NULL; ptr = ptr->next)
297297
{
298298
if (strcmp($2, ptr->name) == 0)
299+
{
299300
/* re-definition is a bug */
300-
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
301+
if ($2[0] == ':')
302+
mmerror(PARSE_ERROR, ET_ERROR, "using variable \"%s\" in different declare statements is not supported", $2+1);
303+
else
304+
mmerror(PARSE_ERROR, ET_ERROR, "cursor \"%s\" is already defined", $2);
305+
}
301306
}
302307

303308
this = (struct cursor *) mm_alloc(sizeof(struct cursor));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp