Skip to Content.
Sympa Menu

freetds - Re: [freetds] 0.64rc2 Debian prerelease packages available

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Frediano Ziglio <freddyz77 AT tin.it>
  • To: FreeTDS Development Group <freetds AT lists.ibiblio.org>
  • Cc: Nick Gorham <nick AT lurcher.org>
  • Subject: Re: [freetds] 0.64rc2 Debian prerelease packages available
  • Date: Sat, 01 Apr 2006 10:27:35 +0200

Il giorno ven, 31/03/2006 alle 13.15 -0800, Steve Langasek ha scritto:
> On Fri, Mar 31, 2006 at 12:06:44PM +0200, ZIGLIO, Frediano, VF-IT wrote:
> > > The packages include two patches of significance. One is a
> > > further fix for
> > > 64-bit ODBC compatibility which I'd like to submit for
> > > consideration for
> > > 0.64; without it, FreeTDS fails to build on 64-bit Debian systems with
> > > gcc-4.0. (On non-Debian systems, it may build successfully
> > > only because
> > > UnixODBC is currently not 64-bit clean by default upstream.)
>
> > I don't see anything wrong in 64-bit patch, if it do not compile for
> > some reason it should be included in 0.64. How do you compile unixODBC
> > for 64-bit platforms?
>
> Using the BUILD_REAL_64_BIT_MODE define, to get 64-bit data types where
> they're needed.
>
> > Well, the truth is that ODBC itself is not 64 bit clean!!!
>
> Yes, I'm aware of that. I'm more concerned about working software than I am
> about compliance with broken standards maintained by companies that haven't
> been able to produce a 64-bit OS a decade after the advent of the DEC Alpha.
> Building with BUILD_REAL_64_BIT_MODE in unixodbc gets me working software.
> :)
>

Mmmm... from MS documentation it seems that row numbers, data length
pointer and offsets became 64-bit on 64-bit platforms so from sqltypes.h

#if (SIZEOF_LONG == 8)
#ifndef BUILD_REAL_64_BIT_MODE
typedef int SQLINTEGER;
typedef unsigned int SQLUINTEGER;
#define SQLLEN SQLINTEGER
#define SQLULEN SQLUINTEGER
#define SQLSETPOSIROW SQLUSMALLINT
typedef SQLULEN SQLROWCOUNT;
typedef SQLULEN SQLROWSETSIZE;
typedef SQLULEN SQLTRANSID;
typedef SQLLEN SQLROWOFFSET;
#else
typedef int SQLINTEGER;
typedef unsigned int SQLUINTEGER;
typedef long SQLLEN;
typedef unsigned long SQLULEN;
typedef unsigned long SQLSETPOSIROW;
/*
* These are not supprted on 64bit ODBC according to MS
* typedef SQLULEN SQLTRANSID;
*/
typedef SQLULEN SQLROWCOUNT;
typedef SQLUINTEGER SQLROWSETSIZE;
typedef SQLLEN SQLROWOFFSET;
#endif
#else

I don't agree SQLROWSETSIZE is 32 bit on clean 64 bit, should be
SQLULEN, not SQLUINTEGER

This should fix

@@ -423,7 +423,7 @@
#endif

SQLRETURN SQL_API
-SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLLEN irow,
SQLULEN FAR * pcrow, SQLUSMALLINT FAR * rgfRowStatus)
+SQLExtendedFetch(SQLHSTMT hstmt, SQLUSMALLINT fFetchType, SQLROWOFFSET
irow, SQLROWSETSIZE FAR * pcrow, SQLUSMALLINT FAR * rgfRowStatus)
{
SQLRETURN ret;
SQLULEN * tmp_rows;

Also note that pirow argument of SQLParamOptions is used for a pointer
to row number so even this should be 64 bit so declaration in sqlext.h
should be

SQLRETURN SQL_API SQLParamOptions(
SQLHSTMT hstmt,
SQLULEN crow,
SQLULEN *pirow);

So I think that unixODBC should be fixed instead of FreeTDS (unixODBC
2.2.12 already contains this change). Changing only FreeTDS declaration
fix compile problems but lead to data corruptions or possible cores so I
think is better to fix the problem in a definitive way...

You can get unixODBC 2.2.12 (which is not a release!!) at
ftp://ftp.easysoft.com/pub/unixODBC/

freddy77






Archive powered by MHonArc 2.6.24.

Top of Page