@ -9,7 +9,7 @@
* Portions Copyright ( c ) 1994 , Regents of the University of California
*
* IDENTIFICATION
* $ PostgreSQL : pgsql / src / backend / access / common / printtup . c , v 1.102 2008 / 04 / 17 21 : 37 : 28 alvherre Exp $
* $ PostgreSQL : pgsql / src / backend / access / common / printtup . c , v 1.103 2008 / 11 / 30 20 : 51 : 24 tgl Exp $
*
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
@ -67,31 +67,16 @@ typedef struct
* - - - - - - - - - - - - - - - -
*/
DestReceiver *
printtup_create_DR ( CommandDest dest , Portal portal )
printtup_create_DR ( CommandDest dest )
{
DR_printtup * self = ( DR_printtup * ) palloc ( sizeof ( DR_printtup ) ) ;
DR_printtup * self = ( DR_printtup * ) palloc0 ( sizeof ( DR_printtup ) ) ;
if ( PG_PROTOCOL_MAJOR ( FrontendProtocol ) > = 3 )
self - > pub . receiveSlot = printtup ;
else
{
/*
* In protocol 2.0 the Bind message does not exist , so there is no way
* for the columns to have different print formats ; it ' s sufficient to
* look at the first one .
*/
if ( portal - > formats & & portal - > formats [ 0 ] ! = 0 )
self - > pub . receiveSlot = printtup_internal_20 ;
else
self - > pub . receiveSlot = printtup_20 ;
}
self - > pub . receiveSlot = printtup ; /* might get changed later */
self - > pub . rStartup = printtup_startup ;
self - > pub . rShutdown = printtup_shutdown ;
self - > pub . rDestroy = printtup_destroy ;
self - > pub . mydest = dest ;
self - > portal = portal ;
/*
* Send T message automatically if DestRemote , but not if
* DestRemoteExecute
@ -105,6 +90,33 @@ printtup_create_DR(CommandDest dest, Portal portal)
return ( DestReceiver * ) self ;
}
/*
* Set parameters for a DestRemote ( or DestRemoteExecute ) receiver
*/
void
SetRemoteDestReceiverParams ( DestReceiver * self , Portal portal )
{
DR_printtup * myState = ( DR_printtup * ) self ;
Assert ( myState - > pub . mydest = = DestRemote | |
myState - > pub . mydest = = DestRemoteExecute ) ;
myState - > portal = portal ;
if ( PG_PROTOCOL_MAJOR ( FrontendProtocol ) < 3 )
{
/*
* In protocol 2.0 the Bind message does not exist , so there is no way
* for the columns to have different print formats ; it ' s sufficient to
* look at the first one .
*/
if ( portal - > formats & & portal - > formats [ 0 ] ! = 0 )
myState - > pub . receiveSlot = printtup_internal_20 ;
else
myState - > pub . receiveSlot = printtup_20 ;
}
}
static void
printtup_startup ( DestReceiver * self , int operation , TupleDesc typeinfo )
{