Changeset: c7e8dcf7e144 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/c7e8dcf7e144
Modified Files:
sql/backends/monet5/rel_bin.c
sql/storage/bat/bat_storage.c
Branch: nested
Log Message:
implemented truncate on nested tables
diffs (57 lines):
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
@@ -7881,6 +7881,21 @@ sql_truncate(backend *be, sql_table *t,
{
mvc *sql = be->mvc;
list *l = sa_list(sql->sa);
+ if (t->multiset) {
+ for (node *n = t->columns->l->h; n; n = n->next) {
+ sql_column *c = n->data;
+
+ if (c->type.multiset) {
+ sql_table *st = mvc_bind_table(sql, c->t->s,
c->storage_type);
+ if (st) {
+ stmt *trunc = sql_truncate(be, st,
restart_sequences, cascade);
+ if (!trunc)
+ return trunc;
+ append(l, trunc);
+ }
+ }
+ }
+ }
stmt *ret = NULL, *other = NULL;
struct tablelist *new_list = SA_NEW(sql->ta, struct tablelist);
stmt **deleted_cols = NULL;
diff --git a/sql/storage/bat/bat_storage.c b/sql/storage/bat/bat_storage.c
--- a/sql/storage/bat/bat_storage.c
+++ b/sql/storage/bat/bat_storage.c
@@ -3873,12 +3873,16 @@ static BUN
clear_table(sql_trans *tr, sql_table *t)
{
node *n = ol_first_node(t->columns);
- sql_column *c = n->data;
storage *d = tab_timestamp_storage(tr, t);
int in_transaction, clear;
BUN sz, clear_ok;
- if (!d)
+ sql_column *c = n->data;
+ while (c && c->type.type->composite && !c->type.multiset) {
+ n = n->next;
+ c = n?n->data:NULL;
+ }
+ if (!d || !c)
return BUN_NONE;
lock_table(tr->store, t->base.id);
in_transaction = segments_in_transaction(tr, t);
@@ -3894,6 +3898,9 @@ clear_table(sql_trans *tr, sql_table *t)
for (; n; n = n->next) {
c = n->data;
+ if (c->type.type->composite && !c->type.multiset)
+ continue;
+
if ((clear_ok = clear_col(tr, c, clear)) >= BUN_NONE - 1)
return clear_ok;
}
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]