*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.18 1997/09/20 16:14:05 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/commands/Attic/command.c,v 1.19 1997/09/29 05:56:10 vadim Exp $
*
* NOTES
* The PortalExecutorHeapMemory crap needs to be eliminated
{
Portal portal;
int feature;
- QueryDesc *queryDesc;
+ QueryDesc queryDesc;
MemoryContext context;
/* ----------------
* tell the destination to prepare to recieve some tuples
* ----------------
*/
- queryDesc = PortalGetQueryDesc(portal);
+ memcpy (&queryDesc, PortalGetQueryDesc(portal), sizeof (queryDesc));
+ queryDesc.dest = dest;
+
BeginCommand(name,
- queryDesc->operation,
+ queryDesc.operation,
portal->attinfo, /* QueryDescGetTypeInfo(queryDesc),
* */
false, /* portal fetches don't end up in
PortalExecutorHeapMemory = (MemoryContext)
PortalGetHeapMemory(portal);
- ExecutorRun(queryDesc, PortalGetState(portal), feature, count);
+ ExecutorRun(&queryDesc, PortalGetState(portal), feature, count);
/* ----------------
* Note: the "end-of-command" tag is returned by higher-level
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.52 1997/09/26 15:09:11 thomas Exp $
+ * $Header: /cvsroot/pgsql/src/backend/parser/gram.y,v 1.53 1997/09/29 05:58:12 vadim Exp $
*
* HISTORY
* AUTHOR DATE MAJOR EVENT
AddAttrStmt, ClosePortalStmt,
CopyStmt, CreateStmt, CreateSeqStmt, DefineStmt, DestroyStmt,
ExtendStmt, FetchStmt, GrantStmt, CreateTrigStmt, DropTrigStmt,
- IndexStmt, MoveStmt, ListenStmt, OptimizableStmt,
+ IndexStmt, ListenStmt, OptimizableStmt,
ProcedureStmt, PurgeStmt,
RecipeStmt, RemoveAggrStmt, RemoveOperStmt, RemoveFuncStmt, RemoveStmt,
RenameStmt, RevokeStmt, RuleStmt, TransactionStmt, ViewStmt, LoadStmt,
%type <ival> copy_dirn, archive_type, OptArchiveType, OptArchiveLocation,
def_type, opt_direction, remove_type, opt_column, event
-%type <ival> OptLocation, opt_move_where, fetch_how_many
+%type <ival> OptLocation, fetch_how_many
%type <list> OptSeqList
%type <defelt> OptSeqElem
| FetchStmt
| GrantStmt
| IndexStmt
- | MoveStmt
| ListenStmt
| ProcedureStmt
| PurgeStmt
/*****************************************************************************
*
* QUERY:
- * fetch [forward | backward] [number | all ] [ in <portalname> ]
+ * fetch/move [forward | backward] [number | all ] [ in <portalname> ]
*
*****************************************************************************/
n->direction = $2;
n->howMany = $3;
n->portalname = $4;
+ n->ismove = false;
+ $$ = (Node *)n;
+ }
+ | MOVE opt_direction fetch_how_many opt_portal_name
+ {
+ FetchStmt *n = makeNode(FetchStmt);
+ n->direction = $2;
+ n->howMany = $3;
+ n->portalname = $4;
+ n->ismove = true;
$$ = (Node *)n;
}
;
| /*EMPTY*/ { $$ = 1; /*default*/ }
;
+opt_portal_name: IN name { $$ = $2;}
+ | /*EMPTY*/ { $$ = NULL; }
+ ;
+
/*****************************************************************************
*
* QUERY:
}
;
-/*****************************************************************************
- *
- * QUERY:
- * move [<dirn>] [<whereto>] [<portalname>]
- *
- *****************************************************************************/
-
-MoveStmt: MOVE opt_direction opt_move_where opt_portal_name
- {
- MoveStmt *n = makeNode(MoveStmt);
- n->direction = $2;
- n->to = FALSE;
- n->where = $3;
- n->portalname = $4;
- $$ = (Node *)n;
- }
- | MOVE opt_direction TO Iconst opt_portal_name
- {
- MoveStmt *n = makeNode(MoveStmt);
- n->direction = $2;
- n->to = TRUE;
- n->where = $4;
- n->portalname = $5;
- $$ = (Node *)n;
- }
- ;
-
-opt_move_where: Iconst { $$ = $1; }
- | /*EMPTY*/ { $$ = 1; /* default */ }
- ;
-
-opt_portal_name: IN name { $$ = $2;}
- | /*EMPTY*/ { $$ = NULL; }
- ;
-
-
/*****************************************************************************
*
* QUERY:
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.24 1997/09/08 21:47:58 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/tcop/utility.c,v 1.25 1997/09/29 05:59:16 vadim Exp $
*
*-------------------------------------------------------------------------
*/
bool forward;
int count;
- commandTag = "FETCH";
+ commandTag = (stmt->ismove) ? "MOVE" : "FETCH";
CHECK_IF_ABORTED();
forward = (bool) (stmt->direction == FORWARD);
*/
count = stmt->howMany;
- PerformPortalFetch(portalName, forward, count, commandTag, dest);
+ PerformPortalFetch(portalName, forward, count, commandTag,
+ (stmt->ismove) ? None : dest); /* /dev/null for MOVE */
}
break;