zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #00224
[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/77063
Fixed bug 859465
--
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/77063
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp 2011-09-26 18:30:33 +0000
+++ src/store/naive/pul_primitives.cpp 2011-09-26 22:57:27 +0000
@@ -1320,8 +1320,8 @@
if (theIsApplied)
{
SimpleStore* store = &GET_STORE();
- store->deactivateIC(theQName);
- theIsApplied = false;
+ bool isApplied;
+ store->deactivateIC(theQName,isApplied);
}
}
@@ -1361,8 +1361,8 @@
if (theIsApplied)
{
SimpleStore* store = &GET_STORE();
- store->deactivateIC(theQName);
- theIsApplied = false;
+ bool isApplied;
+ store->deactivateIC(theQName,isApplied);
}
}
@@ -1389,20 +1389,22 @@
void UpdDeActivateIC::apply()
{
SimpleStore* store = &GET_STORE();
- store::IC_t ic = store->deactivateIC(theQName);
- theICKind = ic->getICKind();
- switch (theICKind) {
- case store::IC::ic_collection:
- theFromCollectionName = ic->getCollectionName();
- break;
- case store::IC::ic_foreignkey:
- theFromCollectionName = ic->getFromCollectionName();
- theToCollectionName = ic->getToCollectionName();
- break;
- default:
- ZORBA_ASSERT(false);
+ store::IC_t ic = store->deactivateIC(theQName,theIsApplied);
+ if (theIsApplied)
+ {
+ theICKind = ic->getICKind();
+ switch (theICKind) {
+ case store::IC::ic_collection:
+ theFromCollectionName = ic->getCollectionName();
+ break;
+ case store::IC::ic_foreignkey:
+ theFromCollectionName = ic->getFromCollectionName();
+ theToCollectionName = ic->getToCollectionName();
+ break;
+ default:
+ ZORBA_ASSERT(false);
+ }
}
- theIsApplied = true;
}
=== modified file 'src/store/naive/simple_store.cpp'
--- src/store/naive/simple_store.cpp 2011-09-26 15:50:32 +0000
+++ src/store/naive/simple_store.cpp 2011-09-26 22:57:27 +0000
@@ -853,7 +853,8 @@
store::IC_t
-SimpleStore::deactivateIC(const store::Item_t& icQName)
+SimpleStore::deactivateIC(const store::Item_t& icQName,
+ bool& isApplied)
{
ZORBA_ASSERT(icQName != NULL);
@@ -861,13 +862,11 @@
if (!theICs.get(icQName.getp(), ic))
{
- throw ZORBA_EXCEPTION(
- zerr::ZSTR0016_IC_DOES_NOT_EXIST,
- ERROR_PARAMS( icQName->getStringValue() )
- );
+ return ic; // already deactivated in the same PUL => noop
}
theICs.remove(icQName.getp());
+ isApplied=true;
return ic;
}
=== modified file 'src/store/naive/simple_store.h'
--- src/store/naive/simple_store.h 2011-09-26 15:50:32 +0000
+++ src/store/naive/simple_store.h 2011-09-26 22:57:27 +0000
@@ -238,7 +238,8 @@
const store::Item_t& toCollectionQName,
bool& isApplied);
- store::IC_t deactivateIC(const store::Item_t& icQName);
+ store::IC_t deactivateIC(const store::Item_t& icQName,
+ bool& isApplied);
store::Iterator_t listActiveICNames();
=== added file 'test/rbkt/ExpQueryResults/zorba/xqddf/ic-deactivate-err.xml.res'
--- test/rbkt/ExpQueryResults/zorba/xqddf/ic-deactivate-err.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/xqddf/ic-deactivate-err.xml.res 2011-09-26 22:57:27 +0000
@@ -0,0 +1,1 @@
+OK
\ No newline at end of file
=== added file 'test/rbkt/Queries/zorba/xqddf/ic-deactivate-err.xq'
--- test/rbkt/Queries/zorba/xqddf/ic-deactivate-err.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/xqddf/ic-deactivate-err.xq 2011-09-26 22:57:27 +0000
@@ -0,0 +1,14 @@
+import module namespace m = 'xqueryzorba.org/test/xqddf/ic' at 'ic.xqlib';
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
+import module namespace ic_ddl = "http://www.zorba-xquery.com/modules/store/static/integrity_constraints/ddl";
+
+ddl:create($m:empc);
+ic_ddl:activate(xs:QName("m:ic_simple"));
+
+(
+ic_ddl:deactivate(xs:QName("m:ic_simple")),
+ic_ddl:deactivate(xs:QName("m:ic_simple"))
+);
+
+"OK"
\ No newline at end of file
References