Re: libpq custom row processing
От | Federico Di Gregorio |
---|---|
Тема | Re: libpq custom row processing |
Дата | |
Msg-id | 5020F8BF.9030208@dndg.it обсуждение исходный текст |
Ответ на | Re: libpq custom row processing (Marko Kreen <markokr@gmail.com>) |
Ответы |
Re: libpq custom row processing
|
Список | psycopg |
On 07/08/12 12:51, Marko Kreen wrote: > The callback API has been rolled back and final 9.2 will have > single-row-mode instead: > > http://www.postgresql.org/docs/devel/static/libpq-single-row-mode.html > > Callback API was hard to use and did not support iterative > result processing. This API should fix both problems. Interesting, but this is quite intimidating: While processing a query, the server may return some rows and then encounter an error, causing the query to be aborted. Ordinarily, libpq discards any such rows and reports only the error. But in single-row mode, those rows will have already been returned to the application. Hence, the application will see some PGRES_SINGLE_TUPLE PGresult objects followed by a PGRES_FATAL_ERROR object. For proper transactional behavior, the application must be designed to discard or undo whatever has been done with the previously-processed rows, if the query ultimately fails. Making sure old code continues to work and doesn't process the initial tuples before an exception is throw will be challenging. federico -- Federico Di Gregorio federico.digregorio@dndg.it Studio Associato Di Nunzio e Di Gregorio http://dndg.it Everything will be OK at the end. If it's not OK, it's not the end. -- Unknown
В списке psycopg по дате отправления: