From: | Leon Smith <leon(dot)p(dot)smith(at)gmail(dot)com> |
---|---|
To: | Merlin Moncure <mmoncure(at)gmail(dot)com> |
Cc: | Marko Kreen <markokr(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Postgres Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: [patch] libpq one-row-at-a-time API |
Date: | 2012-07-31 00:11:26 |
Message-ID: | CAPwAf1nfCftYfU+6c=mgmMF-uxCPguw-thuV4DaxH=+cqKOPgA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hey, this thread was pointed out to me just a few days ago, but I'll start
by saying that I think this thread is on exactly the right track. I don't
like the callback API, and think that PQsetSingleRowMode should be offered
in place of it. But I do have one
On Sat, Jun 16, 2012 at 10:22 AM, Marko Kreen <markokr(at)gmail(dot)com> wrote:
>
> The function can be called only after PQsend* and before any
> rows have arrived. This guarantees there will be no surprises
> to PQexec* users who expect full resultset at once.
Ok, I'm guessing you mean that "before you call PQgetResult or
PQgetRowData", or maybe "before you call PQgetResult or PQgetRowData and
it returns a result or partial result." Because it would be a race
condition if you meant exactly what you said. (Though I don't understand
how this could possibly be implemented without some source of concurrency,
which libpq doesn't do.) Maybe this is a little overly pendantic, but I
do want to confirm the intention here.
One other possibility, Tom Lane fretted ever so slightly about the use of
malloc/free per row... what about instead of PQsetSingleRowMode, you have
PQsetChunkedRowMode that takes a chunkSize parameter. A chunkSize <= 0
would be equivalent to what we have today, a chunkSize of 1 means you get
what you have from PQsetSingleRowMode, and larger chunkSizes would wait
until n rows have been received before returning them all in a single
result. I don't know that this suggestion is all that important, but
it seems like an obvious generalization that might possibly be useful.
Best,
Leon
From | Date | Subject | |
---|---|---|---|
Next Message | Jan Wieck | 2012-07-31 01:59:19 | Re: [patch] libpq one-row-at-a-time API |
Previous Message | Tom Lane | 2012-07-30 23:09:10 | Re: tzdata2012d |