PQconnectdbParams vs PQconninfoParse

Поиск
Список
Период
Сортировка
От Craig Ringer
Тема PQconnectdbParams vs PQconninfoParse
Дата
Msg-id CAMsr+YEhyDqtXcjkiAF9h-EAu4yjtVf5prBYtA8Sz-i7T5GXCw@mail.gmail.com
обсуждение исходный текст
Ответы Re: PQconnectdbParams vs PQconninfoParse  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi all

While writing some code that takes a connstring and adds some parameters, I noticed that PQconninfoParse doesn't play well with PQconnectdbParams.

PQconnectdbParams takes a pair of equal-length arrays, one for keys and one for values, each terminated by null elements.  But PQconninfoParse returns a an array of PQconninfoOption .

This means the client has to do a bunch of fiddling to turn a parsed conninfo into something that can be passed to PQconnectdbParams .  This seems bizarre. Am I missing something obvious?

libpq  internally uses connectOptions1 which calls parse_connection_string, the same function used by PQconninfoParse. But there's no connect variant exposed to users to use it.

Anyone object to adding one? Like:

    PQconnectStartInfo(PQconninfoOption options)
    PQconnectdbInfo(PQconninfoOption options)

?

PQconnectStartParams(...) and PQconnectdbParams(...) would become thin wrappers around it.

It's a pity that the name PQconnectdbParams is already taken, really.


--
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

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

Предыдущее
От: amul sul
Дата:
Сообщение: Re: Bug in to_timestamp().
Следующее
От: Terje Elde
Дата:
Сообщение: Feature suggestions: "dead letter"-savepoint.