Subject: clarification on PQgetvalue()

From: [email-masked] (Jeff Meredith)
Date: Fri, 10 Jan 92 16:21:55 PST

In response to a question about PQexec and PQparray i said the following:

> Second, because the tuple groups and tuples are indexed starting from 0 not 1,
> PQgetvalue() will return NULL and you will die in atoi().
>
> 	*uid = atoi(PQgetvalue(portalbuff,1,1));

However, the last two arguments to PQgetvalue() determine the tuple, and
the attribute.  For example:
	
	pname++ = PQexec("retrieve (foo.oid, foo.a, foo.b)");
	pbuf = PQparray(pname);
	value = PQgetvalue(pbuf, 2, 1);
	
gets attribute b of the third returned tuple.

Sorry for any confusion.

Jeff Meredith
[email-masked]

---

From: [email-masked] (Mike Olson)
Date: Fri, 10 Jan 92 16:47:53 PST

for the record, the program pgstats.c in the sample/ directory includes
code that manages portal buffers, tuples, and attributes.  this program
was written so that folks could use it as a template.

					mike olson
					[email-masked]