diff --git a/doc/src/sgml/libpq.sgml b/doc/src/sgml/libpq.sgml
index 72c9384..e9233bd 100644
--- a/doc/src/sgml/libpq.sgml
+++ b/doc/src/sgml/libpq.sgml
@@ -7233,6 +7233,281 @@ int PQisthreadsafe();
+
+ Alternative row processor
+
+
+ PGresult
+ PGconn
+
+
+
+ As the standard usage, rows are stored into PGresult
+ until full resultset is received. Then such completely-filled
+ PGresult is passed to user. This behavior can be
+ changed by registering alternative row processor function,
+ that will see each row data as soon as it is received
+ from network. It has the option of processing the data
+ immediately, or storing it into custom container.
+
+
+
+ Note - as row processor sees rows as they arrive, it cannot know
+ whether the SQL statement actually finishes successfully on server
+ or not. So some care must be taken to get proper
+ transactionality.
+
+
+
+
+
+ PQsetRowProcessor
+
+ PQsetRowProcessor
+
+
+
+
+
+ Sets a callback function to process each row.
+
+void PQsetRowProcessor(PGconn *conn, PQrowProcessor func, void *param);
+
+
+
+
+
+
+ conn
+
+
+ The connection object to set the row processor function.
+
+
+
+
+ func
+
+
+ Storage handler function to set. NULL means to use the
+ default processor.
+
+
+
+
+ param
+
+
+ A pointer to contextual parameter passed
+ to func.
+
+
+
+
+
+
+
+
+
+
+
+
+ PQrowProcessor
+
+ PQrowProcessor
+
+
+
+
+
+ The type for the row processor callback function.
+
+int (*PQrowProcessor)(PGresult *res, PGrowValue *columns, void *param);
+
+typedef struct
+{
+ int len; /* length in bytes of the value, -1 if NULL */
+ char *value; /* actual value, without null termination */
+} PGrowValue;
+
+
+
+
+ The columns array will have PQnfields()
+ elements, each one pointing to column value in network buffer.
+ The len field will contain number of
+ bytes in value. If the field value is NULL then
+ len will be -1 and value will point
+ to position where the value would have been in buffer.
+ This allows estimating row size by pointer arithmetic.
+
+
+
+ This function must process or copy row values away from network
+ buffer before it returns, as next row might overwrite them.
+
+
+
+ This function must return 1 for success, and -1 for failure and
+ the caller releases the PGresult under work for the
+ case. It can also return 0 for early exit
+ from PQisBusy function. The
+ supplied res
+ and columns values will stay valid so
+ row can be processed outside of callback. Caller is
+ responsible for tracking whether
+ the PQisBusy returned early from
+ callback or for other reasons. Usually this should happen via
+ setting cached values to NULL before
+ calling PQisBusy.
+
+
+
+ The function is allowed to exit via exception (setjmp/longjmp).
+ The connection and row are guaranteed to be in valid state.
+ The connection can later be closed
+ via PQfinish. Processing can also be
+ continued without closing the connection,
+ call getResult on synchronous mode,
+ PQisBusy on asynchronous connection. Then
+ processing will continue with new row, previous row that got
+ exception will be skipped. Or you can discard all remaining
+ rows by calling PQskipResult without
+ closing connection.
+
+
+
+
+
+ res
+
+
+ A pointer to the PGresult object.
+
+
+
+
+
+ columns
+
+
+ Column values of the row to process. Column values
+ are located in network buffer, the processor must
+ copy them out from there.
+
+
+ Column values are not null-terminated, so processor cannot
+ use C string functions on them directly.
+
+
+
+
+
+ param
+
+
+ Extra parameter that was given to PQsetRowProcessor.
+
+
+
+
+
+
+
+
+
+
+
+ PQskipResult
+
+ PQskipResult
+
+
+
+
+ Discard all the remaining row data
+ after PQexec
+ or PQgetResult exits by the exception raised
+ in RowProcessor without closing connection.
+
+void PQskipResult(PGconn *conn, int skipAll)
+
+
+
+
+
+ conn
+
+
+ The connection object.
+
+
+
+
+
+ skipAll
+
+
+ Skip remaining rows in current result
+ if skipAll is false(0). Skip
+ remaining rows in current result and all rows in
+ succeeding results if true(non-zero).
+
+
+
+
+
+
+
+
+
+
+
+
+
+ PQgetRowProcessor
+
+ PQgetRowProcessor
+
+
+
+
+ Get row processor and its context parameter currently set to
+ the connection.
+
+PQrowProcessor PQgetRowProcessor(PGconn *conn, void **param)
+
+
+
+
+
+ conn
+
+
+ The connection object.
+
+
+
+
+
+ param
+
+
+ Set the current row processor parameter of the
+ connection here if not NULL.
+
+
+
+
+
+
+
+
+
+
+
+
+
Building libpq Programs