Re: PQhost() Returns NULL on Connection
on 4/26/06 5:59 PM, tgl(at)sss(dot)pgh(dot)pa(dot)us purportedly said:
>> Why would PQhost() return NULL on a valid connection?
>
> One reason why would be if you'd selected the server by hostaddr rather
> than host. Returning a host name in this case would require a DNS
> lookup, and since the entire point of the hostaddr feature is to avoid
> DNS lookups, I don't think that's a particularly great idea.
>
> These functions are really defined as "give me back the connection
> options that were specified", anyway, not "peek inside to see what
> values are actually in use". So a NULL for an unspecified option
> seems reasonable to me.
I wasn't sure, because the behavior is not consistent. For instance,
PQport() will return a value regardless of the connection type and
parameters passed to connect.
Also, there doesn't appear to be a way to retrieve hostaddr even if
specified, so I thought maybe the PQhost() was more generic. E.g. the lib
could return an address if specified and not have to do a wasteful DNS
lookup.
Considering that the connection status functions exist to retrieve parameter
values, it would at least be good to have access to all of them, and not
just a selection of them.
Best,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
Home |
Main Index |
Thread Index