ports/107874: port databases/freetds: fix for MSSQL 7

Lapo Luchini lapo at lapo.it
Sat Jan 13 16:20:12 UTC 2007


>Number:         107874
>Category:       ports
>Synopsis:       port databases/freetds: fix for MSSQL 7
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Jan 13 16:20:11 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Lapo Luchini
>Release:        FreeBSD 6.2-PRERELEASE amd64
>Organization:
>Environment:
System: FreeBSD motoko.lapo.it 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #5: Wed Nov 22 20:09:06 CET 2006 root at motoko.lapo.it:/usr/obj/usr/src/sys/MOTOKO amd64

A recent fix (backported from 0.64 to 0.63) to correctly support MSSQL 7, that
uses CP1252 even though it states to use ISO-8859-1.
(the difference is slight but present: e.g. the special quotes)

>Description:
>How-To-Repeat:
>Fix:

--- patch-src_tds_iconv.c begins here ---
--- src/tds/iconv.c.orig	Sat Jan 13 16:27:13 2007
+++ src/tds/iconv.c	Sat Jan 13 16:29:24 2007
@@ -973,13 +973,18 @@ tds_srv_charset_changed(TDSSOCKET * tds,
 #if HAVE_ICONV_ALWAYS
 	TDSICONV *char_conv = tds->char_convs[client2server_chardata];
 
-	const char *canonic_charset = tds_canonical_charset_name(charset);
+	int canonic_charset_num = tds_canonical_charset(charset);
+	const char *canonic_charset;
+
+	if (tds->major_version >= 7 && canonic_charset_num == TDS_CHARSET_ISO_8859_1)
+		canonic_charset_num = TDS_CHARSET_CP1252;
 
 	/* ignore request to change to unknown charset */
-	if (!canonic_charset) {
+	if (canonic_charset_num < 0) {
 		tdsdump_log(TDS_DBG_FUNC, "tds_srv_charset_changed: what is charset \"%s\"?\n", charset);
 		return;
 	}
+	canonic_charset = canonic_charsets[canonic_charset_num].name;
 
 	if (strcmp(canonic_charset, char_conv->server_charset.name) == 0)
 		return;
--- patch-src_tds_iconv.c ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list