Changeset: 4615a9380486 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=4615a9380486
Modified Files:
        sql/backends/monet5/sql_result.c
Branch: default
Log Message:

Plug the holes


diffs (97 lines):

diff --git a/sql/backends/monet5/sql_result.c b/sql/backends/monet5/sql_result.c
--- a/sql/backends/monet5/sql_result.c
+++ b/sql/backends/monet5/sql_result.c
@@ -934,10 +934,13 @@ mvc_export_prepare_columnar(stream *out,
        BAT* bschema    = COLnew(0, TYPE_str, nrows, TRANSIENT);
        BAT* btable             = COLnew(0, TYPE_str, nrows, TRANSIENT);
        BAT* bcolumn    = COLnew(0, TYPE_str, nrows, TRANSIENT);
-
        node *n;
        sql_subtype *t;
        sql_arg *a;
+
+       if (!btype || !bdigits || !bscale || !bschema || !btable || !bcolumn)
+               goto bailout;
+
        if (r && is_project(r->op) && r->exps) {
                for (n = r->exps->h; n; n = n->next) {
                        const char *name, *rname, *schema = NULL;
@@ -1095,9 +1098,10 @@ mvc_export_prepare(backend *b, stream *o
        }
 
        if (b->client->protocol == PROTOCOL_COLUMNAR) {
-               if (mnstr_flush(out, MNSTR_FLUSH_DATA) < 0) return -1;
-               mvc_export_prepare_columnar(out, q, nrows, r);
-
+               if (mnstr_flush(out, MNSTR_FLUSH_DATA) < 0)
+                       return -1;
+               if (mvc_export_prepare_columnar(out, q, nrows, r) < 0)
+                       return -1;
        }
        else {
                if (r && is_project(r->op) && r->exps) {
@@ -1384,11 +1388,9 @@ mvc_export_row(backend *b, stream *s, re
 }
 
 static int
-mvc_export_table_columnar(stream *s, res_table *t, BAT *order) {
+mvc_export_table_columnar(stream *s, res_table *t) {
        int i;
 
-       (void) order;
-
        if (!t)
                return -1;
        if (!s)
@@ -1400,12 +1402,9 @@ mvc_export_table_columnar(stream *s, res
                if (!c->b)
                        break;
 
-               BAT* b = BATdescriptor(c->b);
-               if (b == NULL) {
-                       while (--i >= 1)
-                               BBPunfix(b->batCacheid);
+               BAT *b = BATdescriptor(c->b);
+               if (b == NULL)
                        return -1;
-               }
 
                mvc_export_binary_bat(s, b);
 
@@ -1979,26 +1978,29 @@ mvc_export_result(backend *b, stream *s,
        if (t->tsep) {
                if (header) {
                        /* need header */
-                       mvc_export_head(b, s, t->id, TRUE, TRUE, starttime, 
maloptimizer);
+                       if (mvc_export_head(b, s, t->id, TRUE, TRUE, starttime, 
maloptimizer) < 0)
+                               return -1;
                }
                return mvc_export_file(b, s, t);
        }
 
        if (!json) {
-               mvc_export_head(b, s, res_id, TRUE, TRUE, starttime, 
maloptimizer);
+               if (mvc_export_head(b, s, res_id, TRUE, TRUE, starttime, 
maloptimizer) < 0)
+                       return -1;
        }
 
        assert(t->order);
 
+       if (b->client->protocol == PROTOCOL_COLUMNAR) {
+               if (mnstr_flush(s, MNSTR_FLUSH_DATA) < 0)
+                       return -1;
+               return mvc_export_table_columnar(s, t);
+       }
+
        order = BATdescriptor(t->order);
        if (!order)
                return -1;
 
-       if (b->client->protocol == PROTOCOL_COLUMNAR) {
-               if (mnstr_flush(s, MNSTR_FLUSH_DATA) < 0) return -1;
-               return mvc_export_table_columnar(s, t, order);
-       }
-
        count = m->reply_size;
        if (m->reply_size != -2 && (count <= 0 || count >= t->nr_rows)) {
                count = t->nr_rows;
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to