← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba

 

Federico Cavalieri has proposed merging lp:~fcavalieri/zorba/bugs into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/77016

ActivateIC/ActivateForeignKeyIC apply methods now correctly set the theIsApplied flag after application. Made necessary after fixing 859467 and 859468, since their apply method now can be a noop in certain cases.

I would add an assertion in the deactivateIC undo for isApplied, if you agree. 

-- 
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/77016
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/api/store.h'
--- src/store/api/store.h	2011-08-30 19:11:59 +0000
+++ src/store/api/store.h	2011-09-26 16:20:33 +0000
@@ -288,7 +288,8 @@
    * collectionQName.
    */
   virtual IC_t activateIC(const Item_t& icQName, 
-                          const Item_t& collectionQName)  = 0;
+                          const Item_t& collectionQName,
+                          bool& isApplied)  = 0;
 
   /**
    * Activates the icQName foreigh key integrity constraint using
@@ -296,7 +297,8 @@
    */
   virtual IC_t activateForeignKeyIC(const Item_t& icQName, 
                                     const Item_t& fromCollectionQName,
-                                    const Item_t& toCollectionQName)  = 0;
+                                    const Item_t& toCollectionQName,
+                                    bool& isApplied)  = 0;
 
   /**
    * Deactivates icQName integrity constraint.

=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp	2011-09-23 14:41:24 +0000
+++ src/store/naive/pul_primitives.cpp	2011-09-26 16:20:33 +0000
@@ -1311,8 +1311,7 @@
 void UpdActivateIC::apply()
 {
   SimpleStore* store = &GET_STORE();
-  store->activateIC(theQName, theCollectionName);
-  theIsApplied = true;
+  store->activateIC(theQName, theCollectionName,theIsApplied);
 }
 
 
@@ -1353,8 +1352,7 @@
 void UpdActivateForeignKeyIC::apply()
 {
   SimpleStore* store = &GET_STORE();
-  store->activateForeignKeyIC(theQName, theFromCollectionName, theToCollectionName);
-  theIsApplied = true;
+  store->activateForeignKeyIC(theQName, theFromCollectionName, theToCollectionName,theIsApplied);
 }
 
 
@@ -1413,15 +1411,16 @@
   if (theIsApplied)
   {
     SimpleStore* store = &GET_STORE();
+    bool isApplied;
     switch (theICKind) {
       case store::IC::ic_collection:
-        store->activateIC(theQName, theFromCollectionName);
+        store->activateIC(theQName, theFromCollectionName,isApplied);
         break;
       case store::IC::ic_foreignkey:
         store->activateForeignKeyIC(
             theQName,
             theFromCollectionName,
-            theToCollectionName);
+            theToCollectionName,isApplied);
         break;
       default:
         ZORBA_ASSERT(false);

=== modified file 'src/store/naive/simple_store.cpp'
--- src/store/naive/simple_store.cpp	2011-09-26 09:12:46 +0000
+++ src/store/naive/simple_store.cpp	2011-09-26 16:20:33 +0000
@@ -800,7 +800,8 @@
 ********************************************************************************/
 store::IC_t SimpleStore::activateIC(
     const store::Item_t& icQName,
-    const store::Item_t& collectionQName)
+    const store::Item_t& collectionQName,
+    bool& isApplied)
 {
   ZORBA_ASSERT(icQName != NULL);
 
@@ -817,6 +818,7 @@
 
   theICs.insert(qname, ic);
 
+  isApplied=true;
   return ic;
 }
 
@@ -827,7 +829,8 @@
 store::IC_t SimpleStore::activateForeignKeyIC(
     const store::Item_t& icQName,
     const store::Item_t& fromCollectionQName,
-    const store::Item_t& toCollectionQName)
+    const store::Item_t& toCollectionQName,
+    bool& isApplied)
 {
   ZORBA_ASSERT(icQName != NULL);
 
@@ -844,6 +847,7 @@
 
   theICs.insert(qname, ic);
 
+  isApplied=true;
   return ic;
 }
 

=== modified file 'src/store/naive/simple_store.h'
--- src/store/naive/simple_store.h	2011-09-12 22:42:28 +0000
+++ src/store/naive/simple_store.h	2011-09-26 16:20:33 +0000
@@ -229,12 +229,14 @@
 
   store::IC_t activateIC(
         const store::Item_t& icQName,
-        const store::Item_t& collectionQName);
+        const store::Item_t& collectionQName,
+        bool& isApplied);
 
   store::IC_t activateForeignKeyIC(
         const store::Item_t& icQName,
         const store::Item_t& fromCollectionQName,
-        const store::Item_t& toCollectionQName);
+        const store::Item_t& toCollectionQName,
+        bool& isApplied);
 
   store::IC_t deactivateIC(const store::Item_t& icQName);
 


Follow ups