📄 tstorereceiver.c
字号:
/*------------------------------------------------------------------------- * * tstoreReceiver.c * an implementation of DestReceiver that stores the result tuples in * a Tuplestore * * * Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION * $PostgreSQL: pgsql/src/backend/executor/tstoreReceiver.c,v 1.15 2005/11/03 17:11:36 alvherre Exp $ * *------------------------------------------------------------------------- */#include "postgres.h"#include "executor/tstoreReceiver.h"typedef struct{ DestReceiver pub; Tuplestorestate *tstore; MemoryContext cxt;} TStoreState;/* * Prepare to receive tuples from executor. */static voidtstoreStartupReceiver(DestReceiver *self, int operation, TupleDesc typeinfo){ /* do nothing */}/* * Receive a tuple from the executor and store it in the tuplestore. */static voidtstoreReceiveSlot(TupleTableSlot *slot, DestReceiver *self){ TStoreState *myState = (TStoreState *) self; MemoryContext oldcxt = MemoryContextSwitchTo(myState->cxt); tuplestore_puttuple(myState->tstore, ExecFetchSlotTuple(slot)); MemoryContextSwitchTo(oldcxt);}/* * Clean up at end of an executor run */static voidtstoreShutdownReceiver(DestReceiver *self){ /* do nothing */}/* * Destroy receiver when done with it */static voidtstoreDestroyReceiver(DestReceiver *self){ pfree(self);}/* * Initially create a DestReceiver object. */DestReceiver *CreateTuplestoreDestReceiver(Tuplestorestate *tStore, MemoryContext tContext){ TStoreState *self = (TStoreState *) palloc(sizeof(TStoreState)); self->pub.receiveSlot = tstoreReceiveSlot; self->pub.rStartup = tstoreStartupReceiver; self->pub.rShutdown = tstoreShutdownReceiver; self->pub.rDestroy = tstoreDestroyReceiver; self->pub.mydest = DestTuplestore; self->tstore = tStore; self->cxt = tContext; return (DestReceiver *) self;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -