Changeset: 6623f5d20ea3 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=6623f5d20ea3
Modified Files:
        NT/monetdb_config.h.in
        clients/Tests/exports.stable.out
        clients/examples/C/smack00.c
        clients/examples/C/smack01.c
        clients/mapiclient/mclient.c
        clients/odbc/samples/arraytest.c
        clients/odbc/samples/odbcsample1.c
        clients/odbc/samples/testStmtAttr.c
        clients/odbc/samples/testgetinfo.c
        gdk/gdk.h
        gdk/gdk_aggr.c
        gdk/gdk_align.c
        gdk/gdk_analytic_bounds.c
        gdk/gdk_analytic_func.c
        gdk/gdk_atoms.c
        gdk/gdk_bat.c
        gdk/gdk_batop.c
        gdk/gdk_bbp.c
        gdk/gdk_calc.c
        gdk/gdk_calc_compare.h
        gdk/gdk_cand.c
        gdk/gdk_group.c
        gdk/gdk_hash.c
        gdk/gdk_heap.c
        gdk/gdk_imprints.c
        gdk/gdk_join.c
        gdk/gdk_logger.c
        gdk/gdk_orderidx.c
        gdk/gdk_posix.c
        gdk/gdk_private.h
        gdk/gdk_project.c
        gdk/gdk_sample.c
        gdk/gdk_select.c
        gdk/gdk_storage.c
        gdk/gdk_string.c
        gdk/gdk_system.c
        gdk/gdk_tm.c
        gdk/gdk_tracer.c
        gdk/gdk_tracer.h
        gdk/gdk_unique.c
        gdk/gdk_utils.c
        geom/lib/libgeom.c
        monetdb5/mal/mal_dataflow.c
        monetdb5/mal/mal_exception.c
        monetdb5/mal/mal_instruction.c
        monetdb5/mal/mal_linker.c
        monetdb5/modules/atoms/blob.c
        monetdb5/modules/atoms/xml.c
        monetdb5/modules/kernel/algebra.c
        monetdb5/modules/kernel/microbenchmark.c
        monetdb5/modules/mal/mal_mapi.c
        monetdb5/modules/mal/tablet.c
        monetdb5/optimizer/opt_multiplex.c
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_statement.c
        sql/backends/monet5/sql_statement.h
        sql/common/sql_mem.c
        sql/server/rel_select.c
        sql/server/rel_unnest.c
        sql/server/sql_query.c
        sql/server/sql_query.h
        sql/storage/store.c
        sql/test/BugTracker-2010/Tests/new-readonly-db.Bug-2695.stable.err
        sql/test/BugTracker-2014/Tests/inet_error_handling.Bug-3624.stable.err
        sql/test/BugTracker-2015/Tests/float-space-parse.Bug-3691.stable.err
        sql/test/BugTracker-2019/Tests/rank-nan.Bug-6780.sql
        sql/test/BugTracker-2019/Tests/rank-nan.Bug-6780.stable.out
        sql/test/VOC/Tests/VOC.stable.out
        sql/test/analytics/Tests/analytics13.sql
        sql/test/analytics/Tests/analytics13.stable.out
        sql/test/pg_regress/Tests/inet.stable.err
        sql/test/subquery/Tests/subquery5.sql
        sql/test/subquery/Tests/subquery5.stable.err
        sql/test/subquery/Tests/subquery5.stable.out
Branch: default
Log Message:

Merge with Jun2020 branch.


diffs (truncated from 6817 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
@@ -808,6 +808,10 @@
 /* #undef size_t */
 
 #if defined(_MSC_VER) && _MSC_VER < 1900
+/* the Visual Studio 2015 version of snprintf is C99 standard
+ * compliant and different from _snprintf, in older versions, the
+ * functions are the same and return -1 when the buffer is too
+ * small */
 #define snprintf c99_snprintf
 #define vsnprintf c99_vsnprintf
 
diff --git a/clients/Tests/exports.stable.out b/clients/Tests/exports.stable.out
--- a/clients/Tests/exports.stable.out
+++ b/clients/Tests/exports.stable.out
@@ -253,7 +253,6 @@ gdk_return GDKcopyenv(BAT **key, BAT **v
 gdk_return GDKcreatedir(const char *nme);
 gdk_return GDKcreatesem(int id, int count, int *semid);
 int GDKdebug;
-void GDKerror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
 _Noreturn void GDKexit(int status);
 void GDKexit(int status);
 bool GDKexiting(void);
@@ -301,10 +300,9 @@ void GDKsetverbose(int verbosity);
 ssize_t GDKstrFromStr(unsigned char *restrict dst, const unsigned char 
*restrict src, ssize_t len);
 str GDKstrdup(const char *s) __attribute__((__warn_unused_result__));
 str GDKstrndup(const char *s, size_t n) 
__attribute__((__warn_unused_result__));
-void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, ...) 
__attribute__((__format__(__printf__, 1, 2)));
 gdk_return GDKtracer_fill_comp_info(BAT *id, BAT *component, BAT *log_level);
 gdk_return GDKtracer_flush_buffer(void);
-gdk_return GDKtracer_log(const char *file, const char *func, int lineno, 
log_level_t lvl, component_t comp, const char *format, ...) 
__attribute__((__format__(__printf__, 6, 7)));
+void GDKtracer_log(const char *file, const char *func, int lineno, log_level_t 
lvl, component_t comp, const char *syserr, _In_z_ _Printf_format_string_ const 
char *format, ...) __attribute__((__format__(__printf__, 7, 8)));
 void GDKtracer_reinit_basic(int sig);
 gdk_return GDKtracer_reset_adapter(void);
 gdk_return GDKtracer_reset_component_level(const char *comp);
diff --git a/clients/examples/C/smack00.c b/clients/examples/C/smack00.c
--- a/clients/examples/C/smack00.c
+++ b/clients/examples/C/smack00.c
@@ -16,10 +16,6 @@
 #include <string.h>
 #include <mapi.h>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 #define die(dbh,hdl)   do {                                            \
                                if (hdl)                                \
                                        mapi_explain_result(hdl,stderr); \
diff --git a/clients/examples/C/smack01.c b/clients/examples/C/smack01.c
--- a/clients/examples/C/smack01.c
+++ b/clients/examples/C/smack01.c
@@ -16,10 +16,6 @@
 #include <string.h>
 #include <mapi.h>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 #define die(dbh,hdl)   do {                                            \
                                if (hdl)                                \
                                        mapi_explain_result(hdl,stderr); \
diff --git a/clients/mapiclient/mclient.c b/clients/mapiclient/mclient.c
--- a/clients/mapiclient/mclient.c
+++ b/clients/mapiclient/mclient.c
@@ -1957,7 +1957,7 @@ format_result(Mapi mid, MapiHdl hdl, boo
        return rc;
 }
 
-static int
+static bool
 doRequest(Mapi mid, const char *buf)
 {
        MapiHdl hdl;
@@ -1974,26 +1974,25 @@ doRequest(Mapi mid, const char *buf)
                }
                mapi_explain(mid, stderr);
                errseen = true;
-               return 1;
+               return true;
        }
 
        if (mapi_needmore(hdl) == MMORE)
-               return 0;
+               return false;
 
        format_result(mid, hdl, false);
 
        if (mapi_get_active(mid) == NULL)
                mapi_close_handle(hdl);
-       return 0;
+       return errseen;
 }
 
-#define CHECK_RESULT(mid, hdl, break_or_continue, buf, fp)     \
+#define CHECK_RESULT(mid, hdl, buf, fp)                                \
        switch (mapi_error(mid)) {                              \
-       case MOK:                                               \
-               /* everything A OK */                           \
+       case MOK:       /* everything A OK */                   \
                break;                                          \
-       case MERROR:                                            \
-               /* some error, but try to continue */           \
+       case MERROR:    /* some error, but try to continue */   \
+       case MTIMEOUT:  /* lost contact with the server */      \
                if (formatter == TABLEformatter) {              \
                        mapi_noexplain(mid, "");                \
                } else {                                        \
@@ -2006,21 +2005,8 @@ doRequest(Mapi mid, const char *buf)
                } else                                          \
                        mapi_explain(mid, stderr);              \
                errseen = true;                                 \
-               break_or_continue;                              \
-       case MTIMEOUT:                                          \
-               /* lost contact with the server */              \
-               if (formatter == TABLEformatter) {              \
-                       mapi_noexplain(mid, "");                \
-               } else {                                        \
-                       mapi_noexplain(mid, NULL);              \
-               }                                               \
-               if (hdl) {                                      \
-                       mapi_explain_query(hdl, stderr);        \
-                       mapi_close_handle(hdl);                 \
-                       hdl = NULL;                             \
-               } else                                          \
-                       mapi_explain(mid, stderr);              \
-               errseen = true;                                 \
+               if (mapi_error(mid) == MERROR)                  \
+                       continue; /* why not in do-while */     \
                timerEnd();                                     \
                if (buf)                                        \
                        free(buf);                              \
@@ -2072,12 +2058,12 @@ doFileBulk(Mapi mid, stream *fp)
                timerResume();
                if (hdl == NULL) {
                        hdl = mapi_query_prep(mid);
-                       CHECK_RESULT(mid, hdl, continue, buf, fp);
+                       CHECK_RESULT(mid, hdl, buf, fp);
                }
 
                assert(hdl != NULL);
                mapi_query_part(hdl, buf, (size_t) length);
-               CHECK_RESULT(mid, hdl, continue, buf, fp);
+               CHECK_RESULT(mid, hdl, buf, fp);
 
                /* if not at EOF, make sure there is a newline in the
                 * buffer */
@@ -2096,14 +2082,14 @@ doFileBulk(Mapi mid, stream *fp)
                    (length > 0 || mapi_query_done(hdl) == MMORE))
                        continue;       /* get more data */
 
-               CHECK_RESULT(mid, hdl, continue, buf, fp);
+               CHECK_RESULT(mid, hdl, buf, fp);
 
                rc = format_result(mid, hdl, false);
 
                if (rc == MMORE && (length > 0 || mapi_query_done(hdl) != MOK))
                        continue;       /* get more data */
 
-               CHECK_RESULT(mid, hdl, continue, buf, fp);
+               CHECK_RESULT(mid, hdl, buf, fp);
 
                mapi_close_handle(hdl);
                hdl = NULL;
@@ -2610,7 +2596,7 @@ doFile(Mapi mid, stream *fp, bool useins
 
                                                hdl = mapi_query(mid, query);
                                                free(query);
-                                               CHECK_RESULT(mid, hdl, 
continue, buf, fp);
+                                               CHECK_RESULT(mid, hdl, buf, fp);
                                                while (fetch_row(hdl) == 3) {
                                                        char *type = 
mapi_fetch_field(hdl, 0);
                                                        char *name = 
mapi_fetch_field(hdl, 1);
@@ -2859,7 +2845,7 @@ doFile(Mapi mid, stream *fp, bool useins
                if (hdl == NULL) {
                        timerStart();
                        hdl = mapi_query_prep(mid);
-                       CHECK_RESULT(mid, hdl, continue, buf, fp);
+                       CHECK_RESULT(mid, hdl, buf, fp);
                } else
                        timerResume();
 
@@ -2868,7 +2854,7 @@ doFile(Mapi mid, stream *fp, bool useins
                if (length > 0) {
                        SQLsetSpecial(line);
                        mapi_query_part(hdl, line, length);
-                       CHECK_RESULT(mid, hdl, continue, buf, fp);
+                       CHECK_RESULT(mid, hdl, buf, fp);
                }
 
                /* If the server wants more but we're at the
@@ -2886,7 +2872,7 @@ doFile(Mapi mid, stream *fp, bool useins
                                continue;       /* done */
                        }
                }
-               CHECK_RESULT(mid, hdl, continue, buf, fp);
+               CHECK_RESULT(mid, hdl, buf, fp);
 
                if (mapi_get_querytype(hdl) == Q_PREPARE) {
                        prepno = mapi_get_tableid(hdl);
@@ -2898,7 +2884,7 @@ doFile(Mapi mid, stream *fp, bool useins
                if (rc == MMORE && (line != NULL || mapi_query_done(hdl) != 
MOK))
                        continue;       /* get more data */
 
-               CHECK_RESULT(mid, hdl, continue, buf, fp);
+               CHECK_RESULT(mid, hdl, buf, fp);
 
                timerEnd();
                mapi_close_handle(hdl);
diff --git a/clients/odbc/samples/arraytest.c b/clients/odbc/samples/arraytest.c
--- a/clients/odbc/samples/arraytest.c
+++ b/clients/odbc/samples/arraytest.c
@@ -19,10 +19,6 @@
 #include <sql.h>
 #include <sqlext.h>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 static void
 prerr(SQLSMALLINT tpe, SQLHANDLE hnd, const char *func, const char *pref)
 {
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
@@ -18,10 +18,6 @@
 #include <sql.h>
 #include <sqlext.h>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 static void
 prerr(SQLSMALLINT tpe, SQLHANDLE hnd, const char *func, const char *pref)
 {
diff --git a/clients/odbc/samples/testStmtAttr.c 
b/clients/odbc/samples/testStmtAttr.c
--- a/clients/odbc/samples/testStmtAttr.c
+++ b/clients/odbc/samples/testStmtAttr.c
@@ -15,10 +15,6 @@
 #include <sql.h>
 #include <sqlext.h>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 static void
 prerr(SQLSMALLINT tpe, SQLHANDLE hnd, const char *func, const char *pref)
 {
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
@@ -21,10 +21,6 @@
 #include <sql.h>
 #include <sqlext.h>
 
-#ifdef _MSC_VER
-#define snprintf _snprintf
-#endif
-
 static void
 prerr(SQLSMALLINT tpe, SQLHANDLE hnd, const char *func, const char *pref)
 {
diff --git a/gdk/gdk.h b/gdk/gdk.h
--- a/gdk/gdk.h
+++ b/gdk/gdk.h
@@ -1412,10 +1412,17 @@ gdk_export BAT *BBPquickdesc(bat b, bool
 
 /* Data Distilleries uses ICU for internationalization of some MonetDB error 
messages */
 
-gdk_export void GDKerror(_In_z_ _Printf_format_string_ const char *format, ...)
-       __attribute__((__format__(__printf__, 1, 2)));
-gdk_export void GDKsyserror(_In_z_ _Printf_format_string_ const char *format, 
...)
-       __attribute__((__format__(__printf__, 1, 2)));
+#include "gdk_tracer.h"
+
+#define GDKerror(format, ...)                                  \
+       GDKtracer_log(__FILE__, __func__, __LINE__, M_ERROR,    \
+                     GDK, NULL, format, ##__VA_ARGS__)
+#define GDKsyserr(errno, format, ...)                                  \
+       GDKtracer_log(__FILE__, __func__, __LINE__, M_CRITICAL,         \
+                     GDK, GDKstrerror(errno, (char[64]){0}, 64),       \
+                     format, ##__VA_ARGS__)
+#define GDKsyserror(format, ...)       GDKsyserr(errno, format, ##__VA_ARGS__)
+
 #ifndef HAVE_EMBEDDED
 gdk_export _Noreturn void GDKfatal(_In_z_ _Printf_format_string_ const char 
*format, ...)
        __attribute__((__format__(__printf__, 1, 2)));
@@ -1611,7 +1618,7 @@ bunfastappVAR(BAT *b, const void *v)
 {
        if (BATcount(b) >= BATcapacity(b)) {
                if (BATcount(b) == BUN_MAX) {
-                       GDKerror("bunfastapp: too many elements to accommodate 
(" BUNFMT ")\n", BUN_MAX);
+                       GDKerror("too many elements to accommodate (" BUNFMT 
")\n", BUN_MAX);
                        return GDK_FAIL;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to