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

fix for bug #867266
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/93188
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/expression/fo_expr.cpp'
--- src/compiler/expression/fo_expr.cpp	2012-01-11 17:30:25 +0000
+++ src/compiler/expression/fo_expr.cpp	2012-02-15 12:00:11 +0000
@@ -27,6 +27,8 @@
 #include "functions/udf.h"
 
 #include "diagnostics/assert.h"
+#include "diagnostics/util_macros.h"
+
 
 namespace zorba
 {
@@ -153,7 +155,9 @@
   const function* func = get_func();
   csize numArgs = num_args();
 
-  if (func->getKind() == FunctionConsts::OP_CONCATENATE_N)
+  switch (func->getKind())
+  {
+  case FunctionConsts::OP_CONCATENATE_N:
   {
     bool vacuous = true;
 
@@ -175,16 +179,14 @@
       {
         if (is_updating() && !(argKind & UPDATING_EXPR) && argKind != VACUOUS_EXPR)
         {
-          throw XQUERY_EXCEPTION(err::XUST0001,
-                                 ERROR_PARAMS(ZED(XUST0001_CONCAT)),
-                                 ERROR_LOC(theArgs[i]->get_loc()));
+          RAISE_ERROR(err::XUST0001, theArgs[i]->get_loc(),
+          ERROR_PARAMS(ZED(XUST0001_CONCAT)));
         }
         
         if (i > 0 && !is_updating() && !is_vacuous() && (argKind & UPDATING_EXPR))
         {
-          throw XQUERY_EXCEPTION(err::XUST0001,
-                                 ERROR_PARAMS(ZED(XUST0001_CONCAT)),
-                                 ERROR_LOC(theArgs[i]->get_loc()));
+          RAISE_ERROR(err::XUST0001, theArgs[i]->get_loc(),
+          ERROR_PARAMS(ZED(XUST0001_CONCAT)));
         }
       }
 
@@ -201,8 +203,16 @@
       theScriptingKind &= ~SIMPLE_EXPR;
 
     checkScriptingKind();
-  }
-  else
+
+    break;
+  }
+  case FunctionConsts::OP_HOIST_1:
+  case FunctionConsts::OP_UNHOIST_1:
+  {
+    theScriptingKind = theArgs[0]->get_scripting_detail();
+    break;
+  }
+  default:
   {
     theScriptingKind = func->getScriptingKind();
 
@@ -217,9 +227,8 @@
 
       if (arg->is_updating())
       {
-        throw XQUERY_EXCEPTION(err::XUST0001,
-                               ERROR_PARAMS(ZED(XUST0001_Generic)),
-                               ERROR_LOC(theArgs[i]->get_loc()));
+        RAISE_ERROR(err::XUST0001, theArgs[i]->get_loc(),
+        ERROR_PARAMS(ZED(XUST0001_Generic)));
       }
 
       short argKind = arg->get_scripting_detail();
@@ -243,6 +252,7 @@
 
     checkScriptingKind();
   }
+  }
 }
 
 

=== modified file 'src/compiler/rewriter/rules/hoist_rules.cpp'
--- src/compiler/rewriter/rules/hoist_rules.cpp	2011-09-07 17:27:11 +0000
+++ src/compiler/rewriter/rules/hoist_rules.cpp	2012-02-15 12:00:11 +0000
@@ -491,7 +491,8 @@
       is_enclosed_expr(e) ||
       e->containsRecursiveCall() ||
       e->is_nondeterministic() ||
-      e->is_sequential())
+      e->is_sequential() ||
+      e->is_updating())
   {
     return true;
   }

=== modified file 'src/runtime/core/flwor_iterator.cpp'
--- src/runtime/core/flwor_iterator.cpp	2012-02-15 10:25:02 +0000
+++ src/runtime/core/flwor_iterator.cpp	2012-02-15 12:00:11 +0000
@@ -711,7 +711,7 @@
 {
   PlanIteratorState::init(planState);
 
-  ulong numVars = (ulong)forletClauses.size();
+  csize numVars = forletClauses.size();
   std::vector<long> v(numVars, 0);
   theVarBindingState.swap(v);
   assert(theVarBindingState.size() > 0);
@@ -775,7 +775,7 @@
 
   assert(theVarBindingState.size() > 0);
 
-  size_t size = theVarBindingState.size();
+  csize size = theVarBindingState.size();
 
   ::memset(&theVarBindingState[0], 0, size * sizeof(long));
 
@@ -805,9 +805,9 @@
 ********************************************************************************/
 void FlworState::clearSortTable()
 {
-  ulong numTuples = (ulong)theSortTable.size();
+  csize numTuples = theSortTable.size();
 
-  for (ulong i = 0; i < numTuples; ++i)
+  for (csize i = 0; i < numTuples; ++i)
   {
     theSortTable[i].clear();
   }

=== added file 'test/rbkt/ExpQueryResults/zorba/updates/no_hoist.xml.res'
--- test/rbkt/ExpQueryResults/zorba/updates/no_hoist.xml.res	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/updates/no_hoist.xml.res	2012-02-15 12:00:11 +0000
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<a>x</a>

=== added file 'test/rbkt/Queries/zorba/updates/no_hoist.xq'
--- test/rbkt/Queries/zorba/updates/no_hoist.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/updates/no_hoist.xq	2012-02-15 12:00:11 +0000
@@ -0,0 +1,8 @@
+
+variable $x:=<a/>;
+
+(for $y in $x
+return
+replace value of node $x with "x");
+
+$x

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