asynchronous api questions

Поиск
Список
Период
Сортировка
От Nulik Nol
Тема asynchronous api questions
Дата
Msg-id CAHO6xe_HoJVOv6kQ13ja4Xej1JYP2kwiK3K9NPkAzN1+L+P3HA@mail.gmail.com
обсуждение исходный текст
Ответы Re: asynchronous api questions  ("Albe Laurenz" <laurenz.albe@wien.gv.at>)
Список pgsql-general
Hi,

I have 2 questions regarding the asynchronous C api (I am using vers. 8.4):

1) To make a connection in non-blocking manner the api provides PGconn
*PQconnectStart(const char *conninfo) function. The parameters are
passed in 'conninfo' variable which is a string so I have to use
sprintf() to put the parameters into this string. Is there another
function to connect asynchronously that would be similar to
PQsetdbLogin so it would accept the host/port/user/password parameters
directly as argument to the function? I want to avoid to use sprintf()

2) Will this code produce a valid non-blocking connection ?

    db_globals=PQsetdbLogin(DT_DBHOST,DT_DBPORT,NULL,NULL,"global",DT_DBUSER,DT_DBPASS);
    if (PQstatus(db_globals) != CONNECTION_OK) {
                fprintf(stderr, "Connection to database failed: %s",
                        PQerrorMessage(db_globals));
                PQfinish(db_globals);
                exit(1);
    }
    if (PQsetnonblocking(db_globals, int arg)!=1) {
        printf("can't set global connection to non blocking mode\n");
        exit(1);
    }

Will appreciate any help

Nulik

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

Предыдущее
От: "Simon Windsor"
Дата:
Сообщение: Re: Large Objects and and Vacuum
Следующее
От: Jay Levitt
Дата:
Сообщение: Re: 9.1.2: Preventing connections / syncing a database