Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-898066 into 
lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Chris Hillery (ceejatec)
Related bugs:
  Bug #898066 in Zorba: "Stringstream & fn:trace"
  https://bugs.launchpad.net/zorba/+bug/898066

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-898066/+merge/116988

- implicitly materialize input to fn:trace
- start sequence numbering in fn:trace with 1
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-898066/+merge/116988
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp'
--- src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp	2012-07-24 08:48:48 +0000
+++ src/runtime/errors_and_diagnostics/errors_and_diagnostics_impl.cpp	2012-07-27 01:02:22 +0000
@@ -94,6 +94,8 @@
   TraceIteratorState *state;
   DEFAULT_STACK_INIT(TraceIteratorState, state, planState);
 
+  state->theIndex = 1; // XQuery sequences start with 1
+
   if (!consumeNext(state->theTagItem, theChildren[1], planState)) 
   {
     throw XQUERY_EXCEPTION(err::FORG0006,
@@ -119,6 +121,18 @@
 
     {
       store::Item_t lTmp = result;
+
+      // implicitly materialize non-seekable streamable strings to 
+      // avoid nasty "streamable string has already been consumed"
+      // errors during debugging
+      if (lTmp->isStreamable() && !lTmp->isSeekable() &&
+          lTmp->getTypeCode() == store::XS_STRING)
+      {
+        zstring lString = lTmp->getString();
+        GENV_ITEMFACTORY->createString(lTmp, lString);
+        result = lTmp;
+      }
+
       store::TempSeq_t lSequence = GENV_STORE.createTempSeq(lTmp);
       store::Iterator_t seq_iter = lSequence->getIterator();
       seq_iter->open();

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