• Tom Lane's avatar
    Replace libpq's "row processor" API with a "single row" mode. · 41b9c845
    Tom Lane authored
    After taking awhile to digest the row-processor feature that was added to
    libpq in commit 92785dac, 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
    41b9c845
fe-lobj.c 16.8 KB