Merge lp:~davidagraf/zorba/fn_trace_jsoniq_fix into lp:zorba

Proposed by David Graf on 2012-08-14
Status: Merged
Approved by: Till Westmann on 2012-08-15
Approved revision: 10982
Merged at revision: 10988
Proposed branch: lp:~davidagraf/zorba/fn_trace_jsoniq_fix
Merge into: lp:zorba
Diff against target: 42 lines (+8/-4)
2 files modified
src/api/serialization/serializer.cpp (+4/-3)
src/api/serialization/serializer.h (+4/-1)
To merge this branch: bzr merge lp:~davidagraf/zorba/fn_trace_jsoniq_fix
Reviewer Review Type Date Requested Status
Till Westmann 2012-08-14 Approve on 2012-08-15
David Graf (community) Approve on 2012-08-14
Review via email: mp+119478@code.launchpad.net

Commit message

Because the jsoniq_emitter aggregates the xml_emitter, it needs to handover all the parameters. Inclusive aEmitAttributes.

Description of the change

Because the jsoniq_emitter aggregates the xml_emitter, it needs to handover all the parameters. Inclusive aEmitAttributes.

To post a comment you must log in.
David Graf (davidagraf) :
review: Approve
Till Westmann (tillw) wrote :

I'm trying to run:

zorba -q 'trace(attribute { "a" } { 1 }, "a")'

and that still results in a

serialization error [err:SENR0001]: "1": can not serialize attribute node

Does this work for you?

review: Needs Fixing
David Graf (davidagraf) wrote :

This query doesn't work because the serializer of the query result throws an error. The result of a query must not be an attribute. fn:trace does work on my side:

./bin/zorba -q 'trace(attribute { "a" } { 1 }, "a")'
a [1]: a="1" <========== fn:trace print
<?xml version="1.0" encoding="UTF-8"?>
serialization error [err:SENR0001]: "1": can not serialize attribute node; raised at /home/dagraf/zorba/sandbox/src/api/serialization/serializer.cpp:456

You need to execute something like: ./bin/zorba -q 'data(trace(attribute { "a" } { 1 }, "a"))'
... to not see an error.

Till Westmann (tillw) wrote :

Of course! I'm sorry about the confusion.

review: Approve
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job fn_trace_jsoniq_fix-2012-08-15T15-41-05.154Z 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/api/serialization/serializer.cpp'
2--- src/api/serialization/serializer.cpp 2012-07-25 23:20:47 +0000
3+++ src/api/serialization/serializer.cpp 2012-08-14 07:19:22 +0000
4@@ -1220,11 +1220,12 @@
5
6 serializer::jsoniq_emitter::jsoniq_emitter(
7 serializer* the_serializer,
8- std::ostream& the_stream)
9+ std::ostream& the_stream,
10+ bool aEmitAttributes)
11 :
12 emitter(the_serializer, the_stream),
13 theEmitterState(JESTATE_UNDETERMINED),
14- theXMLEmitter(new xml_emitter(the_serializer, the_stream)),
15+ theXMLEmitter(new xml_emitter(the_serializer, the_stream, aEmitAttributes)),
16 theJSONEmitter(new json_emitter(the_serializer, the_stream))
17 {
18 }
19@@ -2668,7 +2669,7 @@
20 else if (method == PARAMETER_VALUE_JSON)
21 e = new json_emitter(this, *tr);
22 else if (method == PARAMETER_VALUE_JSONIQ)
23- e = new jsoniq_emitter(this, *tr);
24+ e = new jsoniq_emitter(this, *tr, aEmitAttributes);
25 #endif
26 else
27 {
28
29=== modified file 'src/api/serialization/serializer.h'
30--- src/api/serialization/serializer.h 2012-07-25 00:15:29 +0000
31+++ src/api/serialization/serializer.h 2012-08-14 07:19:22 +0000
32@@ -423,7 +423,10 @@
33 class jsoniq_emitter : public emitter
34 {
35 public:
36- jsoniq_emitter(serializer* the_serializer, std::ostream& the_stream);
37+ jsoniq_emitter(
38+ serializer* the_serializer,
39+ std::ostream& the_stream,
40+ bool aEmitAttributes = false);
41
42 virtual ~jsoniq_emitter();
43

Subscribers

People subscribed via source and target branches