Changeset: 87d36682f889 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=87d36682f889
Modified Files:
        sql/backends/monet5/sql_result.c
        sql/storage/bat/res_table.c
Branch: embedded
Log Message:

fix for single row result sets


diffs (35 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
@@ -1881,9 +1881,8 @@ mvc_export_result(backend *b, stream *s,
        if (!json) {
                mvc_export_head(b, s, res_id, TRUE);
        }
+       assert(t->order);
 
-       if (!t->order)
-               return mvc_export_row(b, s, t, "[ ", ",\t", "\t]\n", "\"", 
"NULL");
        order = BATdescriptor(t->order);
        if (!order)
                return -1;
diff --git a/sql/storage/bat/res_table.c b/sql/storage/bat/res_table.c
--- a/sql/storage/bat/res_table.c
+++ b/sql/storage/bat/res_table.c
@@ -70,6 +70,17 @@ res_col_create(sql_trans *tr, res_table 
                BATsetcount(b, 1);
                BATseqbase(b, 0);
                BATsettrivprop(b);
+               /* we need to set the order bat otherwise mvc_export_result 
won't work with single-row result sets containing BATs */
+               if (!t->order) {
+                       oid zero = 0;
+                       BAT *o = BATnew(TYPE_void, TYPE_oid, 0, TRANSIENT);
+                       BUNappend(o, &zero, FALSE);
+                       BATsetcount(o, 1);
+                       BATseqbase(o, 0);
+                       BATsettrivprop(o);
+                       t->order = o->batCacheid;
+                       bat_incref(t->order);
+               }
        }
        c->b = b->batCacheid;
        bat_incref(c->b);
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to