← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/markos-scratch into lp:zorba

 

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

Commit message:
fixed bug in raising XQTY0086 (copying of namespace-sensitive values during node construction)

Requested reviews:
  Markos Zaharioudakis (markos-za)

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

fixed bug in raising XQTY0086 (copying of namespace-sensitive values during node construction)
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/159349
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/store/naive/node_items.cpp'
--- src/store/naive/node_items.cpp	2013-04-08 08:54:50 +0000
+++ src/store/naive/node_items.cpp	2013-04-17 10:56:32 +0000
@@ -3991,16 +3991,32 @@
 
   bool isListValue;
 
-  if (parent == rootParent &&
-      typeName != NULL &&
-      (typeName->equals(GET_STORE().theSchemaTypeNames[store::XS_QNAME]) ||
-       typeName->equals(GET_STORE().theSchemaTypeNames[store::XS_NOTATION])))
-  {
-    throw XQUERY_EXCEPTION(err::XQTY0086);
-  }
-
   if (copymode.theTypePreserve)
   {
+    if ((parent == rootParent || copymode.theNsPreserve == false) &&
+        typeName != NULL)
+    {
+      if (theTypedValue->isAtomic())
+      {
+        store::SchemaTypeCode typecode = theTypedValue->getTypeCode();
+
+        if (typecode == store::XS_QNAME || typecode == store::XS_NOTATION)
+          throw XQUERY_EXCEPTION(err::XQTY0086);
+      }
+      else
+      {
+        const std::vector<store::Item_t>& values = getValueVector().getItems();
+        csize numValues = values.size();
+        for (csize i = 0; i < numValues; ++i)
+        {
+          store::SchemaTypeCode typecode = values[i]->getTypeCode();
+
+          if (typecode == store::XS_QNAME || typecode == store::XS_NOTATION)
+            throw XQUERY_EXCEPTION(err::XQTY0086);
+        }
+      }
+    }
+
     typedValue = theTypedValue;
     isListValue = haveListValue();
   }


Follow ups