Changeset: b675c5d958e2 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b675c5d958e2
Modified Files:
sql/backends/monet5/datacell/basket.c
sql/backends/monet5/datacell/basket.h
sql/backends/monet5/datacell/datacell.mal
sql/backends/monet5/datacell/petrinet.c
sql/backends/monet5/datacell/petrinet.h
Branch: default
Log Message:
Fix calling of SQL table creating functions
The operations datacell.baskets(), datacell.queries() and datacell.errors()
now follow the protocal for table producing functions.
diffs (217 lines):
diff --git a/sql/backends/monet5/datacell/basket.c
b/sql/backends/monet5/datacell/basket.c
--- a/sql/backends/monet5/datacell/basket.c
+++ b/sql/backends/monet5/datacell/basket.c
@@ -567,17 +567,13 @@ BSKTbeat(int *ret, str *tbl, int *sz)
/* provide a tabular view for inspection */
str
-BSKTtable(int *ret)
+BSKTtable(int *nameId, int *thresholdId, int * winsizeId, int *winstrideId,int
*timesliceId, int *timestrideId, int *beatId, int *seenId, int *grabsId, int
*eventsId)
{
- BAT *bn = NULL, *name = NULL, *seen = NULL, *events = NULL, *grabs =
NULL;
+ BAT *name = NULL, *seen = NULL, *events = NULL, *grabs = NULL;
BAT *threshold = NULL, *winsize = NULL, *winstride = NULL, *beat = NULL;
BAT *timeslice = NULL, *timestride = NULL;
int i;
- bn = BATnew(TYPE_str, TYPE_bat, BATTINY);
- if ( bn == 0)
- throw(MAL,"dictionary.baskets",MAL_MALLOC_FAIL);
-
name = BATnew(TYPE_oid,TYPE_str, BATTINY);
if ( name == 0 ) goto wrapup;
BATseqbase(name,0);
@@ -623,32 +619,18 @@ BSKTtable(int *ret)
BUNappend(timeslice, &baskets[i].timeslice, FALSE);
BUNappend(timestride, &baskets[i].timestride, FALSE);
}
- BUNins(bn,"nme", & name->batCacheid, FALSE);
- BUNins(bn,"threshold", & threshold->batCacheid, FALSE);
- BUNins(bn,"winsize", & winsize->batCacheid, FALSE);
- BUNins(bn,"winstride", & winstride->batCacheid, FALSE);
- BUNins(bn,"timeslice", & winsize->batCacheid, FALSE);
- BUNins(bn,"timestride", & winstride->batCacheid, FALSE);
- BUNins(bn,"beat", & beat->batCacheid, FALSE);
- BUNins(bn,"seen", & seen->batCacheid, FALSE);
- BUNins(bn,"grabs", & grabs->batCacheid, FALSE);
- BUNins(bn,"events", & events->batCacheid, FALSE);
-
- *ret = bn->batCacheid;
- BBPkeepref(bn->batCacheid);
- BBPkeepref(name->batCacheid);
- BBPkeepref(threshold->batCacheid);
- BBPkeepref(winsize->batCacheid);
- BBPkeepref(winstride->batCacheid);
- BBPkeepref(timeslice->batCacheid);
- BBPkeepref(timestride->batCacheid);
- BBPkeepref(beat->batCacheid);
- BBPkeepref(seen->batCacheid);
- BBPkeepref(grabs->batCacheid);
- BBPkeepref(events->batCacheid);
+ BBPkeepref(*nameId = name->batCacheid);
+ BBPkeepref(*thresholdId = threshold->batCacheid);
+ BBPkeepref(*winsizeId = winsize->batCacheid);
+ BBPkeepref(*winstrideId =winstride->batCacheid);
+ BBPkeepref(*timesliceId = timeslice->batCacheid);
+ BBPkeepref(*timestrideId = timestride->batCacheid);
+ BBPkeepref(*beatId = beat->batCacheid);
+ BBPkeepref(*seenId = seen->batCacheid);
+ BBPkeepref(*grabsId = grabs->batCacheid);
+ BBPkeepref(*eventsId = events->batCacheid);
return MAL_SUCCEED;
wrapup:
- if ( bn) BBPreleaseref(bn->batCacheid);
if ( name) BBPreleaseref(name->batCacheid);
if ( threshold) BBPreleaseref(threshold->batCacheid);
if ( winsize) BBPreleaseref(winsize->batCacheid);
@@ -663,23 +645,17 @@ wrapup:
}
str
-BSKTtableerrors(int *ret)
+BSKTtableerrors(int *nameId, int *errorId)
{
- BAT *bn, *name, *error;
+ BAT *name, *error;
BATiter bi;
BUN p,q;
int i;
- bn = BATnew(TYPE_str,TYPE_bat, BATTINY);
- if ( bn == 0)
+ name = BATnew(TYPE_void, TYPE_str, BATTINY);
+ if ( name == 0)
throw(SQL,"baskets.errors", MAL_MALLOC_FAIL);
- name = BATnew(TYPE_void, TYPE_str, BATTINY);
- if ( name == 0){
- BBPreleaseref(bn->batCacheid);
- throw(SQL,"baskets.errors", MAL_MALLOC_FAIL);
- }
error = BATnew(TYPE_void, TYPE_str, BATTINY);
if ( error == 0) {
- BBPreleaseref(bn->batCacheid);
BBPreleaseref(name->batCacheid);
throw(SQL,"baskets.errors", MAL_MALLOC_FAIL);
}
@@ -694,11 +670,7 @@ BSKTtableerrors(int *ret)
}
}
- BUNins(bn,"nme", &name->batCacheid, FALSE);
- BUNins(bn,"error", &error->batCacheid, FALSE);
- *ret = bn->batCacheid;
- BBPkeepref(bn->batCacheid);
- BBPkeepref(name->batCacheid);
- BBPkeepref(error->batCacheid);
+ BBPkeepref(*nameId = name->batCacheid);
+ BBPkeepref(*errorId = error->batCacheid);
return MAL_SUCCEED;
}
diff --git a/sql/backends/monet5/datacell/basket.h
b/sql/backends/monet5/datacell/basket.h
--- a/sql/backends/monet5/datacell/basket.h
+++ b/sql/backends/monet5/datacell/basket.h
@@ -72,8 +72,8 @@ datacell_export str BSKTthreshold(int *r
datacell_export str BSKTbeat(int *ret, str *tbl, int *sz);
datacell_export str BSKTwindow(int *ret, str *tbl, int *sz, int *slide);
datacell_export str BSKTtimewindow(int *ret, str *tbl, int *sz, int *slide);
-datacell_export str BSKTtable(int *ret);
-datacell_export str BSKTtableerrors(int *ret);
+datacell_export str BSKTtable(int *nameId, int *thresholdId, int * winsizeId,
int *winstrideId,int *timesliceId, int *timestrideId, int *beatId, int *seenId,
int *grabsId, int *eventsId);
+datacell_export str BSKTtableerrors(int *nmeId, int *errorId);
datacell_export str BSKTlock(int *ret, str *tbl, int *delay);
datacell_export str BSKTunlock(int *ret, str *tbl);
diff --git a/sql/backends/monet5/datacell/datacell.mal
b/sql/backends/monet5/datacell/datacell.mal
--- a/sql/backends/monet5/datacell/datacell.mal
+++ b/sql/backends/monet5/datacell/datacell.mal
@@ -93,16 +93,17 @@ command beat(bskt:str, t:int):bit
address DCbeat
comment "Schedule query with T milliseconds interval";
-command baskets():bat[:str,:bat]
+command baskets()(nme:bat[:oid,:str], threshold:bat[:oid,:int],
winsize:bat[:oid,:int], winstride:bat[:oid,:int], timeslice:bat[:oid,:int],
+timestride:bat[:oid,:int], beat:bat[:oid,:int], seen:bat[:oid,:timestamp],
grabs:bat[:oid,:int], events:bat[:oid,:int])
address BSKTtable
comment "Inspect the datacell baskets";
-command queries():bat[:str,:bat]
+command queries()(nme:bat[:oid,:str], status:bat[:oid,:str],
seen:bat[:oid,:timestamp], cycles:bat[:oid,:int], events:bat[:oid,:int],
time:bat[:oid,:lng], error:bat[:oid,:str], def:bat[:oid,:str])
address PNtable
-comment "Inspect the datacell queries";
+comment "Return a table with queries registered";
-command errors():bat[:str,:bat]
+command errors()(nme:bat[:oid,:str],error:bat[:oid,:str])
address BSKTtableerrors
-comment "Inspect the erroneous events";
+comment "Return a table the erroneous events";
datacell.prelude();
diff --git a/sql/backends/monet5/datacell/petrinet.c
b/sql/backends/monet5/datacell/petrinet.c
--- a/sql/backends/monet5/datacell/petrinet.c
+++ b/sql/backends/monet5/datacell/petrinet.c
@@ -612,15 +612,11 @@ static str PNstart(int *ret)
/* inspection routines */
str
-PNtable(int *ret)
+PNtable(int *nameId, int *statusId, int *seenId, int *cyclesId, int *eventsId,
int *timeId, int * errorId, int *defId)
{
- BAT *bn = NULL, *name = NULL, *def = NULL, *status = NULL, *seen =
NULL, *cycles = NULL, *events = NULL, *time = NULL, *error = NULL;
+ BAT *name = NULL, *def = NULL, *status = NULL, *seen = NULL, *cycles =
NULL, *events = NULL, *time = NULL, *error = NULL;
int i;
- bn = BATnew(TYPE_str, TYPE_bat, BATTINY);
- if ( bn == 0)
- throw(MAL,"dictionary.baskets",MAL_MALLOC_FAIL);
-
name = BATnew(TYPE_oid,TYPE_str, BATTINY);
if ( name == 0 ) goto wrapup;
BATseqbase(name,0);
@@ -656,28 +652,16 @@ PNtable(int *ret)
BUNappend(time, &pnet[i].time, FALSE);
BUNappend(error, (pnet[i].error ? pnet[i].error:""), FALSE);
}
- BUNins(bn,"nme", & name->batCacheid, FALSE);
- BUNins(bn,"status", & status->batCacheid, FALSE);
- BUNins(bn,"seen", & seen->batCacheid, FALSE);
- BUNins(bn,"cycles", & cycles->batCacheid, FALSE);
- BUNins(bn,"events", & events->batCacheid, FALSE);
- BUNins(bn,"time", & time->batCacheid, FALSE);
- BUNins(bn,"error", & error->batCacheid, FALSE);
- BUNins(bn,"def", & def->batCacheid, FALSE);
-
- *ret = bn->batCacheid;
- BBPkeepref(bn->batCacheid);
- BBPreleaseref(name->batCacheid);
- BBPreleaseref(def->batCacheid);
- BBPreleaseref(status->batCacheid);
- BBPreleaseref(seen->batCacheid);
- BBPreleaseref(cycles->batCacheid);
- BBPreleaseref(events->batCacheid);
- BBPreleaseref(time->batCacheid);
- BBPreleaseref(error->batCacheid);
+ BBPkeepref(*nameId = name->batCacheid);
+ BBPkeepref(*defId = def->batCacheid);
+ BBPkeepref(*statusId =status->batCacheid);
+ BBPkeepref(*seenId =seen->batCacheid);
+ BBPkeepref(*cyclesId = cycles->batCacheid);
+ BBPkeepref(*eventsId = events->batCacheid);
+ BBPkeepref(*timeId = time->batCacheid);
+ BBPkeepref(*errorId = error->batCacheid);
return MAL_SUCCEED;
wrapup:
- if ( bn) BBPreleaseref(bn->batCacheid);
if ( name) BBPreleaseref(name->batCacheid);
if ( def) BBPreleaseref(def->batCacheid);
if ( status) BBPreleaseref(status->batCacheid);
diff --git a/sql/backends/monet5/datacell/petrinet.h
b/sql/backends/monet5/datacell/petrinet.h
--- a/sql/backends/monet5/datacell/petrinet.h
+++ b/sql/backends/monet5/datacell/petrinet.h
@@ -51,6 +51,6 @@ datacell_export str PNsource(int *ret, s
datacell_export str PNtarget(int *ret, str *fcn, str *tbl);
datacell_export str PNanalysis(Client cntxt, MalBlkPtr mb);
datacell_export str PNanalyseWrapper(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr pci);
-datacell_export str PNtable(int *ret);
+datacell_export str PNtable(int *nameId, int *statusId, int *seenId, int
*cyclesId, int *eventsId, int *timeId, int * errorId, int *defId);
#endif
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list