예제 #1
0
파일: dest.c 프로젝트: avontd2868/postgres
/* ----------------
 *		CreateDestReceiver - return appropriate receiver function set for dest
 * ----------------
 */
DestReceiver *
CreateDestReceiver(CommandDest dest)
{
	switch (dest)
	{
		case DestRemote:
		case DestRemoteExecute:
			return printtup_create_DR(dest);

		case DestNone:
			return &donothingDR;

		case DestDebug:
			return &debugtupDR;

		case DestSPI:
			return &spi_printtupDR;

		case DestTuplestore:
			return CreateTuplestoreDestReceiver();

		case DestIntoRel:
			return CreateIntoRelDestReceiver();

		case DestCopyOut:
			return CreateCopyDestReceiver();

		case DestSQLFunction:
			return CreateSQLFunctionDestReceiver();
	}

	/* should never get here */
	return &donothingDR;
}
예제 #2
0
파일: dest.c 프로젝트: adityavs/postgres
/* ----------------
 *		CreateDestReceiver - return appropriate receiver function set for dest
 * ----------------
 */
DestReceiver *
CreateDestReceiver(CommandDest dest)
{
	/*
	 * It's ok to cast the constness away as any modification of the none receiver
	 * would be a bug (which gets easier to catch this way).
	 */

	switch (dest)
	{
		case DestRemote:
		case DestRemoteExecute:
			return printtup_create_DR(dest);

		case DestRemoteSimple:
			return unconstify(DestReceiver *, &printsimpleDR);

		case DestNone:
			return unconstify(DestReceiver *, &donothingDR);

		case DestDebug:
			return unconstify(DestReceiver *, &debugtupDR);

		case DestSPI:
			return unconstify(DestReceiver *, &spi_printtupDR);

		case DestTuplestore:
			return CreateTuplestoreDestReceiver();

		case DestIntoRel:
			return CreateIntoRelDestReceiver(NULL);

		case DestCopyOut:
			return CreateCopyDestReceiver();

		case DestSQLFunction:
			return CreateSQLFunctionDestReceiver();

		case DestTransientRel:
			return CreateTransientRelDestReceiver(InvalidOid);

		case DestTupleQueue:
			return CreateTupleQueueDestReceiver(NULL);
	}

	/* should never get here */
	pg_unreachable();
}
예제 #3
0
/* ----------------
 *		CreateDestReceiver - return appropriate receiver function set for dest
 *
 * Note: a Portal must be specified for destinations DestRemote,
 * DestRemoteExecute, and DestTuplestore.  It can be NULL for the others.
 * ----------------
 */
DestReceiver *
CreateDestReceiver(CommandDest dest, Portal portal)
{
	switch (dest)
	{
		case DestRemote:
		case DestRemoteExecute:
			if (portal == NULL)
				elog(ERROR, "no portal specified for DestRemote receiver");
			return printtup_create_DR(dest, portal);

		case DestNone:
			return &donothingDR;

		case DestDebug:
			return &debugtupDR;

		case DestSPI:
			return &spi_printtupDR;

		case DestTuplestore:
			if (portal == NULL)
				elog(ERROR, "no portal specified for DestTuplestore receiver");
			if (portal->holdStore == NULL ||
				portal->holdContext == NULL)
				elog(ERROR, "portal has no holdStore");
			return CreateTuplestoreDestReceiver(portal->holdStore,
												portal->holdContext);

		case DestIntoRel:
			return CreateIntoRelDestReceiver();

		case DestCopyOut:
			return CreateCopyDestReceiver();
	}

	/* should never get here */
	return &donothingDR;
}