freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Chris Eleveld <ihermit2 AT yahoo.com>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: endian patch and Re: Strange server
- Date: Wed, 23 Jan 2002 06:02:58 -0800 (PST)
I am using a stock Sybase interfaces file as
opposed to a freetds.conf mostly out of laziness.
I'm assuming there are no PowerPC NT users left out
there so we may need to determine a way to separate a
big endian client talking to a little endian server
and big endian client talking to a little endian
client. Maybe there is something in the magic bytes
left in the TDS protocol specification.
--- Michael Horowitz
<michael.horowitz AT storagenetworks.com> wrote:
> I was using TDS version 4.2 in my tests.
>
> --Mike
>
> > I just ran a test. Maybe we need a check against
> the
> > protocol level. I'm using TDS version 4.6
> protocol
> > from AIX with FreeTDS to Solaris with Sybase.
> >
> > Does anyone have an eclectic set of servers and a
> big
> > endian client?
> >
> > Maybe we need the change to depend on wether you
> > enable the mssql stuff or another config flag?
> for
> > TDSVER set to 4.2, 4.6, and 5.0 however with the
> > servers I have to chat to I don't get any messages
> > unless I use the if I have. But, both machines in
> any
> > of my configurations are big endian.
> >
> > --- Michael Horowitz
> > <michael.horowitz AT storagenetworks.com> wrote:
> > > Hey Chris,
> > >
> > > There was a thread about the big endian issue
> 2-3
> > > weeks ago(I am
> > > connecting from a Solaris box). I came across
> the
> > > same problem. I
> > > initially just erased the second swap, but I was
> > > informed that would cause
> > > problems when "emulate little endian" wasn't on.
>
> > > So, I conditioned the
> > > second swap on "if (!tds->emul_little_endian)".
> I
> > > noticed you did "if
> > > (tds->emul_little_endian)" in your patch, are
> you
> > > sure you didn't mean the
> > > other way? tds_get_int does the swap if
> > > emul_little_endian is true, so
> > > you only want to swap it if tds_get_int didn't
> swap
> > > it already, which is
> > > if emul_little_endian is false.
> > >
> > > In my experience with MS SQL Server 7.0, I MUST
> use
> > > emul_little_endian,
> > > otherwise the datetime fields have their bytes
> > > backwards and the "swap
> > > broken dates" seems to do nothing for me.
> > >
> > > I tested this fix on MS SQL Server 7.0 and 2000
> with
> > > mixed results.
> > > This is what I wrote in a previous email about
> it:
> > > "Actually, I tried SQL Server 2000 without
> > > "emulate-little-endian" and
> > > with
> > > that swap removed and the datetime fields are
> fine
> > > and so are the error
> > > messages.
> > > With SQL Server 7.0 with the same setup, the
> > > datetime fields are wrong,
> > > and the error messages are messed up.
> > >
> > > I tried using the following instead of
> completely
> > > removing the swap:
> > > if (!tds->emul_little_endian) {
> > > tds_swap_bytes(&rc, 4);
> > > }
> > > That fixed the error messages on SQL Server 7.0,
> but
> > > then they were
> > > screwed up on SQL Server 2000."
> > >
> > > Anyway, it seems that you have had a similar
> problem
> > > with the big endian
> > > issue as me, so I wanted to chyme in with my
> > > experience with it. While
> > > either of the fixes seems to work under specific
> > > configurations, I am not
> > > sure what the final fix should be to make it
> work
> > > under all platforms and
> > > with all types of SQL Servers both MS and
> Sybase.
> > >
> > > Do you have any other info that might help with
> > > this?
> > >
> > > Thanks,
> > >
> > > Mike
> > >
> > >
> > > > below is a patch that includes what I did for
> the
> > > > strange serve on my network. More importantly
> > > however
> > > > are the changes for big endian platforms
> towards
> > > the
> > > > end with messages. The symptom I was seeing
> was
> > > that
> > > > errors and messages were not being handled.
> > > trackign
> > > > through the code this appeared to be
> happenning
> > > > because of a double endian swap. I have also
> had
> > > to
> > > > make some changes to the dblib call to the
> message
> > > > handler as it did not pass the final argument
> of
> > > the
> > > > line number. I will send that patch as it is
> > > rather
> > > > simple if anyone needs it.
> > > >
> > > >
> > > > *** freetds-0.53-orig/src/tds/token.c Sun
> Nov 25
> > > > 19:04:17 2001
> > > > --- freetds-0.53/src/tds/token.c Fri
> Jan 18
> > > > 14:54:07 2002
> > > > ***************
> > > > *** 185,192 ****
> > > > ack =
> > > > tds_get_byte(tds);
> > > > major_ver =
> > > > tds_get_byte(tds);
> > > > minor_ver =
> > > > tds_get_byte(tds);
> > > > ! tds_get_n(tds,
> > > NULL,
> > > > len-4);
> > > > !
> tds_get_byte(tds);
> > > > #ifdef WORDS_BIGENDIAN
> > > > /*
> > > > if
> (major_ver==7)
> > > {
> > > > --- 185,219 ----
> > > > ack =
> > > > tds_get_byte(tds);
> > > > major_ver =
> > > > tds_get_byte(tds);
> > > > minor_ver =
> > > > tds_get_byte(tds);
> > > > ! if ((major_ver
> ==
> > > 4)
> > > > && (minor_ver == 6)) {
> > > > ! int tlen;
> > > > ! char
> > > > servname[1024];
> > > > !
> > > > !
> > > tds_get_byte(tds);
> > > > /* teeny version */
> > > > !
> > > tds_get_byte(tds);
> > > > /* tiny version */
> > > > ! tlen =
> > > > tds_get_byte(tds); /* servname len */
> > > > ! if (tlen
> >=
> > > > sizeof(servname))
> > > > ! tlen =
> > > > sizeof(servname) - 1;
> > > > !
> tds_get_n(tds,
> > > > servname, tlen);
> > > > !
> servname[tlen]
> > > =
> > > > '\000';
> > > > ! if
> > > > (!strcmp(servname, "OpenServer")) {
> > > > ! if
> (ack ==
> > > 0)
> > > > succeed=TDS_SUCCEED;
> > > > ! }
> > > > ! /* eat the
> > > rest of
>
=== message truncated ===
__________________________________________________
Do You Yahoo!?
Send FREE video emails in Yahoo! Mail!
http://promo.yahoo.com/videomail/
-
endian patch and Re: Strange server,
Chris Eleveld, 01/22/2002
- <Possible follow-up(s)>
- Re: endian patch and Re: Strange server, Michael Horowitz, 01/22/2002
- Re: endian patch and Re: Strange server, Chris Eleveld, 01/22/2002
- Re: endian patch and Re: Strange server, Michael Horowitz, 01/22/2002
- Re: endian patch and Re: Strange server, Brian Bruns, 01/22/2002
- Re: endian patch and Re: Strange server, Chris Eleveld, 01/23/2002
- Re: endian patch and Re: Strange server, Chris Eleveld, 01/23/2002
- Re: endian patch and Re: Strange server, Michael Horowitz, 01/23/2002
- Re: endian patch and Re: Strange server, Brian Bruns, 01/23/2002
- Re: endian patch and Re: Strange server, Michael Horowitz, 01/23/2002
Archive powered by MHonArc 2.6.24.