pgsql: Replace libpq's "row processor" API with a "single row" mode.

Поиск
Список
Период
Сортировка
От Tom Lane
Тема pgsql: Replace libpq's "row processor" API with a "single row" mode.
Дата
Msg-id E1SwyvB-0006QD-Qu@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
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
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/41b9c8452b9df3a431dffc346890f926d17d47ad

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(-)


В списке pgsql-committers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: pgsql: Add documentation cross-reference for JSON functions.
Следующее
От: Tom Lane
Дата:
Сообщение: pgsql: Replace libpq's "row processor" API with a "single row" mode.