zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #00806
[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/78814
Fixed bug 871623 and 871629
--
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/78814
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp 2011-09-15 13:11:51 +0000
+++ src/store/naive/simple_pul.cpp 2011-10-10 10:16:40 +0000
@@ -185,47 +185,46 @@
{
const QNameItem* collName;
- if (target->isNode())
- {
- const XmlNode* n = static_cast<const XmlNode*>(target);
-
- const store::Collection* collection = n->getCollection();
-
- if (collection != NULL)
- {
- collName = static_cast<const QNameItem*>(collection->getName())->getNormalized();
-
- if (collName == theLastCollection)
- return theLastPul;
- }
- else if (theNoCollectionPul != NULL)
- {
- return theNoCollectionPul;
- }
- else if (theCollectionPuls[NULL] != NULL)
- {
- theNoCollectionPul = theCollectionPuls[NULL];
- return theNoCollectionPul;
- }
- else
- {
- theNoCollectionPul = new CollectionPul(this, NULL);
- theCollectionPuls[NULL] = theNoCollectionPul;
- return theNoCollectionPul;
- }
- }
- else
- {
- // "taret" is the name of a collection.
- if (target == theLastCollection)
- {
+ assert(target->isNode());
+
+ const XmlNode* n = static_cast<const XmlNode*>(target);
+
+ const store::Collection* collection = n->getCollection();
+
+ if (collection != NULL)
+ {
+ collName = static_cast<const QNameItem*>(collection->getName())->getNormalized();
+
+ if (collName == theLastCollection)
return theLastPul;
- }
- else
- {
- collName = static_cast<const QNameItem*>(target)->getNormalized();
- }
- }
+ return getCollectionPulByName(collName,collection->isDynamic());
+ }
+ else if (theNoCollectionPul != NULL)
+ {
+ return theNoCollectionPul;
+ }
+ else if (theCollectionPuls[NULL] != NULL)
+ {
+ theNoCollectionPul = theCollectionPuls[NULL];
+ return theNoCollectionPul;
+ }
+ else
+ {
+ theNoCollectionPul = new CollectionPul(this, NULL);
+ theCollectionPuls[NULL] = theNoCollectionPul;
+ return theNoCollectionPul;
+ }
+}
+
+CollectionPul* PULImpl::getCollectionPulByName(const store::Item* name, bool dynamicCollection)
+{
+ const QNameItem* collName = static_cast<const QNameItem*>(name)->getNormalized();
+
+ assert(!name->isNode());
+
+ // "name" is the name of a collection.
+ if (name == theLastCollection)
+ return theLastPul;
CollectionPulMap::iterator ite = theCollectionPuls.find(collName);
@@ -238,7 +237,7 @@
else
{
SimpleCollection* collection = static_cast<SimpleCollection*>
- (GET_STORE().getCollection(collName).getp());
+ (GET_STORE().getCollection(collName,dynamicCollection).getp());
theLastPul = new CollectionPul(this, collection);
theCollectionPuls[collName] = theLastPul;
}
@@ -810,7 +809,7 @@
const store::Item_t& nodeType,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theCreateCollectionList.push_back(
GET_STORE().getPULFactory().createUpdCreateCollection(
@@ -828,7 +827,7 @@
store::Item_t& name,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theDeleteCollectionList.push_back(
GET_STORE().getPULFactory().createUpdDeleteCollection(pul, aQueryLoc, name, dyn_collection));
@@ -841,7 +840,7 @@
std::vector<store::Item_t>& nodes,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theInsertIntoCollectionList.push_back(
GET_STORE().getPULFactory().createUpdInsertIntoCollection(pul, aQueryLoc, name, nodes, dyn_collection));
@@ -854,7 +853,7 @@
std::vector<store::Item_t>& nodes,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theInsertIntoCollectionList.push_back(
GET_STORE().getPULFactory().createUpdInsertFirstIntoCollection(pul, aQueryLoc, name, nodes, dyn_collection));
@@ -867,7 +866,7 @@
std::vector<store::Item_t>& nodes,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theInsertIntoCollectionList.push_back(
GET_STORE().getPULFactory().createUpdInsertLastIntoCollection(pul, aQueryLoc, name, nodes, dyn_collection));
@@ -881,7 +880,7 @@
std::vector<store::Item_t>& nodes,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theInsertIntoCollectionList.push_back(
GET_STORE().getPULFactory().createUpdInsertBeforeIntoCollection(pul, aQueryLoc, name, target, nodes, dyn_collection));
@@ -895,7 +894,7 @@
std::vector<store::Item_t>& nodes,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theInsertIntoCollectionList.push_back(
GET_STORE().getPULFactory().createUpdInsertAfterIntoCollection(pul, aQueryLoc, name, target, nodes, dyn_collection));
@@ -909,7 +908,7 @@
bool isLast,
bool dyn_collection)
{
- CollectionPul* pul = getCollectionPul(name.getp());
+ CollectionPul* pul = getCollectionPulByName(name.getp(),dyn_collection);
pul->theDeleteFromCollectionList.push_back(
GET_STORE().getPULFactory().createUpdDeleteNodesFromCollection(pul, aQueryLoc, name, nodes, isLast, dyn_collection));
@@ -1581,7 +1580,7 @@
store::Index* idx,
store::IndexEntryCreator* creator)
{
- CollectionPul* pul = getCollectionPul(collectionName);
+ CollectionPul* pul = getCollectionPulByName(collectionName,false);
pul->theIncrementalIndices.push_back(static_cast<IndexImpl*>(idx));
pul->theIndexEntryCreators.push_back(creator);
@@ -2138,8 +2137,8 @@
// If necessary, adjust the position of trees inside this collection.
if (theAdjustTreePositions)
{
- if (theCollection) // ??? not set if the collection is dynamic
- theCollection->adjustTreePositions();
+ assert(theCollection);
+ theCollection->adjustTreePositions();
}
// Detach nodes that were deleted from their trees due to replace-node,
=== modified file 'src/store/naive/simple_pul.h'
--- src/store/naive/simple_pul.h 2011-10-03 08:49:55 +0000
+++ src/store/naive/simple_pul.h 2011-10-10 10:16:40 +0000
@@ -563,6 +563,10 @@
CollectionPul* getCollectionPul(const store::Item* target);
+ CollectionPul* getCollectionPulByName(
+ const store::Item* name,
+ bool dynamicCollection = false);
+
void undoUpdates();
};
=== added file 'test/rbkt/ExpQueryResults/zorba/collections/dynamic3.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/dynamic3.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/dynamic3.xml.res 2011-10-10 10:16:40 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<center1/><c1/><c2/><oldlast/>
\ No newline at end of file
=== added file 'test/rbkt/ExpQueryResults/zorba/collections/dynamic4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/dynamic4.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/dynamic4.xml.res 2011-10-10 10:16:40 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<center1/><c1/><c2/><oldlast/>
\ No newline at end of file
=== added file 'test/rbkt/ExpQueryResults/zorba/collections/dynamic5.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/dynamic5.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/dynamic5.xml.res 2011-10-10 10:16:40 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<c1/><c2/><center1/><oldlast/>
\ No newline at end of file
=== added file 'test/rbkt/Queries/zorba/collections/dynamic3.xq'
--- test/rbkt/Queries/zorba/collections/dynamic3.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/dynamic3.xq 2011-10-10 10:16:40 +0000
@@ -0,0 +1,7 @@
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
+
+ddl:create(xs:QName("ddl:test2"),(<center1/>,<oldlast/>));
+dml:insert-nodes-after(xs:QName("ddl:test2"), dml:collection(xs:QName("ddl:test2"))[1], (<c1/>,<c2/>));
+
+dml:collection(xs:QName("ddl:test2"))/self::node()
=== added file 'test/rbkt/Queries/zorba/collections/dynamic4.xq'
--- test/rbkt/Queries/zorba/collections/dynamic4.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/dynamic4.xq 2011-10-10 10:16:40 +0000
@@ -0,0 +1,7 @@
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
+
+ddl:create(xs:QName("ddl:test2"),(<center1/>,<oldlast/>));
+
+dml:insert-nodes-before(xs:QName("ddl:test2"), dml:collection(xs:QName("ddl:test2"))[2], (<c1/>,<c2/>));
+dml:collection(xs:QName("ddl:test2"))/self::node()
\ No newline at end of file
=== added file 'test/rbkt/Queries/zorba/collections/dynamic5.xq'
--- test/rbkt/Queries/zorba/collections/dynamic5.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/dynamic5.xq 2011-10-10 10:16:40 +0000
@@ -0,0 +1,7 @@
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
+
+ddl:create(xs:QName("ddl:test2"),(<center1/>,<oldlast/>));
+
+dml:insert-nodes-first(xs:QName("ddl:test2"), (<c1/>,<c2/>));
+dml:collection(xs:QName("ddl:test2"))/self::node()
\ No newline at end of file
Follow ups
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: noreply, 2011-10-11
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-11
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-11
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Federico Cavalieri, 2011-10-11
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-11
-
Re: [Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-11
-
Re: [Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Federico Cavalieri, 2011-10-11
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Markos Zaharioudakis, 2011-10-11
-
Re: [Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Markos Zaharioudakis, 2011-10-11
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-10
-
Re: [Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-10
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-10
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Zorba Build Bot, 2011-10-10
-
[Merge] lp:~fcavalieri/zorba/bugs into lp:zorba
From: Federico Cavalieri, 2011-10-10