Changeset: a1427664b01d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=a1427664b01d
Modified Files:
        NT/monetdb_config.h.in
        NT/rules.msc
        configure.ag
Branch: default
Log Message:

Merge with Aug2011 branch.


diffs (truncated from 332 to 300 lines):

diff --git a/NT/monetdb_config.h.in b/NT/monetdb_config.h.in
--- a/NT/monetdb_config.h.in
+++ b/NT/monetdb_config.h.in
@@ -748,16 +748,16 @@
 #define PACKAGE_BUGREPORT "[email protected]"
 
 /* Define to the full name of this package. */
-#define PACKAGE_NAME ""
+#define PACKAGE_NAME "MonetDB"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING ""
+#define PACKAGE_STRING "MonetDB 11.5.0"
 
 /* Define to the one symbol short name of this package. */
-#define PACKAGE_TARNAME ""
+#define PACKAGE_TARNAME "MonetDB"
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION ""
+#define PACKAGE_VERSION "11.5.0"
 
 /* Path separator */
 #define PATH_SEP ';'
diff --git a/NT/rules.msc b/NT/rules.msc
--- a/NT/rules.msc
+++ b/NT/rules.msc
@@ -71,7 +71,8 @@ PTHREAD_INCS =
 PTHREAD_LIBS =
 !ENDIF
 
-ODBC_LIBS = odbccp32.lib user32.lib
+ODBCINST_LIBS = odbccp32.lib user32.lib
+ODBC_LIBS = odbc32.lib
 
 !IFNDEF PYTHONBASE
 PYTHONBASE=C:\Python27
diff --git a/clients/mapilib/Makefile.ag b/clients/mapilib/Makefile.ag
--- a/clients/mapilib/Makefile.ag
+++ b/clients/mapilib/Makefile.ag
@@ -24,7 +24,7 @@ lib_mapi = {
        VERSION = $(MAPI_VERSION)
        SOURCES = mapi.c mapi.rc
        LIBS = $(SOCKET_LIBS) ../../common/stream/libstream \
-               ../../common/options/libmoptions $(openssl_LIBS)
+               ../../common/options/libmoptions $(openssl_LIBS) $(CRYPT_LIBS)
 }
 
 headers_mapi = {
diff --git a/clients/odbc/driver/Makefile.ag b/clients/odbc/driver/Makefile.ag
--- a/clients/odbc/driver/Makefile.ag
+++ b/clients/odbc/driver/Makefile.ag
@@ -117,6 +117,6 @@ lib_MonetODBC = {
        SQLTransact.c \
        driver.rc \
        ODBC.syms
-       LIBS = ../../mapilib/libmapi $(LTLIBICONV) $(ODBC_LIBS) $(SOCKET_LIBS)
+       LIBS = ../../mapilib/libmapi $(LTLIBICONV) $(ODBCINST_LIBS) 
$(SOCKET_LIBS)
 }
 
diff --git a/clients/odbc/driver/ODBCDbc.c b/clients/odbc/driver/ODBCDbc.c
--- a/clients/odbc/driver/ODBCDbc.c
+++ b/clients/odbc/driver/ODBCDbc.c
@@ -80,6 +80,9 @@ newODBCDbc(ODBCEnv *env)
        dbc->Connected = 0;
        dbc->sql_attr_autocommit = SQL_AUTOCOMMIT_ON;   /* default is 
autocommit */
        dbc->mid = NULL;
+       dbc->major = 0;
+       dbc->minor = 0;
+       dbc->patch = 0;
        dbc->cachelimit = 0;
        dbc->Mdebug = 0;
 
diff --git a/clients/odbc/driver/ODBCDbc.h b/clients/odbc/driver/ODBCDbc.h
--- a/clients/odbc/driver/ODBCDbc.h
+++ b/clients/odbc/driver/ODBCDbc.h
@@ -70,6 +70,7 @@ typedef struct tODBCDRIVERDBC {
        /* MonetDB connection handle & status information */
        Mapi mid;               /* connection with server */
        int cachelimit;         /* cache limit we requested */
+       short major, minor, patch; /* version of server */
        int Mdebug;
 
        /* Dbc children: list of ODBC Statement handles created within
diff --git a/clients/odbc/driver/ODBCGlobal.h b/clients/odbc/driver/ODBCGlobal.h
--- a/clients/odbc/driver/ODBCGlobal.h
+++ b/clients/odbc/driver/ODBCGlobal.h
@@ -59,7 +59,6 @@
 /* some general defines */
 #define MONETDB_ODBC_VER     "03.52"   /* must be synchronous with ODBCVER */
 #define MONETDB_DRIVER_NAME  "MonetDBODBClib"
-#define MONETDB_DRIVER_VER   "1.00"
 #define MONETDB_PRODUCT_NAME "MonetDB ODBC driver"
 #define MONETDB_SERVER_NAME  "MonetDB"
 
diff --git a/clients/odbc/driver/SQLConnect.c b/clients/odbc/driver/SQLConnect.c
--- a/clients/odbc/driver/SQLConnect.c
+++ b/clients/odbc/driver/SQLConnect.c
@@ -86,6 +86,21 @@ set_timezone(Mapi mid)
 #endif
 }
 
+static void
+get_serverversion(ODBCDbc *dbc)
+{
+       MapiHdl hdl;
+       char *v;
+
+       if ((hdl = mapi_query(dbc->mid, "select value from env() where name = 
'monet_version'")) == NULL)
+               return;
+       while (mapi_fetch_row(hdl)) {
+               v = mapi_fetch_field(hdl, 0);
+               sscanf(v, "%hd.%hd.%hd", &dbc->major, &dbc->minor, &dbc->patch);
+       }
+       mapi_close_handle(hdl);
+}
+
 SQLRETURN
 SQLConnect_(ODBCDbc *dbc,
            SQLCHAR *ServerName,
@@ -234,7 +249,10 @@ SQLConnect_(ODBCDbc *dbc,
                dbc->dbname = schema ? strdup(schema) : NULL;
                mapi_setAutocommit(mid, dbc->sql_attr_autocommit == 
SQL_AUTOCOMMIT_ON);
                set_timezone(mid);
-               mapi_set_size_header(mid, 1);
+               get_serverversion(dbc);
+               if (dbc->major > 11 ||
+                   (dbc->major == 11 && dbc->minor >= 5))
+                       mapi_set_size_header(mid, 1);
        }
 
        return rc;
diff --git a/clients/odbc/driver/SQLGetInfo.c b/clients/odbc/driver/SQLGetInfo.c
--- a/clients/odbc/driver/SQLGetInfo.c
+++ b/clients/odbc/driver/SQLGetInfo.c
@@ -49,6 +49,7 @@ SQLGetInfo_(ODBCDbc *dbc,
            SQLSMALLINT *StringLengthPtr)
 {
        int nValue = 0;
+       char buf[64];
        const char *sValue = NULL;      /* iff non-NULL, return string value */
        int len = 0;
 
@@ -386,9 +387,14 @@ SQLGetInfo_(ODBCDbc *dbc,
        case SQL_DRIVER_NAME:
                sValue = MONETDB_DRIVER_NAME;
                break;
-       case SQL_DRIVER_VER:
-               sValue = MONETDB_DRIVER_VER;
+       case SQL_DRIVER_VER: {
+               int maj = 0, min = 0, pat = 0;
+               sscanf(PACKAGE_VERSION, "%d.%d.%d", &maj, &min, &pat);
+               snprintf(buf, sizeof(buf), "%02d.%02d.%04d %s", maj, min, pat,
+                        MONETDB_RELEASE);
+               sValue = buf;
                break;
+       }
        case SQL_FETCH_DIRECTION:
                nValue = SQL_FD_FETCH_NEXT;
                len = sizeof(SQLUSMALLINT);
@@ -419,10 +425,12 @@ SQLGetInfo_(ODBCDbc *dbc,
                len = sizeof(SQLUSMALLINT);
                break;
        case SQL_DBMS_NAME:
-               sValue = MONETDB_PRODUCT_NAME;
+               sValue = PACKAGE_NAME;
                break;
        case SQL_DBMS_VER:
-               sValue = MONETDB_DRIVER_VER;
+               snprintf(buf, sizeof(buf), "%02d.%02d.%04d",
+                        dbc->major, dbc->minor, dbc->patch);
+               sValue = buf;
                break;
        case SQL_PROCEDURES:
                sValue = "N";
diff --git a/clients/odbc/samples/Makefile.ag b/clients/odbc/samples/Makefile.ag
--- a/clients/odbc/samples/Makefile.ag
+++ b/clients/odbc/samples/Makefile.ag
@@ -17,19 +17,11 @@
 
 MTSAFE
 
-# FIXME: libMonetODBC is actually a module, one cannot link against
-# that on Darwin.  We need to properly link against (unix)ODBC and use
-# it's drivermanager which correctly dlopens the MonetODBC module.  This
-# requires an odbc.ini file, and testing to be aware of it as well.
-#BINS = {
-#      CONDINST = HAVE_TESTING
-#      DIR = libdir/monetdb/tests
-#      SOURCES = odbcsample1.c testgetinfo.c
-#      LIBS = ../driver/libMonetODBC ../../mapilib/libmapi $(curl_LIBS)
-#}
+INCLUDES = $(ODBC_INCS)
 
-bin_odbctest = {
-       COND = NATIVE_WIN32
-       SOURCES = odbcsample1.c
-       LIBS = -lodbc32
+BINS = {
+       CONDINST = HAVE_TESTING
+       DIR = libdir/monetdb/tests
+       SOURCES = odbcsample1.c testgetinfo.c
+       LIBS = $(ODBC_LIBS)
 }
diff --git a/clients/odbc/samples/odbcsample1.c 
b/clients/odbc/samples/odbcsample1.c
--- a/clients/odbc/samples/odbcsample1.c
+++ b/clients/odbc/samples/odbcsample1.c
@@ -17,7 +17,9 @@
  * All Rights Reserved.
  */
 
-#include "monetdb_config.h"    /* we need SIZEOF_INT and SIZEOF_LONG for sql.h 
*/
+#ifdef _MSC_VER
+#include <WTypes.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <sql.h>
diff --git a/clients/odbc/samples/testgetinfo.c 
b/clients/odbc/samples/testgetinfo.c
--- a/clients/odbc/samples/testgetinfo.c
+++ b/clients/odbc/samples/testgetinfo.c
@@ -17,7 +17,9 @@
  * All Rights Reserved.
  */
 
-#include "monetdb_config.h"    /* we need SIZEOF_INT and SIZEOF_LONG for sql.h 
*/
+#ifdef _MSC_VER
+#include <WTypes.h>
+#endif
 #include <stdio.h>
 #include <stdlib.h>
 #include <sql.h>
@@ -91,7 +93,6 @@ main(int argc, char **argv)
        SQLSMALLINT resultlen;
        SQLUSMALLINT si;
        SQLUINTEGER i;
-       SQLULEN li;
 
        if (argc > 1)
                dsn = argv[1];
@@ -346,10 +347,6 @@ main(int argc, char **argv)
        check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
        printf("SQL_DM_VER: %.*s\n", resultlen, str);
 
-       ret = SQLGetInfo(dbc, SQL_DRIVER_HDESC, &li, sizeof(li), &resultlen);
-       check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
-       printf("SQL_DRIVER_HDESC: %lu\n", (unsigned long) li);
-
        ret = SQLGetInfo(dbc, SQL_DRIVER_NAME, str, sizeof(str), &resultlen);
        check(ret, SQL_HANDLE_DBC, dbc, "SQLGetInfo");
        printf("SQL_DRIVER_NAME: %.*s\n", resultlen, str);
diff --git a/configure.ag b/configure.ag
--- a/configure.ag
+++ b/configure.ag
@@ -2102,6 +2102,7 @@ AM_CONDITIONAL(HAVE_SPHINXCLIENT, test x
 if test "x$enable_odbc" != xno; then
        have_unixodbc=auto
        ODBC_INCS=''
+       ODBCINST_LIBS=''
        ODBC_LIBS=''
        AC_ARG_WITH(unixodbc,
                AS_HELP_STRING([--with-unixodbc=DIR],
@@ -2113,6 +2114,7 @@ if test "x$enable_odbc" != xno; then
                        ;;
                *)
                        ODBC_INCS="-I$have_unixodbc/include"
+                       ODBCINST_LIBS="-L$have_unixodbc/lib"
                        ODBC_LIBS="-L$have_unixodbc/lib"
                        ;;
                esac
@@ -2125,14 +2127,23 @@ if test "x$enable_odbc" != xno; then
        fi
        if test "x$have_unixodbc" != xno; then
                save_LIBS="$LIBS"
-               LIBS="$LIBS $ODBC_LIBS"
+               LIBS="$LIBS $ODBCINST_LIBS"
                AC_CHECK_LIB(odbcinst,
                        SQLGetPrivateProfileString, :,
                        [if test "x$have_unixodbc" != xauto; then 
AC_MSG_ERROR([-lodbcinst not found]); fi; have_unixodbc=no])
                LIBS="$save_LIBS"
        fi
        if test "x$have_unixodbc" != xno; then
-               ODBC_LIBS="$ODBC_LIBS -lodbcinst"
+               save_LIBS="$LIBS"
+               LIBS="$LIBS $ODBC_LIBS"
+               AC_CHECK_LIB(odbc,
+                       SQLGetDiagRec, :,
+                       [if test "x$have_unixodbc" != xauto; then 
AC_MSG_ERROR([-lodbc not found]); fi; have_unixodbc=no])
+               LIBS="$save_LIBS"
+       fi
+       if test "x$have_unixodbc" != xno; then
+               ODBCINST_LIBS="$ODBCINST_LIBS -lodbcinst"
+               ODBC_LIBS="$ODBC_LIBS -lodbc"
                AC_DEFINE(HAVE_SQLGETPRIVATEPROFILESTRING, 1,
                        [Define if you have the SQLGetPrivateProfileString 
function])
        fi
@@ -2159,6 +2170,7 @@ if test "x$enable_odbc" != xno; then
                        [Define as SQLLEN * or SQLPOINTER depending on the 
include file])
        fi
        AC_SUBST(ODBC_INCS)
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to