freetds AT lists.ibiblio.org
Subject: FreeTDS Development Group
List archive
- From: Brian Bruns <camber AT ais.org>
- To: TDS Development Group <freetds AT franklin.oit.unc.edu>
- Subject: Re: little endian emulation (Was: BIGENDIAN)
- Date: Thu, 12 Jul 2001 21:16:03 -0400 (EDT)
Ack, I bludgeoned it pretty badly. Changes are commited. I guess we'd
better get me an account eh? Email me off list.
Cheers,
Brian
On Thu, 12 Jul 2001, Paul Schaap wrote:
> Brian,
>
> > I've added a config option 'emulate little endian' (boolean option,
> > accepts yes/on, on/off, true/false or 1/0) for the freetds.conf
> > file. Using TDS 7 will automatically cause this to be set.
>
> I recompiled after altering the source as it wouldn't compile, are my
> changes in line with what was meant ? :-
> diff -urN freetds/src/tds/login.c freetdsfix/src/tds/login.c
> --- freetds/src/tds/login.c Fri Jul 13 08:29:10 2001
> +++ freetdsfix/src/tds/login.c Sat Jul 14 00:46:52 2001
> @@ -187,8 +187,8 @@
> retval = 0;
> retval = select(tds->s + 1, NULL, &fds, NULL,
> &selecttimeout);
> /* patch from Kostya Ivanov <kostya AT warmcat.excom.spb.su> */
> - if (retcode < 0 && errno == EINTR)
> - retcode = 0;
> + if (retval < 0 && errno == EINTR)
> + retval = 0;
> /* end patch */
>
> now = time (NULL);
> diff -urN freetds/src/tds/token.c freetdsfix/src/tds/token.c
> --- freetds/src/tds/token.c Fri Jul 13 08:29:11 2001
> +++ freetdsfix/src/tds/token.c Fri Jul 13 23:57:26 2001
> @@ -923,11 +923,11 @@
> }
> if (tds->emul_little_endian) {
> switch(curcol->column_type) {
> - case SYBINT:
> - (*(TDS_INT *)dest) =
> TDS_BYTE_SWAP32(*(TDS_INT *)dest)
> + case SYBINT4:
> + (*(TDS_INT *)dest) =
> TDS_BYTE_SWAP32(*(TDS_INT *)dest);
> break;
> - case SYBSMALLINT:
> - (*(TDS_SMALLINT *)dest) =
> TDS_BYTE_SWAP16(*(TDS_SMALLINT *)dest)
> + case SYBINT2:
> + (*(TDS_SMALLINT *)dest) =
> TDS_BYTE_SWAP16(*(TDS_SMALLINT *)dest);
> break;
> }
> }
>
> I then compiled and with TDSVER unset it did 4.2 calls and got the correct
> values. With TDSVER=70 it got wrong values, should have been 85114 but got
> 2051801344. (I'm not using a freetds.conf at all, right?)
>
>
>
> >
> > Theoretically this will allow big endian clients to appear to the server
> > as little endian, thus putting an end to the perpetual stream of microsoft
> > bugs affecting big end clients.
>
> :-( darn they make your life interesting.
>
> >
> > It's not complete yet, but Paul if you can test TDS 7 on Linux PPC, int
> > and smallint types *should* return correctly now. Let me know.
>
> Are you Sure you don't want an account on my external machine to help make
> the test cycle shorter, I have even a simple script to
> cvs->recompile->install in one go to make it easy.
>
>
> >
> > Brian
> >
> > On Thu, 12 Jul 2001, Mark J. Lilback wrote:
>
> Mark, thanks for your input ! Your efforts with SQL on Mac are legenedary,
> Respect !
>
> >
> > > At 7:13 AM -0400 7/12/01, Brian Bruns wrote:
> > > >Mark,
> > > >
> > > >Is this limited to an MS-SQL server? It seems to be the date problem
> > > >all
> > > >over again. I'm thinking that we will support a 'emulate little
> > > >endian'
> > > >mode for big end machines that will be used with TDS 7 and for big end
> > > >machines connecting to broken versions of SQL Server. Which version is
> > > >the server that exhibits this behaviour?
> > >
> > > This is with SQL Server 7, pre SP3. I've conditionalized my code so
> > > that once a connection is open, I query the server to get what
> > > version it is("master.dbo.xp_msver ProductVersion"). If it is less
> > > than 961, I set dbproc->tds_socket->broken_dates to 1, otherwise i
> > > set it to 0. (Since SP3 fixes the bigendian date problem.)
> > >
> > > I'm compiling freetds into a plugin for MacSQL Monitor, a generic
> > > database tool. Because I need a lot of specific data not provided by
> > > any of the apis, the plugin is hard-coded for SQL Server only. That's
> > > all I've tested against, too.
> > >
> > > For this patch, it might be possible to detect if it is necessary.
> > > It's been a while since I was debugging this, but I believe you'll
> > > get a completely impossible message code if the data isn't swapped
> > > properly (I think it is negative, but I'd have to check). The test
> > > could be if bigendian and if (rc < 0).
> > >
> > >
> > >
>
> CHEERS
> Poorly
>
> ---
> You are currently subscribed to freetds as: [camber AT ais.org]
> To unsubscribe, forward this message to $subst('Email.Unsub')
>
-
little endian emulation (Was: BIGENDIAN),
Brian Bruns, 07/12/2001
- <Possible follow-up(s)>
- Re: little endian emulation (Was: BIGENDIAN), Paul Schaap, 07/12/2001
- Re: little endian emulation (Was: BIGENDIAN), Brian Bruns, 07/12/2001
- Re: little endian emulation (Was: BIGENDIAN), Paul Schaap, 07/12/2001
- Re: little endian emulation (Was: BIGENDIAN), Rajeev, 07/13/2001
Archive powered by MHonArc 2.6.24.