tdsver in mem.c::tds_alloc_login

Lowden, James K LowdenJK at bernstein.com
Wed Jul 3 16:37:41 EDT 2002


Brian, 

Does this code work?  

I set my TDSVER to "4.2" or "7.0" (with decimal point), and it affects the
wire protocol.  I know it does, because the dump files change from Ascii to
UCS-2.  

But this function still expects the old-style 42/70 format.  It gets called,
according to gdb, but obviously my "export TDSVER=4.2" won't be seen.  

If I'm to change it, I'd also define defaultcaps as static const.  

Fragment attached.  

--jkl

TDSLOGIN *tds_alloc_login()
{
TDSLOGIN *tds_login;
unsigned char defaultcaps[] =
{0x01,0x07,0x03,109,127,0xFF,0xFF,0xFF,0xFE,0x02,0x07,0x00,0x00,0x0A,104,0x0
0,0x00,0x00};
char *tdsver;

	tds_login = (TDSLOGIN *) malloc(sizeof(TDSLOGIN));
	memset(tds_login, '\0', sizeof(TDSLOGIN));
	if ((tdsver=getenv("TDSVER"))) {
		if (!strcmp(tdsver,"42")) {
			tds_login->major_version=4;
			tds_login->minor_version=2;
		} else if (!strcmp(tdsver,"46")) {
			tds_login->major_version=4;
			tds_login->minor_version=6;
		} else if (!strcmp(tdsver,"50")) {
			tds_login->major_version=5;
			tds_login->minor_version=0;
		} else if (!strcmp(tdsver,"70")) {
			tds_login->major_version=7;
			tds_login->minor_version=0;
		} else if (!strcmp(tdsver,"80")) {
			tds_login->major_version=8;
			tds_login->minor_version=0;
		}
		/* else unrecognized...use compile time default above */




More information about the FreeTDS mailing list