Changeset: 09810e47f86b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=09810e47f86b
Modified Files:
        gdk/gdk_logger.c
        gdk/gdk_logger.h
        monetdb5/mal/mal.c
        monetdb5/mal/mal.h
        sql/backends/monet5/sql_cquery.c
        sql/backends/monet5/sql_cquery.h
Branch: trails
Log Message:

Fixed some error messages and function pointer issue on Windows compilation


diffs (157 lines):

diff --git a/gdk/gdk_logger.c b/gdk/gdk_logger.c
--- a/gdk/gdk_logger.c
+++ b/gdk/gdk_logger.c
@@ -2893,3 +2893,19 @@ int geomversion_get(void)
 {
        return geomisoldversion;
 }
+
+/* for timetrails */
+
+static cqfix_fptr cqfix = NULL;
+
+void
+cqfix_set(cqfix_fptr f)
+{
+       cqfix = f;
+}
+
+cqfix_fptr
+cqfix_get(void)
+{
+       return cqfix;
+}
diff --git a/gdk/gdk_logger.h b/gdk/gdk_logger.h
--- a/gdk/gdk_logger.h
+++ b/gdk/gdk_logger.h
@@ -144,4 +144,9 @@ gdk_export geomsqlfix_fptr geomsqlfix_ge
 gdk_export void geomversion_set(void);
 gdk_export int geomversion_get(void);
 
+/* for timetrails */
+typedef void (*cqfix_fptr)(void);
+gdk_export void cqfix_set(cqfix_fptr);
+gdk_export cqfix_fptr cqfix_get(void);
+
 #endif /*_LOGGER_H_*/
diff --git a/monetdb5/mal/mal.c b/monetdb5/mal/mal.c
--- a/monetdb5/mal/mal.c
+++ b/monetdb5/mal/mal.c
@@ -15,7 +15,6 @@ size_t        monet_memory = 0;
 char   monet_characteristics[PATHLENGTH];
 int            mal_trace;              /* enable profile events on console */
 str     mal_session_uuid;   /* unique marker for the session */
-void   (*cq_close)(void) = NULL;
 
 #ifdef HAVE_HGE
 int have_hge;
@@ -125,9 +124,9 @@ int mal_init(void){
 void mserver_reset(int exit)
 {
        str err = 0;
-
-       if(cq_close) {
-               cq_close();
+       cqfix_fptr fcqfix;
+       if((fcqfix = cqfix_get()) != NULL) {
+               fcqfix();
        }
        GDKprepareExit();
        WLCreset();
diff --git a/monetdb5/mal/mal.h b/monetdb5/mal/mal.h
--- a/monetdb5/mal/mal.h
+++ b/monetdb5/mal/mal.h
@@ -15,6 +15,7 @@
 #define _MAL_H
 
 #include <gdk.h>
+#include <gdk_logger.h>
 
 #ifdef WIN32
 #if !defined(LIBMAL) && !defined(LIBATOMS) && !defined(LIBKERNEL) && 
!defined(LIBMAL) && !defined(LIBOPTIMIZER) && !defined(LIBSCHEDULER) && 
!defined(LIBMONETDB5)
@@ -53,7 +54,6 @@ mal_export lng                memorypool;      /* mem
 mal_export int                 memoryclaims;    /* number of threads active 
with expensive operations */
 mal_export int         mal_trace;              /* enable profile events on 
console */
 mal_export str         mal_session_uuid;       /* unique marker for the 
session */
-mal_export void                (*cq_close)(void);      /* Sorry but for now we 
need this for timetrails */
 #ifdef HAVE_HGE
 mal_export int have_hge;
 #endif
diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c
--- a/sql/backends/monet5/sql_cquery.c
+++ b/sql/backends/monet5/sql_cquery.c
@@ -65,7 +65,6 @@ static BAT *CQ_id_time = 0;
 static BAT *CQ_id_error = 0;
 static BAT *CQ_id_stmt = 0;
 
-void (*cq_close)(void);
 CQnode *pnet;
 int pnetLimit, pnettop;
 
@@ -645,12 +644,12 @@ CQresumeInternal(Client cntxt, MalBlkPtr
        }
        if( idx == pnettop) {
                msg = createException(SQL, "cquery.resume",
-                                                         SQLSTATE(42000) "The 
continuous %s %s has not yet started\n", mb2str, err_message);
+                                                         SQLSTATE(42000) "The 
continuous %s %s has not yet started\n", err_message, mb2str);
                goto unlock;
        }
        if( pnet[idx].status != CQPAUSE) {
                msg = createException(SQL, "cquery.resume",
-                                                         SQLSTATE(42000) "The 
continuous %s %s is already running\n", mb2str, err_message);
+                                                         SQLSTATE(42000) "The 
continuous %s %s is already running\n", err_message, mb2str);
                goto unlock;
        }
        if(with_alter && heartbeats != NO_HEARTBEAT) {
@@ -778,12 +777,12 @@ CQpauseInternal(MalBlkPtr mb, char* err_
        }
        if( idx == pnettop) {
                msg = createException(SQL, "cquery.pause",
-                                                         SQLSTATE(42000) "The 
continuous %s %s has not yet started\n", mb2str, err_message);
+                                                         SQLSTATE(42000) "The 
continuous %s %s has not yet started\n", err_message, mb2str);
                goto finish;
        }
        if( pnet[idx].status == CQPAUSE) {
                msg = createException(SQL, "cquery.pause",
-                                                         SQLSTATE(42000) "The 
continuous %s %s is already paused\n", mb2str, err_message);
+                                                         SQLSTATE(42000) "The 
continuous %s %s is already paused\n", err_message, mb2str);
                goto finish;
        }
        // actually wait if the query was running
@@ -981,7 +980,7 @@ CQderegisterInternal(MalBlkPtr mb, char*
        }
        if(idx == pnettop) {
                msg = createException(SQL, "cquery.deregister",
-                                                         SQLSTATE(42000) "The 
continuous %s %s has not yet started\n", mb2str, err_message);
+                                                         SQLSTATE(42000) "The 
continuous %s %s has not yet started\n", err_message, mb2str);
                goto finish;
        }
        pnet[idx].status = CQSTOP;
@@ -1390,7 +1389,6 @@ CQreset(void)
        pnet = NULL;
        MT_lock_destroy(&ttrLock);
        (void) BSKTshutdown(); //this must be last!!
-       cq_close = NULL; //avoid a second call!
 }
 
 str
@@ -1403,7 +1401,7 @@ CQprelude(void *ret)
        pnettop = 0;
        if(pnet == NULL)
                throw(MAL, "cquery.prelude",SQLSTATE(HY001) MAL_MALLOC_FAIL);
-       cq_close = CQreset;
+       cqfix_set(CQreset);
        printf("# MonetDB/Timetrails module loaded\n");
        return MAL_SUCCEED;
 }
diff --git a/sql/backends/monet5/sql_cquery.h b/sql/backends/monet5/sql_cquery.h
--- a/sql/backends/monet5/sql_cquery.h
+++ b/sql/backends/monet5/sql_cquery.h
@@ -62,7 +62,6 @@ typedef struct {
        lng time;
 } CQnode;
 
-sql5_export void (*cq_close)(void);
 sql5_export CQnode *pnet;
 sql5_export int pnetLimit, pnettop;
 
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to