Changeset: f08ad50dad86 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=f08ad50dad86
Modified Files:
        sql/backends/monet5/sql.mx
        sql/include/sql_catalog.h
        sql/server/rel_schema.c
        sql/server/sql_mvc.c
        sql/server/sql_parser.y
        sql/server/sql_scan.c
        sql/storage/store.c
Branch: sciql
Log Message:

merged with default branch, manually resolved conflicts with the REMOTE changes


diffs (truncated from 5517 to 300 lines):

diff --git a/MonetDB.spec b/MonetDB.spec
--- a/MonetDB.spec
+++ b/MonetDB.spec
@@ -184,6 +184,7 @@ This package contains the MonetDB ODBC d
 if [ "$1" -eq 1 ] || ! grep -q MonetDB /etc/odbcinst.ini; then
 odbcinst -i -d -r <<EOF
 [MonetDB]
+Description = ODBC for MonetDB
 Driver = %{_exec_prefix}/lib/libMonetODBC.so
 Setup = %{_exec_prefix}/lib/libMonetODBCs.so
 Driver64 = %{_exec_prefix}/lib64/libMonetODBC.so
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
@@ -596,7 +596,7 @@
 /* #undef HAVE_TIMES */
 
 /* Define to 1 if you have the <time.h> header file. */
-/* #undef HAVE_TIME_H */
+#define HAVE_TIME_H 1
 
 /* Define to 1 if you have the timezone and daylight variables. */
 #define HAVE_TIMEZONE 1
@@ -748,16 +748,16 @@
 #define PACKAGE_BUGREPORT "i...@monetdb.org"
 
 /* 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/NT/winconfig.py b/NT/winconfig.py
--- a/NT/winconfig.py
+++ b/NT/winconfig.py
@@ -41,8 +41,6 @@ subs = [("@exec_prefix@", r'%prefix%'),
         ("@pkgincludedir@", r'%prefix%\include\@PACKAGE@'),
         ("@DIRSEP@", '\\'),
         ("@CROSS_COMPILING_FALSE@", ''),
-        ("@HAVE_CLIENTS_FALSE@", '#'),
-        ("@HAVE_MONETDB_FALSE@", '#'),
         ("@NATIVE_WIN32_FALSE@", '#'),
         ("@NOT_WIN32_FALSE@", ''),
         ("@PATHSEP@", ';')]
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/SQLDescribeCol.c 
b/clients/odbc/driver/SQLDescribeCol.c
--- a/clients/odbc/driver/SQLDescribeCol.c
+++ b/clients/odbc/driver/SQLDescribeCol.c
@@ -114,6 +114,9 @@ SQLDescribeCol_(ODBCStmt *stmt,
                case SQL_INTERVAL_MINUTE_TO_SECOND:
                        *DecimalDigitsPtr = rec->sql_desc_precision;
                        break;
+               default:
+                       *DecimalDigitsPtr = 0;
+                       break;
                }
        }
 
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
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to