Re: Ms sql backslash in named instance 2005
Frediano Ziglio <[email protected]>
| Newsgroups | gmane.comp.db.tds.freetds |
|---|---|
| Message-ID | <[email protected]> |
2009/10/30 Frediano Ziglio <[email protected]>: > 2009/10/30 James K. Lowden <[email protected]>: >> Frediano Ziglio wrote: >>> 0.62 understand only "server:port" syntax so >>> it finds "myserver\one" correctly. 0.82 change "myserver\one" to >>> "myserver" with instance "one" so it doesn't find "myserver" section >>> in file. The solution would be to search for server before parsing for >>> instance. This way does not break compatibility. >> >> Good idea! >> > > Yes, but I don't like that much my patch... I think that > server\instance and server:port should be symmetric... > > 0.62 > > "server\instance" -> look for section "server\instance" > "server:port" -> look for section server with port set to "port" > > 0.82 > > "server\instance" -> look for section "server" with instance set to "instance" > "server:port" -> look for section "server" with port set to "port" > > my proposed patch > > "server\instance" -> look for section "server\instance", if not found > look for section "server" with instance set to "instance" > "server:port" -> look for section "server" with port set to "port" > > as you can note is not symmetric... I proposed this way > > "server\instance" -> look for section "server\instance", if not found > look for section "server" with instance set to "instance" > "server:port" -> look for section "server:port", if not found look for > section "server" with port set to "port" > This patch should work (and is smaller too!) freddy77 _______________________________________________ FreeTDS mailing list [email protected] http://lists.ibiblio.org/mailman/listinfo/freetds
instance_fix.diff
(application/octet-stream, 2.1 KB)
Fix compatibility problem with "server:port" syntax
Index: freetds83/src/tds/config.c
===================================================================
--- freetds83.orig/src/tds/config.c 2009-10-30 14:19:33.572505850 +0100
+++ freetds83/src/tds/config.c 2009-10-30 14:29:13.593005069 +0100
@@ -86,9 +86,7 @@
static int tds_read_conf_sections(FILE * in, const char *server, TDSCONNECTION * connection);
static int tds_read_interfaces(const char *server, TDSCONNECTION * connection);
static int tds_config_boolean(const char *value);
-#if PARSE_SERVER_NAME_FOR_PORT
static int parse_server_name_for_port(TDSCONNECTION * connection, TDSLOGIN * login);
-#endif
static int tds_lookup_port(const char *portname);
static void tds_config_encryption(const char * value, TDSCONNECTION * connection);
@@ -184,16 +182,11 @@
tdsdump_log(TDS_DBG_INFO1, "Getting connection information for [%s].\n",
tds_dstr_cstr(&login->server_name)); /* (The server name is set in login.c.) */
-#if PARSE_SERVER_NAME_FOR_PORT
- /* Don't parse the [servername] key to a freetds.conf section. */
- if (parse_server_name_for_port(connection, login)) {
- tdsdump_log(TDS_DBG_INFO1, "Parsed servername, now %s on %d.\n",
- tds_dstr_cstr(&connection->server_name), login->port);
- }
-#endif
/* Read the config files. */
tdsdump_log(TDS_DBG_INFO1, "Attempting to read conf files.\n");
- if (!tds_read_conf_file(connection, tds_dstr_cstr(&login->server_name))) {
+ if (!tds_read_conf_file(connection, tds_dstr_cstr(&login->server_name)) &&
+ (!parse_server_name_for_port(connection, login) ||
+ !tds_read_conf_file(connection, tds_dstr_cstr(&login->server_name)))) {
/* fallback to interfaces file */
tdsdump_log(TDS_DBG_INFO1, "Failed in reading conf file. Trying interface files.\n");
if (!tds_read_interfaces(tds_dstr_cstr(&login->server_name), connection)) {
@@ -1072,7 +1065,6 @@
return found;
}
-#if PARSE_SERVER_NAME_FOR_PORT
/**
* Check the server name to find port info first
* Warning: connection-> & login-> are all modified when needed
@@ -1108,7 +1100,6 @@
return 1;
}
-#endif
/**
* Return a structure capturing the compile-time settings provided to the