Skip to Content.
Sympa Menu

freetds - Re: endian patch and Re: Strange server

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Michael Horowitz" <michael.horowitz AT storagenetworks.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: endian patch and Re: Strange server
  • Date: Wed, 23 Jan 2002 18:30:31 -0500


Just to confirm...

You just removed the following 3 lines:
#ifdef WORDS_BIGENDIAN
tds_swap_bytes(&rc, 4);
#endif
from freetds-0.53/src/tds/token.c?

That seemed to make it work for me in all situations if I used either 4.2
with emulate little endian, or 7.0 and connected to either MSSQL 7.0 or
2000.

--Mike

> hi all,
>
> I've removed the swap on the message number. If someone needs to use
> broken SQL Servers with broken datetimes on big endian clients, you'll
> need to set emulate little endian in the freetds.conf file. Let me know
> if there are still problems.
>
> Brian
>
> On Wed, 23 Jan 2002, Michael Horowitz wrote:
>
> > I have tried using the datetime/money swaps with TDS versions 4.2 and 7.0
> > with and without emulate little endian(for 4.2), and connecting to both MS
> > SQL Server 7.0 and 2000, and it seems to have no effect at all. Only the
> > emulate little endian options(or using v7.0) seems to fix the
> > datetime/money problems.
> >
> > The bigger problem is that on big endian machines(for me Solaris 2.6), the
> > error messages don't get handled properly, because the message number is
> > double swapped and then truncated from 4 bytes to 2. So, it ends up as
> > zero, and from a discussion 2-3 weeks ago with Michael Peppler, it ends up
> > being treated as a SQL PRINT statement. When using freeTDS through
> > DBD::Sybase, errors are never raised properly, and they all end up just
> > being printed to STDERR(via the perl "warn" function).
> >
> > The problem was in freetds-0.53/src/tds/token.c where if the client is
> > emulating little endian either via the config option or by using tds
> > version 7.0, tds_get_int would swap the bytes or the message number before
> > returning the int, but then it would be swapped again right after. For me
> > I am always using emulate little endian anyway, so the easiest solution
> > was to just remove the second swap, or condition the second swap only if
> > emulate little endian was false. I discussed this a while back with Mark
> > Lilback, and he said that he had to look into it because it would still
> > break something when not using emulate little endian. I did some test of
> > my own and differences between MS SQL Server 7.0 and 2000 seem to cause
> > problems with this fix.
> >
> > Now it seems that Chris Eleveld is having the same problems as me, and
> > came up with the same fix, plus some others that I didn't notice.
> >
> > For now it seems if I use the temporary patch of the swapping issue, and I
> > am careful about the configuration I use, I can get it to work properly,
> > but I would feel better if I knew that some sort of more complete
> > permanent patch was going into the main code, so that I know future
> > versions of freetds will work if I want to upgrade.
> > I am not familiar enough with the code to make any sort of fix that I am
> > sure wont break anything else. I only read enough of the code to trace
> > down that one swapping error.
> >
> > Anyway, I would appreciate any help I can get to fix this properly.
> >
> > Thanks,
> >
> > Mike
> >
> > > On Tue, 22 Jan 2002, Michael Horowitz wrote:
> > >
> > > > 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?
> > >
> > > What I would like to do, is remove the datetime/money swaps entirely.
> > > If
> > > you are using FreeTDS on a big endian box against MS SQL, use emulate
> > > little endian. Anything else works in bits and pieces here and there,
> > > but
> > > then breaks with the next service pack. It'll also simplify what is
> > > going
> > > on underneath anyway.
> > >
> > > Besides, TDS 7.0 is little endian only, and it doesn't appear that MS
> > > QA's
> > > big endian machines so it's a crap shoot trying to get it working.
> > >
> > > Brian
> >
> > ---
> > You are currently subscribed to freetds as: [camber AT ais.org]
> > To unsubscribe, forward this message to $subst('Email.Unsub')
> >




Archive powered by MHonArc 2.6.24.

Top of Page