List:Commits« Previous MessageNext Message »
From:mysqldev Date:September 10 2006 9:50pm
Subject:Connector/ODBC 3.51 commit: r86 - in trunk: . myodbc3
View as plain text  
Modified:
   trunk/configure.in
   trunk/myodbc3/prepare.c
   trunk/myodbc3/results.c
Log:
Added configure checks to handle the different manager header file
declarations for SQLParamOptions() and SQLColAttribute()


Modified: trunk/configure.in
===================================================================
--- trunk/configure.in	2006-09-10 19:53:30 UTC (rev 85)
+++ trunk/configure.in	2006-09-10 21:50:30 UTC (rev 86)
@@ -154,7 +154,7 @@
 # FIXME handle 64 bit if other than "lib" directory
 AC_ARG_WITH(ltdl-path,
 [AC_HELP_STRING([--with-ltdl-path=DIR],
-	        [Where libtool "libltdl" and "ltdl.h" are installed])],
+                [Where libtool "libltdl" and "ltdl.h" are installed])],
 [
  CPPFLAGS="$CPPFLAGS -I$withval/include"
  LDFLAGS="$LDFLAGS -L$withval/lib"
@@ -376,7 +376,7 @@
          case "$LDFLAGS" in
            *-belf*) ;;
            *)
-	     echo "Adding -belf option to ldflags."
+             echo "Adding -belf option to ldflags."
              LDFLAGS="$LDFLAGS -belf"
            ;;
          esac
@@ -492,7 +492,7 @@
 ###################################################################
 #                                                                 #
 # Check for the client libraries and compile options              #
-# Options are taken from the output of mysql_config		  #
+# Options are taken from the output of mysql_config               #
 #                                                                 #
 ###################################################################
 
@@ -655,7 +655,7 @@
 # Default to /usr if not specified
 if test "x$unixODBC" = "x"
 then
-	unixODBC="/usr";
+  unixODBC="/usr";
 fi
 
 myodbc_link_dmlib="-lodbc"
@@ -908,6 +908,108 @@
 
 ###################################################################
 #                                                                 #
+# Handle declaration compatibility problems                       #
+#                                                                 #
+###################################################################
+
+# Function SQLParamOptions() is depricated in ODBC 3
+AC_MSG_CHECKING([if SQLParamOptions() 2/3rd arg is compatible with SQLULEN])
+AC_COMPILE_IFELSE(
+[
+  AC_LANG_SOURCE(
+  [
+    #include <sql.h>
+    #include <sqlext.h>
+
+    SQLRETURN SQL_API SQLParamOptions( SQLHSTMT     hstmt, 
+				       SQLULEN      crow,
+				       SQLULEN      *pirow __attribute__((unused)) )
+    { return 1; }
+  ])
+],
+[
+  AC_MSG_RESULT([yes])
+  AC_DEFINE(USE_SQLPARAMOPTIONS_SQLULEN_PTR, 1,
+            [Define if SQLParamOptions() 2/3rd arg is compatible with SQLULEN])
+],
+[
+  AC_MSG_RESULT([no])
+  AC_MSG_CHECKING([if SQLParamOptions() 2/3rd arg is compatible with SQLUINTEGER])
+  AC_COMPILE_IFELSE(
+  [
+    AC_LANG_SOURCE(
+    [
+      #include <sql.h>
+      #include <sqlext.h>
+
+      SQLRETURN SQL_API SQLParamOptions( SQLHSTMT     hstmt, 
+                                         SQLUINTEGER  crow,
+                                         SQLUINTEGER *pirow __attribute__((unused)) )
+      { return 1; }
+    ])
+  ],
+  [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE(USE_SQLPARAMOPTIONS_SQLUINTEGER_PTR, 1,
+              [Define if SQLParamOptions() 2/3rd arg is compatible with SQLUINTEGER])
+  ],
+  [ AC_MSG_RESULT([no]) ])
+])
+
+# Microsoft changed declaration for 64 bits to SQLLEN*, from SQLPOINTER
+AC_MSG_CHECKING([if SQLColAttribute() last arg is compatible with SQLLEN*])
+AC_COMPILE_IFELSE(
+[
+  AC_LANG_SOURCE(
+  [
+    #include <sql.h>
+    #include <sqlext.h>
+
+    SQLRETURN SQL_API SQLColAttribute( SQLHSTMT  StatementHandle,
+                                       SQLUSMALLINT ColumnNumber,
+                                       SQLUSMALLINT FieldIdentifier,
+                                       SQLPOINTER  CharacterAttributePtr,
+                                       SQLSMALLINT BufferLength,
+                                       SQLSMALLINT *StringLengthPtr,
+                                       SQLLEN *  NumericAttributePtr )
+    { return 1; }
+  ])
+],
+[
+  AC_MSG_RESULT([yes])
+  AC_DEFINE(USE_SQLCOLATTRIBUTE_SQLLEN_PTR, 1,
+            [Define if SQLColAttribute() last arg is compatible with SQLLEN*])
+],
+[
+  AC_MSG_RESULT([no])
+  AC_MSG_CHECKING([if SQLColAttribute() last arg is compatible with SQLPOINTER])
+  AC_COMPILE_IFELSE(
+  [
+    AC_LANG_SOURCE(
+    [
+      #include <sql.h>
+      #include <sqlext.h>
+
+      SQLRETURN SQL_API SQLColAttribute( SQLHSTMT  StatementHandle,
+                                         SQLUSMALLINT ColumnNumber,
+                                         SQLUSMALLINT FieldIdentifier,
+                                         SQLPOINTER  CharacterAttributePtr,
+                                         SQLSMALLINT BufferLength,
+                                         SQLSMALLINT *StringLengthPtr,
+                                         SQLPOINTER  NumericAttributePtr )
+      { return 1; }
+    ])
+  ],
+  [
+    AC_MSG_RESULT([yes])
+    AC_DEFINE(USE_SQLCOLATTRIBUTE_SQLPOINTER, 1,
+              [Define if SQLColAttribute() last arg is compatible with SQLPOINTER])
+  ],
+  [ AC_MSG_RESULT([no]) ])
+])
+
+###################################################################
+#                                                                 #
 # Generate Makefiles                                              #
 #                                                                 #
 ###################################################################

Modified: trunk/myodbc3/prepare.c
===================================================================
--- trunk/myodbc3/prepare.c	2006-09-10 19:53:30 UTC (rev 85)
+++ trunk/myodbc3/prepare.c	2006-09-10 21:50:30 UTC (rev 86)
@@ -316,9 +316,15 @@
   @purpose : sets multiple values (arrays) for the set of parameter markers
 */
 
+#ifdef USE_SQLPARAMOPTIONS_SQLULEN_PTR
 SQLRETURN SQL_API SQLParamOptions( SQLHSTMT     hstmt, 
+                                   SQLULEN      crow,
+                                   SQLULEN      *pirow __attribute__((unused)) )
+#else
+SQLRETURN SQL_API SQLParamOptions( SQLHSTMT     hstmt, 
                                    SQLUINTEGER  crow,
                                    SQLUINTEGER *pirow __attribute__((unused)) )
+#endif
 {
     MYODBCDbgEnter("SQLParamOptions");
 

Modified: trunk/myodbc3/results.c
===================================================================
--- trunk/myodbc3/results.c	2006-09-10 19:53:30 UTC (rev 85)
+++ trunk/myodbc3/results.c	2006-09-10 21:50:30 UTC (rev 86)
@@ -546,21 +546,15 @@
   @purpose : rerunrs column atribute values
 */
 
-#if defined(__APPLE__)
 SQLRETURN SQL_API SQLColAttribute( SQLHSTMT  StatementHandle,
                                    SQLUSMALLINT ColumnNumber,
                                    SQLUSMALLINT FieldIdentifier,
                                    SQLPOINTER  CharacterAttributePtr,
                                    SQLSMALLINT BufferLength,
                                    SQLSMALLINT *StringLengthPtr,
+#ifdef USE_SQLCOLATTRIBUTE_SQLLEN_PTR
                                    SQLLEN *  NumericAttributePtr )
 #else
-SQLRETURN SQL_API SQLColAttribute( SQLHSTMT  StatementHandle,
-                                   SQLUSMALLINT ColumnNumber,
-                                   SQLUSMALLINT FieldIdentifier,
-                                   SQLPOINTER  CharacterAttributePtr,
-                                   SQLSMALLINT BufferLength,
-                                   SQLSMALLINT *StringLengthPtr,
                                    SQLPOINTER  NumericAttributePtr )
 #endif
 {

Thread
Connector/ODBC 3.51 commit: r86 - in trunk: . myodbc3mysqldev10 Sep