Return-Path: postman 
Delivery-Date: Thu, 16 Sep 93 10:26:53 PDT
Return-Path: postman
Received: by postgres.Berkeley.EDU (5.61/1.29)
	id AA26250; Thu, 16 Sep 93 10:23:47 -0700
Resent-From: postman (POSTGRES mailing list)
Resent-Message-Id: <9309161723.AA26250@postgres.Berkeley.EDU>
Sender: owner-postman@postgres.Berkeley.EDU
X-Return-Path: aoki@postgres.Berkeley.EDU
Received: from faerie.CS.Berkeley.EDU by postgres.Berkeley.EDU (5.61/1.29)
	id AA26242; Thu, 16 Sep 93 10:23:41 -0700
Received: from localhost (localhost [127.0.0.1]) by faerie.CS.Berkeley.EDU (8.1C/8.1B) with SMTP id KAA08779; Thu, 16 Sep 1993 10:24:18 -0700
Message-Id: <199309161724.KAA08779@faerie.CS.Berkeley.EDU>
From: aoki@postgres.Berkeley.EDU (Paul M. Aoki)
To: SRIRAMK@charlie.usd.edu
Cc: postgres@postgres.Berkeley.EDU
Subject: Re: Updating tuple attributes with vars from C program 
In-Reply-To: Your message of Thu, 16 Sep 1993 0:50:43 -0500 (CDT) 
	     <930916005043.dc34@charlie.usd.edu> 
Date: Thu, 16 Sep 93 10:24:17 -0700
X-Sender: aoki@postgres.Berkeley.EDU
X-Mts: smtp
Resent-To: postgres-dist
Resent-Date: Thu, 16 Sep 93 10:23:45 PDT

SRIRAMK@charlie.usd.edu writes:
>   int x = 4;
>   int y = 6;
>   PQexec("copy testclass from stdin"); 
>   PQputline(x	y);

the input format for the copy command is documented under "copy".
copy normally wants a string containing tab-separated fields.  so
something like

	char buffer[100];

	sprintf(buffer, "%d\t%d\n", x, y);
	PQputline(buffer);

is what you need.

as documented under "libpq", you need to wrap up with PQendcopy.

src/bin/monitor/monitor.c contains a (cheesy) example of using
copy from an application.
--
  Paul M. Aoki  |  CS Div., Dept. of EECS, UCB  |  aoki@postgres.Berkeley.EDU
                |  Berkeley, CA 94720           |  ...!uunet!ucbvax!aoki
