[freetds] status and stability

Lowden, James K LowdenJK at bernstein.com
Wed May 14 17:32:05 EDT 2003


> From: Frediano Ziglio [mailto:freddyz77 at tin.it]
> Sent: May 14, 2003 3:09 PM
>
> Someone accept iso8859_1 but not ISO8859_1...

Understood. 

> I agree to remove perl code

OK. 

>> One question, though, because you seem to have an idea different from
mine.
>> When Sybase sends you its charset name "iso88597", and you're using HP
>> iconv, how are you going to locate the iconv name that HP uses?  

> I use a cache. From iconv.c:
> 
> static const char *iconv_names[sizeof(canonic_charsets) /
> sizeof(canonic_charsets[0])];
...
> Here I store iconv names relative to canonic names (same index, TODO:
> use index for canonic instead of names??).
[clear explanation]

You only write to the first four entries.  

$ grep iconv_names src/tds/iconv.c \
	|sed 's/^.*\(iconv_names\[.\]\).*/\1/g' \
	|sort |uniq
iconv_names[0]
iconv_names[1]
iconv_names[2]
iconv_names[3]

Are you going to look up the canonical name and try each alternative until
iconv_open returns a valid descriptor?  

I chose iso88597 intentionally: it's not among the first four.  Sybase uses
"iso88597" for Greek; our canonical name is "ISO-8859-7".  I bet HP uses
"iso88597".  

1.  Sybase sends its name, "iso88597".
2.  tds_canonical_charset_name returns "ISO-8859-7".
3.  bytes_per_char sets the character width to 1.
4.  HP iconv_open(3) rejects "ISO-8859-7".  Bzzt.  
/* new code needed for #5. */
5.  Iterate over alternatives, caching the 
    first one that iconv_open() accepts.  
    If none are OK, put -1 in the cache, to avoid
    repeated failed lookups.  

Is that your idea?  OK by me.  

FWIW, I think a name cache is easier to understand than an index cache.  I'm
glad you chose char* and not int, IOW.  

--jkl
-----------------------------------------
The information contained in this transmission may contain privileged and confidential information and is intended only for the use of the person(s) named above. If you are not the intended recipient, or an employee or agent responsible for delivering this message to the intended recipient, any review, dissemination, distribution or duplication of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender immediately by reply e-mail and destroy all copies of the original message. Please note that we do not accept account orders and/or instructions by e-mail, and therefore will not be responsible for carrying out such orders and/or instructions.





More information about the FreeTDS mailing list