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
1=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
2--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2011-08-10 02:50:23 +0000
3+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp 2012-01-20 22:06:28 +0000
4@@ -122,12 +122,16 @@
5 /*******************************************************************************
6 14.9.2 fn:serialize
7 ********************************************************************************/
8+void
9+FnSerializeIterator::streamReleaser(std::istream* s)
10+{
11+ delete s;
12+}
13+
14 bool
15 FnSerializeIterator::nextImpl(store::Item_t& aResult, PlanState& aPlanState) const
16 {
17 store::Item_t lParams;
18- std::stringstream lResultStream;
19- zstring lResult;
20
21 PlanIteratorState* lState;
22 DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);
23@@ -254,12 +258,15 @@
24 lElemIter->close();
25 }
26
27- // and now serialize
28- lSerializer.serialize(lIterWrapper, lResultStream);
29- lResult = lResultStream.str();
30+ {
31+ // and now serialize
32+ std::auto_ptr<std::stringstream> lResultStream(new std::stringstream());
33+ lSerializer.serialize(lIterWrapper, *lResultStream.get());
34+ GENV_ITEMFACTORY->createStreamableString(aResult, *lResultStream.release(), FnSerializeIterator::streamReleaser, true);
35+ }
36 }
37+ STACK_PUSH(true, lState);
38
39- STACK_PUSH(GENV_ITEMFACTORY->createString(aResult, lResult), lState);
40 STACK_END (lState);
41 }
42
43
44=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h'
45--- src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h 2011-10-19 15:28:51 +0000
46+++ src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h 2012-01-20 22:06:28 +0000
47@@ -95,6 +95,8 @@
48
49 virtual ~FnSerializeIterator();
50
51+public:
52+ static void streamReleaser(std::istream* stream);
53 void accept(PlanIterVisitor& v) const;
54
55 bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
56
57=== modified file 'src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml'
58--- src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-01-11 17:30:25 +0000
59+++ src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml 2012-01-20 22:06:28 +0000
60@@ -74,6 +74,10 @@
61
62 </zorba:function>
63
64+ <zorba:method static="true" name="streamReleaser" return="void">
65+ <zorba:param type="std::istream*" name="stream"/>
66+ </zorba:method>
67+
68 </zorba:iterator>
69
70 </zorba:iterators>

Subscribers

People subscribed via source and target branches