[Zorba-coders] [Bug 871629] [NEW] Assertion failed with insert into in a collection

2011-10-10 Thread Federico Cavalieri
Public bug reported:

The following query crashes zorba
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()
  
zorba: /zorba/repository/pul-xdm/src/store/naive/node_items.cpp:345: long int 
zorba::simplestore::XmlNode::compareInSameTree(const 
zorba::simplestore::XmlNode*, const zorba::simplestore::XmlNode*) const: 
Assertion `n1-getTree() == n2-getTree()' faile

** Affects: zorba
 Importance: Critical
 Status: New

** Changed in: zorba
   Importance: Undecided = Critical

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/871629

Title:
  Assertion failed with insert into in a collection

Status in Zorba - The XQuery Processor:
  New

Bug description:
  The following query crashes zorba
  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()

  zorba: /zorba/repository/pul-xdm/src/store/naive/node_items.cpp:345: long int 
zorba::simplestore::XmlNode::compareInSameTree(const 
zorba::simplestore::XmlNode*, const zorba::simplestore::XmlNode*) const: 
Assertion `n1-getTree() == n2-getTree()' faile

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/871629/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Markos Zaharioudakis
Markos Zaharioudakis has proposed merging lp:~markos-za/zorba/markos-bugs into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2011-10-05 22:39:18 +
+++ ChangeLog	2011-10-10 10:08:22 +
@@ -41,6 +41,7 @@
   * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)
   * Implemented the probe-index-range-value for general indexes
   * Fixed bug #867662 (nullptr warning)
+  * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)
 
 version 2.0.1
 

=== modified file 'include/zorba/item_sequence.h'
--- include/zorba/item_sequence.h	2011-06-14 17:26:33 +
+++ include/zorba/item_sequence.h	2011-10-10 10:08:22 +
@@ -21,19 +21,26 @@
 
 namespace zorba { 
 
-  /** \brief This interface represents an instance of the XQuery 1.0 and XPath 2.0 Data Model (XDM).
+  /** 
+   * \brief This interface represents an instance of the XQuery 1.0 and XPath 2.0
+   * Data Model (XDM).
*
* See http://www.w3.org/TR/xpath-datamodel/.
*/
   class ZORBA_DLL_PUBLIC ItemSequence : virtual public SmartObject
   {
 public:
-  /** \brief Destructor
+  /**
+   * \brief Destructor
*/
   virtual ~ItemSequence() { }
 
-  /** \brief get the Iterator over the items
+  /**
+   * \brief get the Iterator over the items
+   *
* @return an iterator over the items
+   * @throw Throws zerr::ZAPI0039 if the implementation of the associated
+   *ItemSequence does not allow more than one iterator to be created. 
   */
   virtual Iterator_t  getIterator() = 0;
 

=== modified file 'include/zorba/iterator.h'
--- include/zorba/iterator.h	2011-06-14 17:26:33 +
+++ include/zorba/iterator.h	2011-10-10 10:08:22 +
@@ -73,6 +73,8 @@
* The purpose of this method is to release resources that were allocated
* during open. After calling close(), neither close() nor next() may be
* called again. However, the iterator may be re-opened (by calling open()).
+   *
+   * @throw  ZorbaException if an error occurs, or the Iterator has not been opened.
*/
   virtual void 
   close() = 0;

=== modified file 'src/runtime/core/fncall_iterator.cpp'
--- src/runtime/core/fncall_iterator.cpp	2011-08-16 11:25:55 +
+++ src/runtime/core/fncall_iterator.cpp	2011-10-10 10:08:22 +
@@ -399,29 +399,35 @@
   {
   private:
 ExtFuncArgItemSequence * theItemSequence;
-bool is_open;
-int open_count;
+bool theIsOpen;
+bool theFirstOpen;
 
   public:
-InternalIterator(ExtFuncArgItemSequence* item_sequence) 
+InternalIterator(ExtFuncArgItemSequence* seq) 
   : 
-  theItemSequence(item_sequence),
-  is_open(false),
-  open_count(0)
+  theItemSequence(seq),
+  theIsOpen(false),
+  theFirstOpen(true)
 {
 }
 
-virtual void open()
+void open()
 {
-  is_open = true;
-  //if(open_count)
-  //  theItemSequence-theChild-reset(theItemSequence-thePlanState);
-  open_count++;
+  if (theIsOpen)
+throw ZORBA_EXCEPTION(zerr::ZAPI0041_ITERATOR_ALREADY_OPEN);
+
+  if (!theFirstOpen)
+theItemSequence-theChild-reset(theItemSequence-thePlanState);
+
+  theIsOpen = true;
+  theFirstOpen = false;
 }
 
 bool next(Item item)
 {
-  ZORBA_ASSERT(is_open);
+  if (!theIsOpen)  
+throw ZORBA_EXCEPTION(zerr::ZAPI0040_ITERATOR_NOT_OPEN);
+
   store::Item_t result;
   bool status = theItemSequence-theChild-
 consumeNext(result,
@@ -431,28 +437,38 @@
   return status;
 }
 
-virtual void close()
+void close()
 {
-  is_open = false;
-  // theItemSequence-theChild-close(theItemSequence-thePlanState);
+  if (!theIsOpen)  
+throw ZORBA_EXCEPTION(zerr::ZAPI0040_ITERATOR_NOT_OPEN);
+
+  theIsOpen = false;
 }
 
-virtual bool isOpen() const {return is_open;}
+bool isOpen() const { return theIsOpen; }
   };
 
 private:
   PlanIter_t   theChild;
   PlanState   thePlanState;
+  bool theHasIterator;
 
 public:
   ExtFuncArgItemSequence(PlanIter_t child, PlanState state)
 :
 theChild(child),
-thePlanState(state)
-  {
-  }
-
-  virtual Iterator_t getIterator() {return new InternalIterator(this);}
+thePlanState(state),
+theHasIterator(false)
+  {
+  }
+
+  virtual Iterator_t getIterator() 
+  {
+if (theHasIterator)
+  throw ZORBA_EXCEPTION(zerr::ZAPI0039_XQUERY_HAS_ITERATOR_ALREADY);
+
+return new InternalIterator(this);
+  }
 };
 
 
@@ -468,9 +484,9 @@
 {
   theResultIter = NULL;
 
-  ulong n = (ulong)m_extArgs.size();
+  csize n = m_extArgs.size();
 
-  for (ulong i = 0; i  n; ++i)
+  

[Zorba-coders] [Bug 867262] Re: Ext func arg item seq can not be consumed 2 times

2011-10-10 Thread Markos Zaharioudakis
Gabriel, would it be ok with your use case if instead of calling
getIterator() a second time, you reused the same iterator? Basically,
the code would look something like this:


Item item;
Iterator_t iter = args[0] -getIterator( );
iter-open();
iter-next(item);
iter-close();

// iter = args[0] -getIterator( );
iter-open();
iter-next(item);
iter-close();

The only difference between the above code and your example is that I
have commented-out the 2nd call to getIterator().

In general, it doesn't make sense to have more than one iterator on a
ExtFuncArgItemSequence, unless the sequence is materialized, and then
you would get a performance hit.

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/867262

Title:
  Ext func arg item seq can not be consumed 2 times

Status in Zorba - The XQuery Processor:
  New

Bug description:
  If one tried to consume an external function argument item sequence 2
  times, the 2nd time no more item is returned: next returns false and
  the item is NULL.

  To reproduce, take any external module and in the evaluate
  implementation of a function do the following (make sure that the
  function receives a non non-empty sequence as the first parameter):

  Item item;

  Iterator_t iter = args[0]-getIterator();
  iter-open();
  iter-next(item);
  iter-close();

  // item is valid here

  iter = args[0]-getIterator();
  iter-open();
  iter-next(item);
  iter-close();

  // item is NULL here

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/867262/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/identifiers into lp:zorba

2011-10-10 Thread Markos Zaharioudakis
Federico I made some changes to the branch, the most important of which is that 
I removed from SimpleStore the methods related to copying of identifiers. I 
guess you will have to put this code back in the branch where it is actually 
used.
-- 
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/identifiers into lp:zorba

2011-10-10 Thread Zorba Build Bot
Attempt to merge into lp:zorba failed due to conflicts: 

text conflict in test/rbkt/Queries/CMakeLists.txt
-- 
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/identifiers into lp:zorba

2011-10-10 Thread Zorba Build Bot
The proposal to merge lp:~zorba-coders/zorba/identifiers into lp:zorba has been 
updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
-- 
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/identifiers into lp:zorba

2011-10-10 Thread Federico Cavalieri
 Federico I made some changes to the branch, the most important of which is
 that I removed from SimpleStore the methods related to copying of identifiers.
 I guess you will have to put this code back in the branch where it is actually
 used.

OK, Thanks.

I am going to fix the arisen merge conflicts.

-- 
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~fcavalieri/zorba/bugs into lp:zorba

2011-10-10 Thread Zorba Build Bot
Validation queue job bugs-2011-10-10T10-18-36.455Z is finished. The final 
status was:

All tests succeeded!
-- 
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/78814
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~fcavalieri/zorba/bugs into lp:zorba

2011-10-10 Thread Zorba Build Bot
The proposal to merge lp:~fcavalieri/zorba/bugs into lp:zorba has been updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/78814
-- 
https://code.launchpad.net/~fcavalieri/zorba/bugs/+merge/78814
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/identifiers into lp:zorba

2011-10-10 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/identifiers-2011-10-10T10-38-30.063Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Bug 871629] Re: Assertion failed with insert into in a collection

2011-10-10 Thread Federico Cavalieri
** Changed in: zorba
 Assignee: (unassigned) = Federico Cavalieri (fcavalieri)

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/871629

Title:
  Assertion failed with insert into in a collection

Status in Zorba - The XQuery Processor:
  New

Bug description:
  The following query crashes zorba
  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()

  zorba: /zorba/repository/pul-xdm/src/store/naive/node_items.cpp:345: long int 
zorba::simplestore::XmlNode::compareInSameTree(const 
zorba::simplestore::XmlNode*, const zorba::simplestore::XmlNode*) const: 
Assertion `n1-getTree() == n2-getTree()' faile

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/871629/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Bug 871623] Re: Assertion failed with insert after in a collection

2011-10-10 Thread Federico Cavalieri
** Changed in: zorba
 Assignee: (unassigned) = Federico Cavalieri (fcavalieri)

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/871623

Title:
  Assertion failed with insert after in a collection

Status in Zorba - The XQuery Processor:
  New

Bug description:
  The following query crashes zorba with an assertion failure:

  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()

  Also

  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()

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/871623/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/identifiers into lp:zorba

2011-10-10 Thread Zorba Build Bot
Validation queue job identifiers-2011-10-10T10-38-30.063Z is finished. The 
final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/identifiers/+merge/78383
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/bugs2 into lp:zorba

2011-10-10 Thread Markos Zaharioudakis
Markos Zaharioudakis has proposed merging lp:~markos-za/zorba/bugs2 into 
lp:zorba.

Requested reviews:
  Federico Cavalieri (fcavalieri)

For more details, see:
https://code.launchpad.net/~markos-za/zorba/bugs2/+merge/78834
-- 
https://code.launchpad.net/~markos-za/zorba/bugs2/+merge/78834
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/nodes/nodes_impl.cpp'
--- src/runtime/nodes/nodes_impl.cpp	2011-10-10 10:08:58 +
+++ src/runtime/nodes/nodes_impl.cpp	2011-10-10 13:07:34 +
@@ -34,6 +34,7 @@
 namespace zorba {
 
 /***
+
 /
 bool
 NodeReferenceIterator::nextImpl(store::Item_t aResult, PlanState aPlanState) const
@@ -42,17 +43,19 @@
   store::Item_t lGenerateIdentifier;
   zstring lNodeId;
 
-  PlanIteratorState *state;
+  PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
 
   consumeNext(lNode, theChildren[0].getp(), aPlanState);
 
-  STACK_PUSH(GENV_STORE.getReference(aResult, lNode), state);
+  STACK_PUSH(GENV_STORE.getNodeReference(aResult, lNode), state);
 
   STACK_END (state);
 }
 
+
 /***
+
 /
 bool
 NodeByReferenceIterator::nextImpl(store::Item_t result, PlanState planState) const
@@ -60,7 +63,7 @@
   store::Item_t lUUID;
   bool haveResult;
 
-  PlanIteratorState *state;
+  PlanIteratorState* state;
   DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
 
   consumeNext(lUUID, theChildren[0].getp(), planState);
@@ -378,8 +381,8 @@
   zstring uri_string, lRes;
   if(consumeNext(item, theChildren[0].getp(), planState))
   {
-store::Item_t   item_uri;
-if (GENV_STORE.getReference(item_uri, item.getp()))
+store::Item_t item_uri;
+if (GENV_STORE.getNodeReference(item_uri, item.getp()))
 {
   uri_string = item_uri-getStringValue();
   // need to convert the opaque uri into a valid ncname

=== modified file 'src/store/api/store.h'
--- src/store/api/store.h	2011-09-30 11:31:23 +
+++ src/store/api/store.h	2011-10-10 13:07:34 +
@@ -95,7 +95,7 @@
* @param node XDM node
* @return the identifier as an item of type xs:anyURI
*/
-  virtual bool getReference(Item_t result, Item* node) = 0;
+  virtual bool getNodeReference(Item_t result, Item* node) = 0;
 
   /**
* Returns whether a reference has already been generated for the given node.

=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2011-10-10 10:08:58 +
+++ src/store/naive/node_items.cpp	2011-10-10 13:07:34 +
@@ -1543,7 +1543,7 @@
   InternalNode(store::StoreConsts::elementNode)
 {
   theName.transfer(nodeName);
-  setHaveValue();
+  setHaveTypedValue();
   resetRecursive();
 
   if (numBindings  0)
@@ -1592,10 +1592,10 @@
 
 if (haveTypedValue)
 {
-  setHaveValue();
+  setHaveTypedValue();
 
   if (haveEmptyValue)
-setHaveEmptyValue();
+setHaveEmptyTypedValue();
 }
 
 if (isInSubstGroup)
@@ -1741,9 +1741,9 @@
   if (copymode.theTypePreserve)
   {
 typeName = getType();
-haveValue = this-haveValue();
-haveEmptyValue = this-haveEmptyValue();
-inSubstGroup = this-isInSubstitutionGroup();
+haveValue = haveTypedValue();
+haveEmptyValue = haveEmptyTypedValue();
+inSubstGroup = isInSubstitutionGroup();
   }
   else
   {
@@ -2187,11 +2187,11 @@
 /
 void ElementNode::getTypedValue(store::Item_t val, store::Iterator_t iter) const
 {
-  if (haveValue())
+  if (haveTypedValue())
   {
 TextNode* textChild;
 
-if (haveEmptyValue())
+if (haveEmptyTypedValue())
 {
   val = NULL;
   iter = NULL;
@@ -3470,7 +3470,7 @@
 }
   }
 
-  ZORBA_ASSERT(p-haveValue()  !p-haveEmptyValue());
+  ZORBA_ASSERT(p-haveTypedValue()  !p-haveEmptyTypedValue());
 
   setTypedValue(content);
   if (isListValue)

=== modified file 'src/store/naive/node_items.h'
--- src/store/naive/node_items.h	2011-10-05 18:52:55 +
+++ src/store/naive/node_items.h	2011-10-10 13:07:34 +
@@ -309,31 +309,57 @@
 public:
   enum NodeFlags
   {
-NodeKindMask=   0x7,
-IsId=   0x8,
-IsIdRefs=   0x10,
-HaveTypedValue  =   0x20,// for element nodes only
-HaveEmptyValue  =   0x40,// for element nodes only
-IsTyped =   0x80,// for text nodes only
-HaveListValue   =   0x100,   // for text and attribute nodes only
-
-HaveLocalBindings   =   0x200,   // for element nodes only
-HaveBaseUri =   0x400,   // for element nodes only
-IsBaseUri   =   0x800,   // for attribute nodes only
-

[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Matthias Brantner
The proposal to merge lp:~markos-za/zorba/markos-bugs into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Zorba Build Bot
Attempt to merge into lp:zorba failed due to conflicts: 

text conflict in ChangeLog
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Bug 867262] Re: Ext func arg item seq can not be consumed 2 times

2011-10-10 Thread Matthias Brantner
I think it's fine to restrict the API to only allow one iterator at a time. If 
the user has a use case
that requires two active iterators at a time, he should think about his use 
case and eventually
materialize in his code.

I'm going to approve the merge proposal.

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/867262

Title:
  Ext func arg item seq can not be consumed 2 times

Status in Zorba - The XQuery Processor:
  New

Bug description:
  If one tried to consume an external function argument item sequence 2
  times, the 2nd time no more item is returned: next returns false and
  the item is NULL.

  To reproduce, take any external module and in the evaluate
  implementation of a function do the following (make sure that the
  function receives a non non-empty sequence as the first parameter):

  Item item;

  Iterator_t iter = args[0]-getIterator();
  iter-open();
  iter-next(item);
  iter-close();

  // item is valid here

  iter = args[0]-getIterator();
  iter-open();
  iter-next(item);
  iter-close();

  // item is NULL here

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/867262/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Markos Zaharioudakis
The proposal to merge lp:~markos-za/zorba/markos-bugs into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78812
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Markos Zaharioudakis
Markos Zaharioudakis has proposed merging lp:~markos-za/zorba/markos-bugs into 
lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2011-10-07 15:50:57 +
+++ ChangeLog	2011-10-10 19:38:24 +
@@ -27,8 +27,8 @@
   * Fixed bug #3409344 (during detach, if the node being detached is the root of
 its tree, it should be detached from the tree as well; otherwise memory
 corruption will occur)
-  * Fixed bug # (Should not destroy the parent of a node that is being detached 
-before the detach is done). 
+  * Fixed bug # (Should not destroy the parent of a node that is being detached
+before the detach is done).
   * Fixed bug #3408181 (available-collection() returns undeclared collections)
   * Fixed bug #859465 (Fatal error if a PUL contains two deactivate IC primitives)
   * Fixed bug #859467 (Fatal error if a PUL contains two activate Foreign Key primitives)
@@ -41,10 +41,11 @@
   * Fixed bug #863730 (static delete-node* functions don't raise ZDDY0012)
   * Implemented the probe-index-range-value for general indexes
   * Fixed bug #867662 (nullptr warning)
+  * Fixed bug #867262 (allow reuse of iterator over ExtFuncArgItemSequence)
   * Fixed bug #869024 (segmentation fault with node-reference)
   * Fixed bug #869025 (segmentation fault with node-reference)
-  * New node-reference module. References can be obtained for any node, and different nodes cannot 
-have the same identifier.
+  * New node-reference module. References can be obtained for any node, and
+	different nodes cannot have the same identifier.
 
 version 2.0.1
 

=== modified file 'include/zorba/item_sequence.h'
--- include/zorba/item_sequence.h	2011-06-14 17:26:33 +
+++ include/zorba/item_sequence.h	2011-10-10 19:38:24 +
@@ -21,19 +21,26 @@
 
 namespace zorba { 
 
-  /** \brief This interface represents an instance of the XQuery 1.0 and XPath 2.0 Data Model (XDM).
+  /** 
+   * \brief This interface represents an instance of the XQuery 1.0 and XPath 2.0
+   * Data Model (XDM).
*
* See http://www.w3.org/TR/xpath-datamodel/.
*/
   class ZORBA_DLL_PUBLIC ItemSequence : virtual public SmartObject
   {
 public:
-  /** \brief Destructor
+  /**
+   * \brief Destructor
*/
   virtual ~ItemSequence() { }
 
-  /** \brief get the Iterator over the items
+  /**
+   * \brief get the Iterator over the items
+   *
* @return an iterator over the items
+   * @throw Throws zerr::ZAPI0039 if the implementation of the associated
+   *ItemSequence does not allow more than one iterator to be created. 
   */
   virtual Iterator_t  getIterator() = 0;
 

=== modified file 'include/zorba/iterator.h'
--- include/zorba/iterator.h	2011-06-14 17:26:33 +
+++ include/zorba/iterator.h	2011-10-10 19:38:24 +
@@ -73,6 +73,8 @@
* The purpose of this method is to release resources that were allocated
* during open. After calling close(), neither close() nor next() may be
* called again. However, the iterator may be re-opened (by calling open()).
+   *
+   * @throw  ZorbaException if an error occurs, or the Iterator has not been opened.
*/
   virtual void 
   close() = 0;

=== modified file 'src/runtime/core/fncall_iterator.cpp'
--- src/runtime/core/fncall_iterator.cpp	2011-08-16 11:25:55 +
+++ src/runtime/core/fncall_iterator.cpp	2011-10-10 19:38:24 +
@@ -399,29 +399,35 @@
   {
   private:
 ExtFuncArgItemSequence * theItemSequence;
-bool is_open;
-int open_count;
+bool theIsOpen;
+bool theFirstOpen;
 
   public:
-InternalIterator(ExtFuncArgItemSequence* item_sequence) 
+InternalIterator(ExtFuncArgItemSequence* seq) 
   : 
-  theItemSequence(item_sequence),
-  is_open(false),
-  open_count(0)
+  theItemSequence(seq),
+  theIsOpen(false),
+  theFirstOpen(true)
 {
 }
 
-virtual void open()
+void open()
 {
-  is_open = true;
-  //if(open_count)
-  //  theItemSequence-theChild-reset(theItemSequence-thePlanState);
-  open_count++;
+  if (theIsOpen)
+throw ZORBA_EXCEPTION(zerr::ZAPI0041_ITERATOR_ALREADY_OPEN);
+
+  if (!theFirstOpen)
+theItemSequence-theChild-reset(theItemSequence-thePlanState);
+
+  theIsOpen = true;
+  theFirstOpen = false;
 }
 
 bool next(Item item)
 {
-  ZORBA_ASSERT(is_open);
+  if (!theIsOpen)  
+throw ZORBA_EXCEPTION(zerr::ZAPI0040_ITERATOR_NOT_OPEN);
+
   store::Item_t result;
   bool status = theItemSequence-theChild-
 consumeNext(result,
@@ -431,28 +437,38 @@
   return status;
 }
 
-virtual void close()
+

Re: [Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Zorba Build Bot
There are additional revisions which have not been approved in review. Please 
seek review and approval of these new revisions.
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Zorba Build Bot
The proposal to merge lp:~markos-za/zorba/markos-bugs into lp:zorba has been 
updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Markos Zaharioudakis
The proposal to merge lp:~markos-za/zorba/markos-bugs into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~markos-za/zorba/markos-bugs into lp:zorba

2011-10-10 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/markos-bugs-2011-10-10T20-30-37.442Z/log.html
-- 
https://code.launchpad.net/~markos-za/zorba/markos-bugs/+merge/78881
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Bug 867059] Re: Can not handle largest xs:unsignedLong values

2011-10-10 Thread Paul J. Lucas
The tests that were failing (from the W3C test suite) were:

K2-NumericGT-1.xq
K2-NumericGT-2.xq
K2-NumericLT-1.xq
K2-NumericLT-2.xq

-- 
You received this bug notification because you are a member of Zorba
Coders, which is the registrant for Zorba.
https://bugs.launchpad.net/bugs/867059

Title:
  Can not handle largest xs:unsignedLong values

Status in Zorba - The XQuery Processor:
  New

Bug description:
  When ZORBA_WITH_BIG_INTEGER=OFF, the implementation of Integer used a
  long long for the representation. However, Zorba currently uses
  Integer for xs:unsignedLong. This can not handle the largest,
  unsigned, 64-bit value.

  A possible solution would be to templatize Integer with the
  representation type, e.g.:

  typedef IntegerImpllong long Integer;
  typedef IntegerImplunsigned long long UnsignedInteger;

To manage notifications about this bug go to:
https://bugs.launchpad.net/zorba/+bug/867059/+subscriptions

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp