Use SIZEOF_LONG_INT to check whether SQLROWSETSIZE exists.
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 12 Oct 2016 07:21:31 +0000 (10:21 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Wed, 12 Oct 2016 07:21:31 +0000 (10:21 +0300)
I changed this originally to use SIZEOF_LONG_INT, in commit 661b9bf8. That
commit also changed an unrelated check in psqlodbc.h, but that was wrong.
Hiroshi fixed that in commit 19b3dee3, by changing them to use SIZEOF_LONG
instead. That was correct for psqlodbc.h, but was in turn wrong for
odbcapi.c.

SIZEOF_LONG_INT is defined in UnixODBC headers, while SIZEOF_LONG is defined
by psqlodbc's ./configure. In odbcapi.c, we use it to determine what format
modifier, %ld or %lld, to use for pointers. (Why don't we use %p?). We should
rely on our autoconf check for that. In odbcapi.c, however, the check should
match that in the ODBC headers, to determine whether SQLROWSIZE exists, so
we should use SIZEOF_LONG_INT.

odbcapi.c

index 9f2ec461d09e0530b04add8cc44294ec1c1a286d..ca2ce313b391a8bba9ede648d285d54df69b701c 100644 (file)
--- a/odbcapi.c
+++ b/odbcapi.c
@@ -913,7 +913,7 @@ RETCODE     SQL_API
 SQLExtendedFetch(HSTMT hstmt,
                 SQLUSMALLINT fFetchType,
                 SQLLEN irow,
-#if defined(WITH_UNIXODBC) && (SIZEOF_LONG != 8)
+#if defined(WITH_UNIXODBC) && (SIZEOF_LONG_INT != 8)
                 SQLROWSETSIZE *pcrow,
 #else
                 SQLULEN *pcrow,