Update of /cvsroot/monetdb/sql/src/storage/bat
In directory sc8-pr-cvs16:/tmp/cvs-serv29004/src/storage/bat
Modified Files:
bat_store.mx
Log Message:
fix problems temporary tables. (we wrote after the table was removed)
also cleaned up the code for keeping the list of dropped objects
Index: bat_store.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/storage/bat/bat_store.mx,v
retrieving revision 1.135
retrieving revision 1.136
diff -u -d -r1.135 -r1.136
--- bat_store.mx 8 May 2007 08:25:52 -0000 1.135
+++ bat_store.mx 10 May 2007 07:43:57 -0000 1.136
@@ -3248,9 +3248,9 @@
cs_add(ts, r, TR_NEW);
else
ok = LOG_ERR;
+ fb->rtime = fb->wtime = 0;
+ fb->flag = TR_OLD;
}
- fb->rtime = fb->wtime = 0;
- fb->flag = TR_OLD;
n = nxt;
}
fs -> nelm = NULL;
@@ -4911,13 +4911,13 @@
{
node *n = find_sql_func_node(s, NULL, id);
sql_func *func = n->data;
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &func->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
if (! tr->dropped)
- tr->dropped = list_create((fdestroy) NULL);
-
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = func->base.id;
list_append(tr->dropped, local_id);
}
@@ -4939,18 +4939,19 @@
{
node *n = NULL;
sql_func *func = NULL;
- tr->dropped = list_create((fdestroy) NULL);
+ if (!tr->dropped)
+ tr->dropped = list_create((fdestroy) GDKfree);
for (n = list_func->h; n ; n = n->next ) {
- int *local_id = GDKmalloc(sizeof(int));
func = (sql_func *) n->data;
- memcpy(local_id, &func->base.id, sizeof(int));
- if (! list_find_id(tr->dropped, *local_id)){
+ if (! list_find_id(tr->dropped, func->base.id)){
+ int *local_id = NEW(int);
+
+ *local_id = func->base.id;
list_append(tr->dropped, local_id);
sql_trans_drop_func(tr, s, func->base.id, drop_action ?
DROP_CASCADE : DROP_RESTRICT);
}
-
}
if ( tr->dropped) {
@@ -4991,16 +4992,15 @@
sql_schema *s = n->data;
sql_table *sysschema = find_sql_table(find_sql_schema(tr, "sys"),
"schemas");
ssize_t rid = column_find_row(tr, find_sql_column(sysschema, "id"),
&s->base.id, NULL);
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &s->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
if (! tr->dropped)
- tr->dropped = list_create((fdestroy) NULL);
-
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = s->base.id;
list_append(tr->dropped, local_id);
}
-
assert(rid != -1);
table_delete(tr, sysschema, rid);
@@ -5138,16 +5138,15 @@
{
node *n = find_sql_table_node(s, NULL, id);
sql_table *t = n->data;
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &t->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
if (! tr->dropped)
- tr->dropped = list_create((fdestroy) NULL);
-
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = t->base.id;
list_append(tr->dropped, local_id);
}
-
sys_drop_table(tr, t, drop_action);
@@ -5312,13 +5311,13 @@
{
node *n = list_find_base_id(t->columns.set, id);
sql_column *col = n->data;
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &col->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
if (! tr->dropped)
- tr->dropped = list_create((fdestroy) NULL);
-
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = col->base.id;
list_append(tr->dropped, local_id);
}
@@ -5536,13 +5535,13 @@
{
node *n = list_find_base_id(s->keys, id);
sql_key *k = n->data;
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &k->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
if (! tr->dropped)
- tr->dropped = list_create((fdestroy) NULL);
-
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = k->base.id;
list_append(tr->dropped, local_id);
}
@@ -5652,13 +5651,13 @@
{
node *n = list_find_base_id(s->idxs, id);
sql_idx *i = n->data;
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &i->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
if (! tr->dropped)
- tr->dropped = list_create((fdestroy) NULL);
-
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = i->base.id;
list_append(tr->dropped, local_id);
}
@@ -5740,15 +5739,16 @@
{
node *n = list_find_base_id(s->triggers, id);
sql_trigger *i = n->data;
- int *local_id = GDKmalloc(sizeof(int));
- memcpy(local_id, &i->base.id, sizeof(int));
if (drop_action == DROP_CASCADE_START || drop_action == DROP_CASCADE) {
+ int *local_id = NEW(int);
+
+ if (! tr->dropped)
+ tr->dropped = list_create((fdestroy) GDKfree);
+ *local_id = i->base.id;
list_append(tr->dropped, local_id);
}
-
-
sys_drop_trigger(tr, i);
i->base.wtime = i->t->base.wtime = s->base.wtime = tr->wtime =
tr->stime;
if (isGlobalTable(i->t))
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins