Re: idea: eliminate port/instance
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
2009/4/7 James K. Lowden <[email protected]>: > Frediano Ziglio wrote: >> 2009/4/4 James K. Lowden <[email protected]>: >> > 1. If port is numeric, it's a port. >> > 2. If port is non-numeric, try looking up the port with >> > getservbyname(3). >> > >> > 3. If getservbyname(3) fails, look up the port using the UDP instance >> > protocol. >> >> I personally don't like this way cause you can't specify a named >> instance if this instance correspond to a service entry. > > Well, I doubt that's a very likely conflict. But I guess you're right. > We'll continue to ignore /etc/services. > >> Perhaps it would be useful to always return error if port and instance >> are both specified. > > Yeah, but how? tds_read_config_info() returns TDSCONNECTION*. We'd have > to stuff an error code in the structure. > I think is sufficient to test if port and instance_name is set in login.c, just before following lines: if (!IS_TDS50(tds) && !tds_dstr_isempty(&connection->instance_name)) connection->port = tds7_get_instance_port(tds_dstr_cstr(&connection->ip_addr), tds_dstr_cstr(&connection->instance_name)); > OK, maybe not fprintf(stderr...). Maybe tdserror() instead. At least > tsql would print the message, as would any other properly written > application. We'll have to invent a few new error codes, though. > Mmm... I personally though of removing TDS_FAIL and replace with errrors. I like linux kernel way where: - >0 means success and result - 0 means no error - <0 means error (something like tds_convert) freddy77 _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds