| От | Alex Sandini |
|---|---|
| Тема | use of PQconnectdb and PQfinish in a shared library |
| Дата | |
| Msg-id | 3DBD3BF9.70607@keyware.com обсуждение исходный текст |
| Список | pgsql-general |
Sorry if this message appears twice, i'have just suscribed
Hi all,
Using PQconnectdb and PQfinish each time a function is called from a
client, the function run well the first time is invoqued, but fails on
any subsequent call, at the first PQexec call, with respective kill -9
of the child process on the server.
The database opened within the functions is the same from where the
function is called, i.e., select any_function('kk;, 2);
To get it working, i've done something like:
static bool bfirsttime = false;
int4 any_function (text buf, int4 num )
{
if( !bfirsttime ) {
dbconn = PQconnectdb( conninfo );
bfirsttime = true;
}
/* code... */
/* dont close db in library */
/* PQfinish( dbconn ); */
return( 0 );
}
Hum, the connection is never closed, it should be possible to do it in a
cleaner way...
Does something like:
memcpy( dbconn, CURRENT_DATABASE, sizeof( dbconn ) ); exists?
Any hint?
Thx,
Alex
В списке pgsql-general по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера