提交 80c5fea9 编写于 作者: B Bruce Momjian

Since this patch is not big I send it here instead. I do not have the

complete source checked out so I cannot commit it myself.

Michael
上级 0cb6bc70
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.129 2000/01/18 06:12:03 momjian Exp $ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 2.130 2000/01/18 19:08:13 momjian Exp $
* *
* HISTORY * HISTORY
* AUTHOR DATE MAJOR EVENT * AUTHOR DATE MAJOR EVENT
...@@ -156,7 +156,7 @@ static Node *doNegate(Node *n); ...@@ -156,7 +156,7 @@ static Node *doNegate(Node *n);
database_name, access_method_clause, access_method, attr_name, database_name, access_method_clause, access_method, attr_name,
class, index_name, name, func_name, file_name, aggr_argtype class, index_name, name, func_name, file_name, aggr_argtype
%type <str> opt_id, opt_portal_name, %type <str> opt_id,
all_Op, MathOp, opt_name, opt_unique, all_Op, MathOp, opt_name, opt_unique,
OptUseOp, opt_class, SpecialRuleRelation OptUseOp, opt_class, SpecialRuleRelation
...@@ -199,7 +199,7 @@ static Node *doNegate(Node *n); ...@@ -199,7 +199,7 @@ static Node *doNegate(Node *n);
opt_with_copy, index_opt_unique, opt_verbose, opt_analyze opt_with_copy, index_opt_unique, opt_verbose, opt_analyze
%type <boolean> opt_cursor %type <boolean> opt_cursor
%type <ival> copy_dirn, def_type, opt_direction, remove_type, %type <ival> copy_dirn, def_type, direction, remove_type,
opt_column, event, comment_type, comment_cl, opt_column, event, comment_type, comment_cl,
comment_ag, comment_fn, comment_op, comment_tg comment_ag, comment_fn, comment_op, comment_tg
...@@ -1861,7 +1861,7 @@ comment_text: Sconst { $$ = $1; } ...@@ -1861,7 +1861,7 @@ comment_text: Sconst { $$ = $1; }
* *
*****************************************************************************/ *****************************************************************************/
FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name FetchStmt: FETCH direction fetch_how_many from_in name
{ {
FetchStmt *n = makeNode(FetchStmt); FetchStmt *n = makeNode(FetchStmt);
if ($2 == RELATIVE) if ($2 == RELATIVE)
...@@ -1877,11 +1877,60 @@ FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name ...@@ -1877,11 +1877,60 @@ FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name
} }
n->direction = $2; n->direction = $2;
n->howMany = $3; n->howMany = $3;
n->portalname = $5;
n->ismove = false;
$$ = (Node *)n;
}
| FETCH fetch_how_many from_in name
{
FetchStmt *n = makeNode(FetchStmt);
if ($2 < 0)
{
n->howMany = -$2;
n->direction = BACKWARD;
}
else
{
n->direction = FORWARD;
n->howMany = $2;
}
n->portalname = $4;
n->ismove = false;
$$ = (Node *)n;
}
| FETCH direction from_in name
{
FetchStmt *n = makeNode(FetchStmt);
if ($2 == RELATIVE)
{
$2 = FORWARD;
}
n->direction = $2;
n->howMany = 1;
n->portalname = $4; n->portalname = $4;
n->ismove = false; n->ismove = false;
$$ = (Node *)n; $$ = (Node *)n;
} }
| MOVE opt_direction fetch_how_many opt_portal_name | FETCH from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->howMany = 1;
n->portalname = $3;
n->ismove = false;
$$ = (Node *)n;
}
| FETCH name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->howMany = 1;
n->portalname = $2;
n->ismove = false;
$$ = (Node *)n;
}
| MOVE direction fetch_how_many from_in name
{ {
FetchStmt *n = makeNode(FetchStmt); FetchStmt *n = makeNode(FetchStmt);
if ($3 < 0) if ($3 < 0)
...@@ -1891,13 +1940,57 @@ FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name ...@@ -1891,13 +1940,57 @@ FetchStmt: FETCH opt_direction fetch_how_many opt_portal_name
} }
n->direction = $2; n->direction = $2;
n->howMany = $3; n->howMany = $3;
n->portalname = $5;
n->ismove = TRUE;
$$ = (Node *)n;
}
| MOVE fetch_how_many from_in name
{
FetchStmt *n = makeNode(FetchStmt);
if ($2 < 0)
{
n->howMany = -$2;
n->direction = BACKWARD;
}
else
{
n->direction = FORWARD;
n->howMany = $2;
}
n->portalname = $4; n->portalname = $4;
n->ismove = TRUE; n->ismove = TRUE;
$$ = (Node *)n; $$ = (Node *)n;
} }
| MOVE direction from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = $2;
n->howMany = 1;
n->portalname = $4;
n->ismove = TRUE;
$$ = (Node *)n;
}
| MOVE from_in name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->howMany = 1;
n->portalname = $3;
n->ismove = TRUE;
$$ = (Node *)n;
}
| MOVE name
{
FetchStmt *n = makeNode(FetchStmt);
n->direction = FORWARD;
n->howMany = 1;
n->portalname = $2;
n->ismove = TRUE;
$$ = (Node *)n;
}
; ;
opt_direction: FORWARD { $$ = FORWARD; } direction: FORWARD { $$ = FORWARD; }
| BACKWARD { $$ = BACKWARD; } | BACKWARD { $$ = BACKWARD; }
| RELATIVE { $$ = RELATIVE; } | RELATIVE { $$ = RELATIVE; }
| ABSOLUTE | ABSOLUTE
...@@ -1905,7 +1998,6 @@ opt_direction: FORWARD { $$ = FORWARD; } ...@@ -1905,7 +1998,6 @@ opt_direction: FORWARD { $$ = FORWARD; }
elog(NOTICE,"FETCH/ABSOLUTE not supported, using RELATIVE"); elog(NOTICE,"FETCH/ABSOLUTE not supported, using RELATIVE");
$$ = RELATIVE; $$ = RELATIVE;
} }
| /*EMPTY*/ { $$ = FORWARD; /* default */ }
; ;
fetch_how_many: Iconst { $$ = $1; } fetch_how_many: Iconst { $$ = $1; }
...@@ -1913,13 +2005,11 @@ fetch_how_many: Iconst { $$ = $1; } ...@@ -1913,13 +2005,11 @@ fetch_how_many: Iconst { $$ = $1; }
| ALL { $$ = 0; /* 0 means fetch all tuples*/ } | ALL { $$ = 0; /* 0 means fetch all tuples*/ }
| NEXT { $$ = 1; } | NEXT { $$ = 1; }
| PRIOR { $$ = -1; } | PRIOR { $$ = -1; }
| /*EMPTY*/ { $$ = 1; /*default*/ }
; ;
opt_portal_name: IN name { $$ = $2; } from_in: IN
| FROM name { $$ = $2; } | FROM
| /*EMPTY*/ { $$ = NULL; } ;
;
/***************************************************************************** /*****************************************************************************
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册