Changeset: 6960a147010b for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/6960a147010b
Branch: unlogged
Log Message:
Merge 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 *
@@ -4380,10 +4385,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;
@@ -5241,10 +5243,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 ?? */
@@ -5365,10 +5364,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);
}
@@ -5583,10 +5579,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;
@@ -5753,10 +5746,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);
}
@@ -5833,10 +5823,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 -- [email protected]
To unsubscribe send an email to [email protected]