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

Reply via email to