Re: new version of PQconnectdb was:(Re: [HACKERS] Determining client_encoding from client locale)

From: Andrew Chernow <ac(at)esilo(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>, pgsql-hackers(at)postgresql(dot)org, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Bruce Momjian <bruce(at)momjian(dot)us>, Itagaki Takahiro <itagaki(dot)takahiro(at)oss(dot)ntt(dot)co(dot)jp>, Peter Eisentraut <peter_e(at)gmx(dot)net>
Subject: Re: new version of PQconnectdb was:(Re: [HACKERS] Determining client_encoding from client locale)
Date: 2009-09-10 05:46:01
Message-ID: 4AA89299.7050401@esilo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


>> PGconn *PQconnectParams(const char **params)
>>
>> Where "params" is an array with an even number of parameters, forming
>> key/value pairs. Usage example:
>>

Maybe use the term properties (props for short) or options instead of params?
Params is already in heavy use. How about PQconnectProps(...) or
PQconnectOptions(...)?

>> Another idea is to use an array of PQconninfoOption structs:
>>
>> PQconn *PQconnectParams(PQconninfoOption *params);
>>
>
> this sounds like a good idea, specially if we add new parameters to

Here's another idea, parallel arrays:

PGconn *PQconnectProps(const char **names, const char **values);
PGconn *PQconnectOptions(const char **names, const char **values);

To build on the struct idea, maybe PGprop or PGoption instead of
PQconninfoOption. Also, add an argument specifying the number of props/options.

PGconn *PQconnectProps(const PGprop *props, int nProps);
PGconn *PQconnectOptions(const PGoption *options, int nOptions);

> any one have a preference here?
>

I like the struct approach. I personally prefer specifying the element count of
an array, rather than using a NULL terminating element.

--
Andrew Chernow
eSilo, LLC
every bit counts
http://www.esilo.com/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2009-09-10 07:08:37 Re: RfD: more powerful "any" types
Previous Message Hannu Krosing 2009-09-10 05:44:22 Re: RfD: more powerful "any" types