Merge lp:~zorba-coders/zorba/fnserialize into lp:zorba

Proposed by Matthias Brantner
Status: Merged
Approved by: Matthias Brantner
Approved revision: 10625
Merged at revision: 10626
Proposed branch: lp:~zorba-coders/zorba/fnserialize
Merge into: lp:zorba
Diff against target: 70 lines (+19/-6)
3 files modified
src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp (+13/-6)
src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h (+2/-0)
src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml (+4/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/fnserialize
Reviewer Review Type Date Requested Status
Till Westmann Approve
Matthias Brantner Approve
Review via email: mp+89504@code.launchpad.net

This proposal supersedes a proposal from 2012-01-20.

Commit message

fn:serialize avoids copying the result but returns a streamable string instead

Description of the change

fn:serialize avoids copying the result but returns a streamable string instead

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fnserialize-2012-01-20T22-20-00.394Z is finished. The final status was:

All tests succeeded!

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Voting does not meet specified criteria. Required: Approve > 1, Disapprove < 1. Got: 1 Approve, 1 Pending.

Revision history for this message
Till Westmann (tillw) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fnserialize-2012-01-20T23-40-03.054Z is finished. The final status was:

All tests succeeded!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2011-08-10 02:50:23 +0000
+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2012-01-20 22:06:28 +0000
@@ -122,12 +122,16 @@
122/*******************************************************************************122/*******************************************************************************
123 14.9.2 fn:serialize123 14.9.2 fn:serialize
124********************************************************************************/124********************************************************************************/
125void
126FnSerializeIterator::streamReleaser(std::istream* s)
127{
128 delete s;
129}
130
125bool131bool
126FnSerializeIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState) const132FnSerializeIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState) const
127{133{
128 store::Item_t lParams;134 store::Item_t lParams;
129 std::stringstream lResultStream;
130 zstring lResult;
131135
132 PlanIteratorState* lState;136 PlanIteratorState* lState;
133 DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);137 DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);
@@ -254,12 +258,15 @@
254 lElemIter->close();258 lElemIter->close();
255 }259 }
256260
257 // and now serialize261 {
258 lSerializer.serialize(lIterWrapper, lResultStream);262 // and now serialize
259 lResult = lResultStream.str();263 std::auto_ptr<std::stringstream> lResultStream(new std::stringstream());
264 lSerializer.serialize(lIterWrapper, *lResultStream.get());
265 GENV_ITEMFACTORY->createStreamableString(aResult, *lResultStream.release(), FnSerializeIterator::streamReleaser, true);
266 }
260 }267 }
268 STACK_PUSH(true, lState);
261269
262 STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, lResult), lState);
263 STACK_END (lState);270 STACK_END (lState);
264}271}
265272
266273
=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h'
--- src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h 2011-10-19 15:28:51 +0000
+++ src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h 2012-01-20 22:06:28 +0000
@@ -95,6 +95,8 @@
9595
96 virtual ~FnSerializeIterator();96 virtual ~FnSerializeIterator();
9797
98public:
99 static void streamReleaser(std::istream* stream);
98 void accept(PlanIterVisitor& v) const;100 void accept(PlanIterVisitor& v) const;
99101
100 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;102 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
101103
=== modified file 'src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml'
--- src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-01-11 17:30:25 +0000
+++ src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-01-20 22:06:28 +0000
@@ -74,6 +74,10 @@
7474
75 </zorba:function>75 </zorba:function>
7676
77 <zorba:method static="true" name="streamReleaser" return="void">
78 <zorba:param type="std::istream*" name="stream"/>
79 </zorba:method>
80
77 </zorba:iterator>81 </zorba:iterator>
78 82
79</zorba:iterators>83</zorba:iterators>

Subscribers

People subscribed via source and target branches