Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/89501

fix for bug #866423
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/89501
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-01-20 13:37:12 +0000
+++ ChangeLog	2012-01-20 21:54:37 +0000
@@ -12,6 +12,8 @@
   * Fixed bug in destruction of exit_catcher_expr
   * Types-related optimization for the comparison operators
   * Fixed bug #911585 (management of variables during eval)
+  * Fixed bug #866423 (fn:empty and fn:exists iterators must reset their input in
+    case of early-out)
   * Added index management function to the C++ api's StaticCollectionManager.
   * Fixed bug #905041 (allow for the default element and function namespaces to be
     set multiple times via the c++ api).

=== modified file 'src/runtime/sequences/sequences_impl.cpp'
--- src/runtime/sequences/sequences_impl.cpp	2011-10-12 08:45:07 +0000
+++ src/runtime/sequences/sequences_impl.cpp	2012-01-20 21:54:37 +0000
@@ -21,7 +21,9 @@
 #include <sstream>
 
 #include <zorbautils/fatal.h>
-#include <diagnostics/xquery_diagnostics.h>
+#include "diagnostics/xquery_diagnostics.h"
+#include "diagnostics/util_macros.h"
+
 #include <zorbatypes/URI.h>
 #include <zorbamisc/ns_consts.h>
 
@@ -154,11 +156,7 @@
 
   if (!consumeNext(state->theSearchItem, theChildren[1].getp(), planState))
   {
-		throw XQUERY_EXCEPTION(
-			err::FORG0006,
-			ERROR_PARAMS( ZED( EmptySeqNoSearchItem ) ),
-			ERROR_LOC( loc )
-		);
+		RAISE_ERROR(err::FORG0006, loc, ERROR_PARAMS(ZED(EmptySeqNoSearchItem)));
   }
 
   if ( theChildren.size() == 3 )
@@ -213,11 +211,12 @@
 
   if ( !consumeNext(lSequenceItem, theChildren[0].getp(), planState))
   {
-    STACK_PUSH (GENV_ITEMFACTORY->createBoolean ( result, true ), state);
+    STACK_PUSH(GENV_ITEMFACTORY->createBoolean(result, true), state);
   }
   else
   {
-    STACK_PUSH (GENV_ITEMFACTORY->createBoolean ( result, false ), state);
+    theChildren[0]->reset(planState);
+    STACK_PUSH (GENV_ITEMFACTORY->createBoolean(result, false), state);
   }
 
   STACK_END (state);
@@ -235,6 +234,7 @@
 
   if ( consumeNext(lSequenceItem, theChildren[0].getp(), planState) )
   {
+    theChildren[0]->reset(planState);
     STACK_PUSH (GENV_ITEMFACTORY->createBoolean ( result, true ), state);
   }
   else

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

Reply via email to