Re: Client query hangs when network connection is lost to the server.

Поиск
Список
Период
Сортировка
От Steve Rosenberry
Тема Re: Client query hangs when network connection is lost to the server.
Дата
Msg-id CA+g9Fpw_GEoZ+P+JvsCqUj29A9Ob0i_R7J-Ms8bR=NnCLHW4SQ@mail.gmail.com
обсуждение исходный текст
Ответ на Client query hangs when network connection is lost to the server.  (Steve Rosenberry <smrosenberry@ElectronicSolutionsCo.com>)
Список pgsql-novice
For others who may stumble upon this looking for an answer.  This seems to be working as expected.

Another person at work found sample code showing how to mimic the PQexec() functionality such that one has a chance to break out of waiting for the server response.  The new code uses the PQsendQuery(), PQisBusy(), PQconsumeInput(), and PQgetResult() functions and is based upon example code from page 342 of "PostgreSQL: A Comprehensive Guide to Building, Programming, and Administering PostgreSQL Databases" by Korry Douglas and Susan P. Douglas, 1st Edition, February 2003.

Basically I added a flag to the wait loop that indicates the query should be cancelled, breaks the loop, and returns a NULL PGresult*.  The flag is set by an independent mechanism
(in our simplistic case, a simple system ping) that determines the PostgreSQL server is no longer available through the network.

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

Предыдущее
От: kobolds
Дата:
Сообщение: about view privileges
Следующее
От: Kevin Grittner
Дата:
Сообщение: Re: about view privileges