1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-30 21:42:05 +03:00

Clean up BeginCommand and related routines. BeginCommand and EndCommand

are now both invoked once per received SQL command (raw parsetree) from
pg_exec_query_string.  BeginCommand is actually just an empty routine
at the moment --- all its former operations have been pushed into tuple
receiver setup routines in printtup.c.  This makes for a clean distinction
between BeginCommand/EndCommand (once per command) and the tuple receiver
setup/teardown routines (once per ExecutorRun call), whereas the old code
was quite ad hoc.  Along the way, clean up the calling conventions for
ExecutorRun a little bit.
This commit is contained in:
Tom Lane
2002-02-27 19:36:13 +00:00
parent e22c9c4475
commit 6779c55c22
15 changed files with 266 additions and 361 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.48 2002/02/26 22:47:05 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/executor/functions.c,v 1.49 2002/02/27 19:34:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -111,9 +111,8 @@ init_execution_state(char *src, Oid *argOidVect, int nargs)
nextes->next = NULL;
nextes->status = F_EXEC_START;
nextes->qd = CreateQueryDesc(queryTree,
planTree,
None);
nextes->qd = CreateQueryDesc(queryTree, planTree, None, NULL);
estate = CreateExecutorState();
if (nargs > 0)
@ -268,7 +267,7 @@ postquel_start(execution_state *es)
static TupleTableSlot *
postquel_getnext(execution_state *es)
{
int feature;
long count;
if (es->qd->operation == CMD_UTILITY)
{
@ -281,9 +280,10 @@ postquel_getnext(execution_state *es)
return (TupleTableSlot *) NULL;
}
feature = (LAST_POSTQUEL_COMMAND(es)) ? EXEC_RETONE : EXEC_RUN;
/* If it's not the last command, just run it to completion */
count = (LAST_POSTQUEL_COMMAND(es)) ? 1L : 0L;
return ExecutorRun(es->qd, es->estate, feature, 0L);
return ExecutorRun(es->qd, es->estate, ForwardScanDirection, count);
}
static void