Changeset: bf7df815817d for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf7df815817d
Modified Files:
Branch: default
Log Message:
merging
diffs (truncated from 369 to 300 lines):
diff --git a/sql/backends/monet5/datacell/50_datacell.sql
b/sql/backends/monet5/datacell/50_datacell.sql
--- a/sql/backends/monet5/datacell/50_datacell.sql
+++ b/sql/backends/monet5/datacell/50_datacell.sql
@@ -36,14 +36,14 @@
create procedure datacell.resume (sch string, tbl string)
external name datacell.resume;
-create procedure datacell.drop (sch string, tbl string)
- external name datacell.drop;
+create procedure datacell.remove (sch string, tbl string)
+ external name datacell.remove;
create procedure datacell.query(sch string, proc string)
- extern name datacell.query;
+ external name datacell.query;
create procedure datacell.run()
- extern name datacell.run;
+ external name datacell.run;
create procedure datacell.stop()
- extern name datacell.stop;
+ external name datacell.stop;
diff --git a/sql/backends/monet5/datacell/Tests/datacell00.sql
b/sql/backends/monet5/datacell/Tests/datacell00.sql
--- a/sql/backends/monet5/datacell/Tests/datacell00.sql
+++ b/sql/backends/monet5/datacell/Tests/datacell00.sql
@@ -1,11 +1,11 @@
#set up the minimal test environment for datacell
create schema datacell;
-create table datacell.X( id int, tag timestamp, payload int);
-create table datacell.Y( id int, tag timestamp, payload int, msdelay int);
+create table datacell.X( id string, tag timestamp, payload int);
+create table datacell.Y( id string, tag timestamp, payload int, msdelay int);
-- the continoues query
-create procedure datacell.tranport()
+create procedure datacell.transport()
begin
-- insert into datacell.Y select *, cast(now() as milliseconds) -
cast(tag as milliseconds) from datacell.X;
insert into datacell.Y select *, 1 from datacell.X;
diff --git a/sql/backends/monet5/datacell/Tests/poc.sql
b/sql/backends/monet5/datacell/Tests/poc.sql
--- a/sql/backends/monet5/datacell/Tests/poc.sql
+++ b/sql/backends/monet5/datacell/Tests/poc.sql
@@ -6,7 +6,7 @@
create schema datacell;
set optimizer='datacell_pipe';
-create table datacell.basket_X(
+create table datacell.sysIn(
id integer auto_increment,
tag timestamp default now(),
payload integer
@@ -14,49 +14,49 @@
-- to be used by continous queries
-- could be generated from the table definition.
-create function datacell.basket_X()
+create function datacell.sysIn()
returns table (id integer, tag timestamp, payload integer)
begin
- return select * from datacell.basket_X;
+ return select * from datacell.sysIn;
end;
-select * from datacell.basket_X();
+select * from datacell.sysIn();
-- to be used by receptor thread
-create function datacell.receptor_X()
+create function datacell.receptor_sysIn()
returns boolean
begin
- insert into datacell.basket_X(payload) values ( 1);
+ insert into datacell.sysIn(payload) values ( 1);
return true;
end;
-call register_basket('datacell.basket_x');
-call register_receptor('datacell.receptor_x','localhost:50100');
-call start_receptor('datacell.receptor_x');
+call datacell.basket('datacell','sysIn');
+call datacell.receptor('datacell','sysIn','localhost','50500');
+call datacell.start('datacell','sysIn');
-create table datacell.basket_Y( etag timestamp, like datacell.basket_X);
+create table datacell.sysOut( etag timestamp, like datacell.sysIn);
-- the continues query is registered and started
-create procedure datacell.query_X_Y()
+create procedure datacell.query_sysIn_sysOut()
begin
- insert into datacell.basket_Y select now(), * from datacell.basket_X()
;
+ insert into datacell.sysOut select now(), * from datacell.sysIn() ;
end;
-call register_query('datacell.query_X_Y');
-call start_query('datacell.query_X_Y');
+call register_query('datacell.query_sysIn_sysOut');
+call start_query('datacell.query_sysIn_sysOut');
-create function datacell.basket_Y()
+create function datacell.sysOut()
returns table (id integer)
begin
- return select * from datacell.basket_Y;
+ return select * from datacell.sysOut;
end;
-- sent it over the wire.
-create function datacell.emitter_Y()
+create function datacell.emitter_sysOut()
returns boolean;
begin
- select * from datacell.basket_Y();
+ select * from datacell.sysOut();
return true;
end;
-call register_basket('basket_y');
-call register_emitter('emitter_y','localhost:50101');
-call start_emitter('emitter_y');
+call datacell.basket('datacell','sysOut');
+call datacell.emitter('datacell','sysOut','localhost:50101');
+call datacell.start('datacell','sysOut');
diff --git a/sql/backends/monet5/datacell/datacell.mx
b/sql/backends/monet5/datacell/datacell.mx
--- a/sql/backends/monet5/datacell/datacell.mx
+++ b/sql/backends/monet5/datacell/datacell.mx
@@ -32,7 +32,7 @@
address DCreceptor
comment "Define a receptor based on a basket table. The receptor protocol is
either active or passive.";
-pattern drop(schema:str,obj:str):void
+pattern remove(schema:str,obj:str):void
address DCdrop
comment "Remove a basket, receptor or emitter";
@@ -44,7 +44,7 @@
address DCresume
comment "Pause a receptor or emitter";
-pattern query(schema:str,obj:str):void
+pattern query(name:str,def:str):void
address DCquery
comment "Add a new continuous query.";
@@ -80,6 +80,7 @@
#include "mal.h"
#include "mal_interpreter.h"
#include "sql.h"
+#include "sql_scenario.h"
#include "basket.h"
#include "receptor.h"
#include "emitter.h"
@@ -184,14 +185,35 @@
return msg;
}
+/* locate the MAL representation of this operation and extract the flow */
+/* If the operation is not available yet, it should be compiled from its
+ definition retained in the SQL catalog */
str
DCquery(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
- (void) cntxt;
+ str nme = *(str*) getArgReference(stk,pci,1);
+ str *def = (str*) getArgReference(stk,pci,2);
+ Symbol s;
+ str msg;
+ InstrPtr p;
+ Module scope;
+
(void) mb;
- (void) stk;
- (void) pci;
- return MAL_SUCCEED;
+ msg = SQLstatementIntern(cntxt, def, nme, 0, 0);
+ /* if ( msg )
+ return msg; */
+ scope = findModule(cntxt->nspace,putName("datacell",8));
+ s = newFunction(putName("datacell",8), putName(nme,
strlen(nme)),FUNCTIONsymbol);
+ if ( s == NULL)
+ throw(SQL,"datacell.query","Procedure code does not exist");
+ freeMalBlk(s->def);
+ s->def = copyMalBlk(cntxt->curprg->def);
+ p= getInstrPtr(s->def,0);
+ setModuleId(p, putName("datacell",8));
+ setFunctionId(p, putName(nme,strlen(nme)));
+ insertSymbol(scope,s);
+ PNanalysis(cntxt,s->def);
+ return msg;
}
/*
diff --git a/sql/backends/monet5/datacell/petrinet.mx
b/sql/backends/monet5/datacell/petrinet.mx
--- a/sql/backends/monet5/datacell/petrinet.mx
+++ b/sql/backends/monet5/datacell/petrinet.mx
@@ -54,6 +54,9 @@
address PNstopScheduler
comment "Stop the Petri net controller";
+pattern analyse(mod:str, fcn:str)
+address PNanalyseWrapper
+comment "Check the input/output relationship";
command dump()
address PNdump
comment "Show the status of the Petri net";
@@ -89,6 +92,8 @@
datacell_export str PNdump(int *ret);
datacell_export str PNsource(int *ret, str *mod, str *fcn, str *schema, str
*tbl);
datacell_export str PNtarget(int *ret, str *mod, str *fcn, str *schema, str
*tbl);
+datacell_export void PNanalysis(Client cntxt, MalBlkPtr mb);
+datacell_export str PNanalyseWrapper(Client cntxt, MalBlkPtr mb, MalStkPtr
stk, InstrPtr pci);
#endif
@c
@@ -137,6 +142,49 @@
static int status = 0;
static int cycleDelay = 1000; /* be careful, it affects response/throughput
timings */
+/* check the routine for input/output relationships */
+void
+PNanalysis(Client cntxt, MalBlkPtr mb)
+{
+ int i, bskt;
+ InstrPtr p;
+ str schema, tbl;
+
+ for( i = 0; i < mb->stop; i++){
+ p= getInstrPtr(mb,i);
+ if ( getModuleId(p) == sqlRef){
+ if ( getFunctionId(p) == bindRef && getVarConstant(mb,
getArg(p, p->argc-1)).val.ival == 0){
+ bskt = BSKTlocate( schema =
getVarConstant(mb,getArg(p,2)).val.sval, tbl =
getVarConstant(mb,getArg(p,3)).val.sval);
+ if ( bskt == 0 )
+ mnstr_printf(cntxt->fdout,"#input
basket %s.%s missing\n", schema,tbl);
+ }
+ if ( getFunctionId(p) == appendRef){
+ bskt = BSKTlocate( schema =
getVarConstant(mb,getArg(p,2)).val.sval, tbl =
getVarConstant(mb,getArg(p,3)).val.sval);
+ if ( bskt == 0 )
+ mnstr_printf(cntxt->fdout,"#output
basket %s.%s missing\n", schema,tbl);
+ }
+ }
+ }
+}
+str PNanalyseWrapper(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
+{
+ Module scope;
+ Symbol s = 0;
+ str *modnme = (str *)getArgReference(stk, pci, 1);
+ str *fcnnme = (str *)getArgReference(stk, pci, 2);
+
+ (void) mb;
+ scope = findModule(cntxt->nspace, putName(*modnme,
(int)strlen(*modnme)));
+ if (scope)
+ s = findSymbolInModule(scope, putName(*fcnnme,
(int)strlen(*fcnnme)));
+ if (s == NULL)
+ throw(MAL, "petrinet.analysis", "Could not find function");
+
+ PNanalysis(cntxt,s->def);
+
+ return MAL_SUCCEED;
+}
+
str PNregistration(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{
Module scope;
@@ -148,7 +196,6 @@
(void)mb;
scope = findModule(cntxt->nspace, putName(*modnme,
(int)strlen(*modnme)));
-
if (scope)
s = findSymbolInModule(scope, putName(*fcnnme,
(int)strlen(*fcnnme)));
diff --git a/sql/backends/monet5/datacell/sensor.mx
b/sql/backends/monet5/datacell/sensor.mx
--- a/sql/backends/monet5/datacell/sensor.mx
+++ b/sql/backends/monet5/datacell/sensor.mx
@@ -89,7 +89,8 @@
static int batchsize = 1;
static int sequence = -1;
static int columns = 1;
-static int stamp = 1; /*if (timestamp!=0) sensor sends also the tsmp */
+static int autoincrement = 1; /* if id != 0 then we increment and sent it
along */
+static int timestamp = 1; /*if (timestamp!=0) sensor sends also the tsmp */
static char *host = "localhost";
static int port = 50500;
static int trace = 0;
@@ -109,6 +110,7 @@
mnstr_printf(SEout, "--port=<portnr>, default=50500 \n");
mnstr_printf(SEout, "--sensor=<name> \n");
mnstr_printf(SEout, "--protocol=<name> udp or tcp(default) \n");
+ mnstr_printf(SEout, "--autoincrement=<number>, default=0 \n");
mnstr_printf(SEout, "--timestamp, default=off\n");
mnstr_printf(SEout, "--columns=<number>, default=1\n");
mnstr_printf(SEout, "--sequence=<sequence length>, (-1=forever,>0),
default=1\n");
@@ -158,12 +160,13 @@
char hostname[1024];
Sensor se = NULL;
static SOCKET sockfd;
- static struct option long_options[15] = {
+ static struct option long_options[16] = {
+ { "autoincrement", 0, 0, 'a' },
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list