Changeset: 929dfac04f5d for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=929dfac04f5d
Modified Files:
        sql/backends/monet5/Tests/cqstream00.sql
        sql/backends/monet5/Tests/cqstream00.stable.out
        sql/backends/monet5/Tests/cqstream03.stable.err
        sql/backends/monet5/Tests/cqstream03.stable.out
        sql/backends/monet5/Tests/cquery00.stable.err
        sql/backends/monet5/Tests/cquery10.stable.out
        sql/backends/monet5/cquery.mal
        sql/backends/monet5/sql_cquery.c
Branch: trails
Log Message:

Check program to enable proper transaction handling


diffs (188 lines):

diff --git a/sql/backends/monet5/Tests/cqstream00.sql 
b/sql/backends/monet5/Tests/cqstream00.sql
--- a/sql/backends/monet5/Tests/cqstream00.sql
+++ b/sql/backends/monet5/Tests/cqstream00.sql
@@ -27,7 +27,7 @@ call cquery.wait(1000);
 -- STOP cq_splitter;
 pause continuous sys.cq_splitter();
 
-select * from cquery.status();
+--select * from cquery.status();
 --select * from cquery.status();
 --select * from cquery.log();
 
diff --git a/sql/backends/monet5/Tests/cqstream00.stable.out 
b/sql/backends/monet5/Tests/cqstream00.stable.out
--- a/sql/backends/monet5/Tests/cqstream00.stable.out
+++ b/sql/backends/monet5/Tests/cqstream00.stable.out
@@ -40,12 +40,6 @@ Ready.
 #    insert into result1 select * from stmp2 where val <12;
 #    insert into result2 select * from stmp2 where val >12;
 #end;
-#select * from cquery.status();
-% .L1, .L1,    .L1,    .L1,    .L1 # table_name
-% tick,        schema, function,       state,  errors # name
-% timestamp,   clob,   clob,   clob,   clob # type
-% 26,  3,      11,     7,      0 # length
-[ NULL,        "sys",  "cq_splitter",  "waiting",      ""      ]
 #select 'RESULT';
 % .L2 # table_name
 % L2 # name
diff --git a/sql/backends/monet5/Tests/cqstream03.stable.err 
b/sql/backends/monet5/Tests/cqstream03.stable.err
--- a/sql/backends/monet5/Tests/cqstream03.stable.err
+++ b/sql/backends/monet5/Tests/cqstream03.stable.err
@@ -29,7 +29,7 @@ stderr of test 'cqstream03` in directory
 
 MAPI  = (monetdb) /var/tmp/mtest-17764/.s.monetdb.38071
 QUERY = call cquery.heartbeat('sys','cq_agenda',1000);
-ERROR = !Beat ignored, a window constraint exist
+ERROR = !Beat ignored, a window constraint exists
 
 
 # 12:58:46 >  
diff --git a/sql/backends/monet5/Tests/cqstream03.stable.out 
b/sql/backends/monet5/Tests/cqstream03.stable.out
--- a/sql/backends/monet5/Tests/cqstream03.stable.out
+++ b/sql/backends/monet5/Tests/cqstream03.stable.out
@@ -36,11 +36,11 @@ Ready.
 #    end if;
 #end;
 #select * from cquery.status();
-% .L1, .L1,    .L1,    .L1,    .L1 # table_name
-% tick,        schema, function,       state,  errors # name
-% timestamp,   clob,   clob,   clob,   clob # type
-% 26,  3,      9,      7,      0 # length
-[ NULL,        "sys",  "cq_agenda",    "waiting",      ""      ]
+% .L1, .L1,    .L1,    .L1,    .L1,    .L1 # table_name
+% tick,        schema, function,       state,  errors, stmt # name
+% timestamp,   clob,   clob,   clob,   clob,   clob # type
+% 26,  4,      9,      10,     0,      17 # length
+[ NULL,        "user", "cq_agenda",    "readytorun",   "",     
"user.cq_agenda();"     ]
 #drop procedure cq_agenda;
 #drop table tmp13;
 #drop table agenda13;
diff --git a/sql/backends/monet5/Tests/cquery00.stable.err 
b/sql/backends/monet5/Tests/cquery00.stable.err
--- a/sql/backends/monet5/Tests/cquery00.stable.err
+++ b/sql/backends/monet5/Tests/cquery00.stable.err
@@ -38,7 +38,8 @@ QUERY = # some simple MAL tests
         (tick:bat[:timestamp],mod:bat[:str],fcn:bat[:str], 
time:bat[:lng],error:bat[:str]) := cquery.log();
         
         io.print(tick,mod,fcn,time,error);
-ERROR = !SQLException:cquery.show:Continous query unknown.query not accessible
+ERROR = !SQLException:cquery.show:Continuous procedure unknown.query not 
accessible
+
 
 
 
diff --git a/sql/backends/monet5/Tests/cquery10.stable.out 
b/sql/backends/monet5/Tests/cquery10.stable.out
--- a/sql/backends/monet5/Tests/cquery10.stable.out
+++ b/sql/backends/monet5/Tests/cquery10.stable.out
@@ -43,6 +43,7 @@ Ready.
 [ 0    ]
 [ 1    ]
 [ 2    ]
+[ 3    ]
 #drop procedure cq_cycles;
 #drop table result;
 
diff --git a/sql/backends/monet5/cquery.mal b/sql/backends/monet5/cquery.mal
--- a/sql/backends/monet5/cquery.mal
+++ b/sql/backends/monet5/cquery.mal
@@ -21,8 +21,8 @@ pattern registersql(mod:str, fcn:str, ar
 address CQprocedure
 comment "Add a continuous SQL procedure to the Petri-net scheduler. It will 
analyse
 the MAL block to determine the input/output dependencies and firing 
conditions.";
+
 pattern registersql(mod:str, fcn:str)
-
 address CQprocedure
 comment "Add a continuous SQL procedure to the Petri-net scheduler. It will 
analyse
 the MAL block to determine the input/output dependencies and firing 
conditions.";
diff --git a/sql/backends/monet5/sql_cquery.c b/sql/backends/monet5/sql_cquery.c
--- a/sql/backends/monet5/sql_cquery.c
+++ b/sql/backends/monet5/sql_cquery.c
@@ -596,6 +596,7 @@ CQregisterMAL(Client cntxt, MalBlkPtr mb
        q = newStmt(mb, sqlRef, commitRef);
        setArgType(mb,q, 0, TYPE_void);
        moveInstruction(mb, getPC(mb,q),i+2);
+       chkProgram(cntxt->fdout, cntxt->nspace, mb);
 
 #ifdef DEBUG_CQUERY
        fprintFunction(stderr, mb, 0, LIST_MAL_ALL);
@@ -672,7 +673,7 @@ str
 CQresume(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        str msg = MAL_SUCCEED;
-       int i;
+       int i, k =-1;
        InstrPtr q;
        (void) cntxt;
        (void) stk;
@@ -680,9 +681,15 @@ CQresume(Client cntxt, MalBlkPtr mb, Mal
 
        for( i=1; i < mb->stop; i++){
                q = getInstrPtr(mb,i);
-               if( getModuleId(q) == userRef)
-                       return CQresumeInternal(getModuleId(q), 
getFunctionId(q));
+
+               if( getModuleId(q) == userRef){
+                       if( k != -1)
+                               throw(SQL,"cquery.resume","Ambiguous resume 
statement");
+                       k = i;
+               }
        }
+       if( k >= 0)
+               return CQresumeInternal(getModuleId(getInstrPtr(mb,k)), 
getFunctionId(getInstrPtr(mb,k)));
        //resume all
        MT_lock_set(&ttrLock);
        msg = CQresumeInternalRanges(0, pnettop);
@@ -723,7 +730,7 @@ str
 CQpause(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        str msg = MAL_SUCCEED;
-       int i;
+       int i,k = -1;
        InstrPtr q;
        (void) cntxt;
        (void) stk;
@@ -731,9 +738,15 @@ CQpause(Client cntxt, MalBlkPtr mb, MalS
 
        for( i=1; i < mb->stop; i++){
                q = getInstrPtr(mb,i);
-               if( getModuleId(q) == userRef)
-                       return CQpauseInternal(getModuleId(q), 
getFunctionId(q));
+               if( getModuleId(q) == userRef){
+                       if( k != -1)
+                               throw(SQL,"cquery.pause","Ambiguous pause 
statement");
+                       k = i;
+               }
        }
+       if( k >= 0)
+               return CQpauseInternal(getModuleId(getInstrPtr(mb,k)), 
getFunctionId(getInstrPtr(mb,k)));
+
        //pause all
        MT_lock_set(&ttrLock);
        msg = CQpauseInternalRanges(0, pnettop);
@@ -882,7 +895,7 @@ str
 CQderegister(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
 {
        str msg = MAL_SUCCEED;
-       int i;
+       int i, k= -1;
        InstrPtr q;
        (void) cntxt;
        (void) stk;
@@ -890,9 +903,14 @@ CQderegister(Client cntxt, MalBlkPtr mb,
 
        for( i=1; i < mb->stop; i++){
                q = getInstrPtr(mb,i);
-               if( getModuleId(q) == userRef)
-                       return CQderegisterInternal(getModuleId(q), 
getFunctionId(q), 0);
+               if( getModuleId(q) == userRef){
+                       if( k != -1)
+                               throw(SQL,"cquery.stop","Ambiguous stop 
statement");
+                       k = i;
+               }
        }
+       if( k>= 0)
+               return CQderegisterInternal(getModuleId(getInstrPtr(mb,k)), 
getFunctionId(getInstrPtr(mb,k)), 0);
        //deregister all
        MT_lock_set(&ttrLock);
        msg = CQderegisterInternalRanges(0, pnettop);
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to