]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Replace libpq's "row processor" API with a "single row" mode.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Aug 2012 17:10:36 +0000 (13:10 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 2 Aug 2012 17:10:36 +0000 (13:10 -0400)
commitea56ed9a1e2b5164b02f4a030fb327346612b2d9
tree23c56df2643cec6efd72184b5fb17db3d4870b26
parentf6fb9f103ff534193f4132e0c6a47bf441cfad42
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
contrib/dblink/dblink.c
doc/src/sgml/libpq.sgml
src/interfaces/libpq/exports.txt
src/interfaces/libpq/fe-connect.c
src/interfaces/libpq/fe-exec.c
src/interfaces/libpq/fe-lobj.c
src/interfaces/libpq/fe-protocol2.c
src/interfaces/libpq/fe-protocol3.c
src/interfaces/libpq/libpq-fe.h
src/interfaces/libpq/libpq-int.h