Re: specifying multiple result format codes with libpq - Mailing list pgsql-hackers

From Abhijit Menon-Sen
Subject Re: specifying multiple result format codes with libpq
Date
Msg-id 20040619034323.B14517@lustre.dyn.wiw.org
Whole thread Raw
In response to Re: specifying multiple result format codes with libpq  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
At 2004-06-18 13:11:19 -0400, tgl@sss.pgh.pa.us wrote:
>
> > Would anyone be interested in a patch to allow this?
> 
> Yes, but not the way you suggest.  The ... approach forces calling
> code to know *when it is written* how many result columns there will
> be, because you'd have to actually write that number of parameters in
> the call.

I suspect I didn't explain my proposal sufficiently well.

The signature of, say, PQexecParams does get ... added on to it, but new
callers pass in only a count and an array, not one argument per expected
result. That way, existing callers would continue to compile without any
changes, and new code tells the function to look for the extra arguments
by specifying a currently-invalid value for the resultFormat parameter.

That said, however:

> No one's gotten around to thinking about a more general redesign of
> libpq's query API yet, but I'd rather see us do that than put more
> warts on the functions we have ...

I am in complete agreement with that sentiment.

-- ams


pgsql-hackers by date:

Previous
From: Carlos Guzmán Álvarez
Date:
Subject: Re: Timestamp format question
Next
From: "Dave Page"
Date:
Subject: Cannot initdb in cvs tip