Skip to content
Snippets Groups Projects
dest.c 6.88 KiB
/*-------------------------------------------------------------------------
 *
 * dest.c--
 *	  support for various communication destinations - see lib/H/tcop/dest.h
 *
 * Copyright (c) 1994, Regents of the University of California
 *
 *
 * IDENTIFICATION
 *	  $Header: /cvsroot/pgsql/src/backend/tcop/dest.c,v 1.13 1997/10/24 15:51:37 momjian Exp $
 *
 *-------------------------------------------------------------------------
 */
/*
 *	 INTERFACE ROUTINES
 *		BeginCommand - prepare destination for tuples of the given type
 *		EndCommand - tell destination that no more tuples will arrive
 *		NullCommand - tell dest that the last of a query sequence was processed
 *
 *	 NOTES
 *		These routines do the appropriate work before and after
 *		tuples are returned by a query to keep the backend and the
 *		"destination" portals synchronized.
 *
 */
#include <stdio.h>				/* for sprintf() */
#include <string.h>

#include "postgres.h"

#include "access/htup.h"
#include "libpq/libpq-be.h"
#include "access/printtup.h"
#include "utils/portal.h"
#include "utils/palloc.h"

#include "executor/executor.h"

#include "tcop/dest.h"

#include "catalog/pg_type.h"
#include "utils/mcxt.h"

#include "commands/async.h"

static char CommandInfo[32] = {0};

/* ----------------
 *		output functions
 * ----------------
 */
static void
donothing(HeapTuple tuple, TupleDesc attrdesc)
{
}

extern void spi_printtup(HeapTuple tuple, TupleDesc tupdesc);

void		(*
			 DestToFunction(CommandDest dest)) (HeapTuple, TupleDesc)
{
	switch (dest)
	{
		case RemoteInternal:
			return printtup_internal;
			break;

		case Remote:
			return printtup;
			break;