Changeset: 78d35aa7826d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=78d35aa7826d
Modified Files:
        sql/backends/monet5/mal_backend.c
        sql/backends/monet5/mal_backend.h
        sql/backends/monet5/rel_bin.c
        sql/backends/monet5/sql_execute.c
        sql/backends/monet5/sql_gencode.c
Branch: merge-partitions
Log Message:

Merge with default.


diffs (111 lines):

diff --git a/sql/backends/monet5/mal_backend.c 
b/sql/backends/monet5/mal_backend.c
--- a/sql/backends/monet5/mal_backend.c
+++ b/sql/backends/monet5/mal_backend.c
@@ -15,6 +15,7 @@ backend_reset(backend *b)
 {
        b->out = b->client->fdout;
        b->language = 0;
+       b->depth = 0;
 
        b->vtop = 0;
        b->q = NULL;
diff --git a/sql/backends/monet5/mal_backend.h 
b/sql/backends/monet5/mal_backend.h
--- a/sql/backends/monet5/mal_backend.h
+++ b/sql/backends/monet5/mal_backend.h
@@ -36,8 +36,9 @@ typedef enum output_format {
  * generated or not */
 
 typedef struct backend {
-       int     console;
+       char    console;
        char    language;               /* 'S' or 's' or 'X' */
+       char    depth;
        bit             first_statement_generated;
        mvc     *mvc;
        stream  *out;
diff --git a/sql/backends/monet5/rel_bin.c b/sql/backends/monet5/rel_bin.c
--- a/sql/backends/monet5/rel_bin.c
+++ b/sql/backends/monet5/rel_bin.c
@@ -2988,6 +2988,7 @@ sql_parse(backend *be, sql_allocator *sa
 
        m->caching = 0;
        m->emode = mode;
+       be->depth++;
 
        b = (buffer*)GDKmalloc(sizeof(buffer));
        if (b == 0)
@@ -3004,10 +3005,12 @@ sql_parse(backend *be, sql_allocator *sa
        buf = buffer_rastream(b, "sqlstatement");
        if(buf == NULL) {
                buffer_destroy(b);
+               be->depth--;
                return sql_error(m, 02, SQLSTATE(HY001) MAL_MALLOC_FAIL);
        }
        if((bst = bstream_create(buf, b->len)) == NULL) {
                close_stream(buf);
+               be->depth--;
                return sql_error(m, 02, SQLSTATE(HY001) MAL_MALLOC_FAIL);
        }
        scanner_init( &m->scanner, bst, NULL);
@@ -3026,6 +3029,7 @@ sql_parse(backend *be, sql_allocator *sa
                GDKfree(query);
                GDKfree(b);
                bstream_destroy(m->scanner.rs);
+               be->depth--;
                return sql_error(m, 02, SQLSTATE(HY001) MAL_MALLOC_FAIL);
        }
 
@@ -3045,6 +3049,7 @@ sql_parse(backend *be, sql_allocator *sa
        GDKfree(query);
        GDKfree(b);
        bstream_destroy(m->scanner.rs);
+       be->depth--;
        if (m->sa && m->sa != sa)
                sa_destroy(m->sa);
        m->sym = NULL;
diff --git a/sql/backends/monet5/sql_execute.c 
b/sql/backends/monet5/sql_execute.c
--- a/sql/backends/monet5/sql_execute.c
+++ b/sql/backends/monet5/sql_execute.c
@@ -491,6 +491,7 @@ SQLstatementIntern(Client c, str *expr, 
        if (!output) {
                sql->output_format = OFMT_NONE;
        }
+       sql->depth++;
        // and do it again
        m->qc = NULL;
        m->caching = 0;
@@ -608,9 +609,11 @@ SQLstatementIntern(Client c, str *expr, 
                mnstr_printf(c->fdout, "#SQLstatement:pre-compile\n");
                printFunction(c->fdout, c->curprg->def, 0, LIST_MAL_NAME | 
LIST_MAL_VALUE  |  LIST_MAL_MAPI);
 #endif
+               be->depth++;
                if (backend_callinline(be, c) < 0 ||
                    backend_dumpstmt(be, c->curprg->def, r, 1, 1, NULL) < 0)
                        err = 1;
+               be->depth--;
 #ifdef _SQL_COMPILE
                mnstr_printf(c->fdout, "#SQLstatement:post-compile\n");
                printFunction(c->fdout, c->curprg->def, 0, LIST_MAL_NAME | 
LIST_MAL_VALUE  |  LIST_MAL_MAPI);
@@ -636,8 +639,10 @@ SQLstatementIntern(Client c, str *expr, 
 
                if (!output)
                        sql->out = NULL;        /* no output stream */
+               be->depth++;
                if (execute)
                        msg = SQLrun(c,be,m);
+               be->depth--;
                MSresetInstructions(c->curprg->def, oldstop);
                freeVariables(c, c->curprg->def, NULL, oldvtop);
 
diff --git a/sql/backends/monet5/sql_gencode.c 
b/sql/backends/monet5/sql_gencode.c
--- a/sql/backends/monet5/sql_gencode.c
+++ b/sql/backends/monet5/sql_gencode.c
@@ -652,7 +652,7 @@ backend_dumpstmt(backend *be, MalBlkPtr 
 
        be->mvc_var = old_mv;
        be->mb = old_mb;
-       if (top && c->caching && (c->type == Q_SCHEMA || c->type == Q_TRANS)) {
+       if (top && c->clientid && !be->depth && (c->type == Q_SCHEMA || c->type 
== Q_TRANS)) {
                q = newStmt(mb, sqlRef, exportOperationRef);
                if (q == NULL)
                        return -1;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to