Changeset: cab067786b00 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/cab067786b00
Modified Files:
        sql/backends/monet5/rel_bin.c
Branch: properties
Log Message:

Merged with default


diffs (115 lines):

diff --git a/sql/backends/monet5/dict.c b/sql/backends/monet5/dict.c
--- a/sql/backends/monet5/dict.c
+++ b/sql/backends/monet5/dict.c
@@ -22,7 +22,6 @@ BATnegateprops(BAT *b)
        b->tnonil = false;
        b->tnil = false;
        b->tsorted = false;
-       b->tsorted = false;
        b->trevsorted = false;
        b->tnosorted = 0;
        b->tnorevsorted = 0;
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
@@ -38,17 +38,22 @@ clean_mal_statements(backend *be, int ol
        be->mvc->errstr[0] = '\0';
 }
 
-static int
+static void
 add_to_rowcount_accumulator(backend *be, int nr)
 {
-       int prev = be->rowcount;
+       if (be->silent)
+               return;
+
+       if (be->rowcount == 0) {
+               be->rowcount = nr;
+               return;
+       }
+
        InstrPtr q = newStmt(be->mb, calcRef, plusRef);
-
-       getArg(q, 0) = be->rowcount = newTmpVariable(be->mb, TYPE_lng);
-       q = pushArgument(be->mb, q, prev);
+       q = pushArgument(be->mb, q, be->rowcount);
        q = pushArgument(be->mb, q, nr);
 
-       return getDestVar(q);
+       be->rowcount = getDestVar(q);
 }
 
 static stmt *
@@ -4381,10 +4386,7 @@ rel2bin_insert(backend *be, sql_rel *rel
                return stmt_list(be, l);
        } else {
                ret = cnt;
-               if (!be->silent) {
-                       /* if there are multiple update statements, update 
total count, otherwise use the the current count */
-                       be->rowcount = be->rowcount ? 
add_to_rowcount_accumulator(be, ret->nr) : ret->nr;
-               }
+               add_to_rowcount_accumulator(be, ret->nr);
                if (t->s && isGlobal(t) && !isGlobalTemp(t))
                        stmt_add_dependency_change(be, t, ret);
                return ret;
@@ -5242,10 +5244,7 @@ sql_update(backend *be, sql_table *t, st
 
        if (!be->silent || (t->s && isGlobal(t) && !isGlobalTemp(t)))
                cnt = stmt_aggr(be, rows, NULL, NULL, sql_bind_func(sql, "sys", 
"count", sql_bind_localtype("void"), NULL, F_AGGR, true), 1, 0, 1);
-       if (!be->silent) {
-               /* if there are multiple update statements, update total count, 
otherwise use the the current count */
-               be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, 
cnt->nr) : cnt->nr;
-       }
+       add_to_rowcount_accumulator(be, cnt->nr);
        if (t->s && isGlobal(t) && !isGlobalTemp(t))
                stmt_add_dependency_change(be, t, cnt);
 /* cascade ?? */
@@ -5366,10 +5365,7 @@ rel2bin_update(backend *be, sql_rel *rel
                cnt = stmt_list(be, l);
        } else {
                cnt = stmt_aggr(be, tids, NULL, NULL, sql_bind_func(sql, "sys", 
"count", sql_bind_localtype("void"), NULL, F_AGGR, true), 1, 0, 1);
-               if (!be->silent) {
-                       /* if there are multiple update statements, update 
total count, otherwise use the the current count */
-                       be->rowcount = be->rowcount ? 
add_to_rowcount_accumulator(be, cnt->nr) : cnt->nr;
-               }
+               add_to_rowcount_accumulator(be, cnt->nr);
                if (t->s && isGlobal(t) && !isGlobalTemp(t))
                        stmt_add_dependency_change(be, t, cnt);
        }
@@ -5584,10 +5580,7 @@ sql_delete(backend *be, sql_table *t, st
        if (!sql_delete_triggers(be, t, v, deleted_cols, 1, 1, 3))
                return sql_error(sql, 10, SQLSTATE(27000) "DELETE: triggers 
failed for table '%s'", t->base.name);
 
-       if (!be->silent) {
-               /* if there are multiple update statements, update total count, 
otherwise use the the current count */
-               be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, 
s->nr) : s->nr;
-       }
+       add_to_rowcount_accumulator(be, s->nr);
        if (t->s && isGlobal(t) && !isGlobalTemp(t))
                stmt_add_dependency_change(be, t, s);
        return s;
@@ -5754,10 +5747,7 @@ sql_truncate(backend *be, sql_table *t, 
                        goto finalize;
                }
 
-               if (!be->silent) {
-                       /* if there are multiple update statements, update 
total count, otherwise use the the current count */
-                       be->rowcount = be->rowcount ? 
add_to_rowcount_accumulator(be, other->nr) : other->nr;
-               }
+               add_to_rowcount_accumulator(be, other->nr);
                if (next->s && isGlobal(next) && !isGlobalTemp(next))
                        stmt_add_dependency_change(be, next, other);
        }
@@ -5834,10 +5824,7 @@ rel2bin_output(backend *be, sql_rel *rel
        } else {
                res = stmt_atom_lng(be, 1);
        }
-       if (!be->silent) {
-               /* if there are multiple output statements, update total count, 
otherwise use the the current count */
-               be->rowcount = be->rowcount ? add_to_rowcount_accumulator(be, 
res->nr) : res->nr;
-       }
+       add_to_rowcount_accumulator(be, res->nr);
        return res;
 }
 
_______________________________________________
checkin-list mailing list -- checkin-list@monetdb.org
To unsubscribe send an email to checkin-list-le...@monetdb.org

Reply via email to