Replace libpq's "row processor" API with a "single row" mode.
After taking awhile to digest the row-processor feature that was added to
libpq in commit 92785dac2ee7026948962cd61c4cd84a2d052772, we've concluded
it is over-complicated and too hard to use. Leave the core infrastructure
changes in place (that is, there's still a row processor function inside
libpq), but remove the exposed API pieces, and instead provide a "single
row" mode switch that causes PQgetResult to return one row at a time in
separate PGresult objects.
This approach incurs more overhead than proper use of a row processor
callback would, since construction of a PGresult per row adds extra cycles.
However, it is far easier to use and harder to break. The single-row mode
still affords applications the primary benefit that the row processor API
was meant to provide, namely not having to accumulate large result sets in
memory before processing them. Preliminary testing suggests that we can
probably buy back most of the extra cycles by micro-optimizing construction
of the extra results, but that task will be left for another day.
Marko Kreen
Branch
------
REL9_2_STABLE
Details
-------
http://git.postgresql.org/pg/commitdiff/ea56ed9a1e2b5164b02f4a030fb327346612b2d9
Modified Files
--------------
contrib/dblink/dblink.c | 164 +++++++++------
doc/src/sgml/libpq.sgml | 416 ++++++++++++-----------------------
src/interfaces/libpq/exports.txt | 4 +-
src/interfaces/libpq/fe-connect.c | 11 +-
src/interfaces/libpq/fe-exec.c | 219 +++++++++----------
src/interfaces/libpq/fe-lobj.c | 11 -
src/interfaces/libpq/fe-protocol2.c | 116 ++--------
src/interfaces/libpq/fe-protocol3.c | 80 ++-----
src/interfaces/libpq/libpq-fe.h | 24 +--
src/interfaces/libpq/libpq-int.h | 18 ++-
10 files changed, 406 insertions(+), 657 deletions(-)