[ wxwindows-Patches-1728725 ] 64-bit linux build fix for database/odbc stuff

SourceForge.net noreply at sourceforge.net
Sat Jun 2 15:21:34 PDT 2007


Patches item #1728725, was opened at 2007-05-31 07:07
Message generated for change (Comment added) made by vadz
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1728725&group_id=9863

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Database
Group: bug fix
>Status: Pending
Resolution: None
Priority: 5
Private: No
Submitted By: Aleksander Demko (ademko)
Assigned to: Nobody/Anonymous (nobody)
Summary: 64-bit linux build fix for database/odbc stuff

Initial Comment:
This patch fixes two errors that cause the build to fail under 64-bit linux.

The first file was in error as it was defining a new type over something that was already typedefed (see sqltypes.h in unixodbc, atleast under ubunutu 6.06).

The second file just used the wrong type. The only reason this probably worked under 32-bit and other platforms is because they just happened to map to the same pritmitive type.

----------------------------------------------------------------------

>Comment By: Vadim Zeitlin (vadz)
Date: 2007-06-03 00:21

Message:
Logged In: YES 
user_id=71618
Originator: NO

I'm afraid an #ifdef wouldn't be enough as there could be some older
version of unixODBC which didn't have SQLROWSETSIZE too (or maybe other
ODBC libraries, unixODBC isn't the only one). This is why I'd prefer a test
in configure. We could simply test if the type is defined (by trying to
compile a test program using it) and use it for both SQLROWSETSIZE and
SQLLEN (it wouldn't matter if it's defined as typedef or define).

Could you please do it like this? TIA!

----------------------------------------------------------------------

Comment By: Aleksander Demko (ademko)
Date: 2007-06-02 17:12

Message:
Logged In: YES 
user_id=713709
Originator: YES

I guess this is an example of the two undlying APIs conflicting. Under
unixODBC, ExendedFetch wants a SQLROWSETSIZE, but microsoft wants SQLUINT.
Maybe a gross platform-specific ifdef is in order?

The BUILD_REAL_64_BIT_MODE was, I admit, a hack lifted right from the
sqltypes.h from unixODBC[3]. I'm not sure what the correct way to do it
though, as I'm sure the #ifndef SQLLEN+#define SQLLEN construct was
probably itself a hack around some other broken odbc implementation.
Eitherway, under 64-bit linux SQLLEN is a typedef type and not defined, so
this will always cause problems.


[1] unixODBC:
SQLRETURN SQL_API SQLExtendedFetch(
    SQLHSTMT           hstmt,
    SQLUSMALLINT       fFetchType,
    SQLROWOFFSET       irow,
    SQLROWSETSIZE     *pcrow,
    SQLUSMALLINT    *rgfRowStatus);
[2]
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odbc/htm/odbcsqlextendedfetch.asp
[3]
/*
 * Failing to define this is *absolutely* broken on 64-bit archs, and we
 * are setting it in the Debian build, so use of this ABI is mandatory.
 * If you don't like it, go build your own non-64-bit-clean library
instead.
 * SRL 2006-03-04
 */
#ifndef BUILD_REAL_64_BIT_MODE
#define BUILD_REAL_64_BIT_MODE
#endif

#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
typedef long            SQLINTEGER;
typedef unsigned long   SQLUINTEGER;
#define SQLLEN          SQLINTEGER
#define SQLULEN         SQLUINTEGER
#define SQLSETPOSIROW   SQLUSMALLINT
typedef SQLULEN         SQLROWCOUNT;
typedef SQLULEN         SQLROWSETSIZE;
typedef SQLULEN         SQLTRANSID;
typedef SQLLEN          SQLROWOFFSET;
#endif


----------------------------------------------------------------------

Comment By: Vadim Zeitlin (vadz)
Date: 2007-06-02 15:32

Message:
Logged In: YES 
user_id=71618
Originator: NO

I don't know much about ODBC but SQLROWSETSIZE doesn't seem to be defined
under Windows so this patch will probably break compilation there, see 

http://publib.boulder.ibm.com/infocenter/iseries/v5r4/index.jsp?topic=/rzatv/rzaikodbc64bitconsiderations.htm

It's also not really clear what does BUILD_REAL_64_BIT_MODE stand for and
I think it would be better to have a configure testing whether SQLLEN is a
define or typedef.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=309863&aid=1728725&group_id=9863




More information about the wx-dev mailing list