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

Proposed by David Graf
Status: Merged
Approved by: Till Westmann
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 Approve
David Graf (community) Approve
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.
Revision history for this message
David Graf (davidagraf) :
review: Approve
Revision history for this message
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
Revision history for this message
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.

Revision history for this message
Till Westmann (tillw) wrote :

Of course! I'm sorry about the confusion.

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 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
=== modified file 'src/api/serialization/serializer.cpp'
--- src/api/serialization/serializer.cpp 2012-07-25 23:20:47 +0000
+++ src/api/serialization/serializer.cpp 2012-08-14 07:19:22 +0000
@@ -1220,11 +1220,12 @@
12201220
1221serializer::jsoniq_emitter::jsoniq_emitter(1221serializer::jsoniq_emitter::jsoniq_emitter(
1222 serializer* the_serializer,1222 serializer* the_serializer,
1223 std::ostream& the_stream)1223 std::ostream& the_stream,
1224 bool aEmitAttributes)
1224 :1225 :
1225 emitter(the_serializer, the_stream),1226 emitter(the_serializer, the_stream),
1226 theEmitterState(JESTATE_UNDETERMINED),1227 theEmitterState(JESTATE_UNDETERMINED),
1227 theXMLEmitter(new xml_emitter(the_serializer, the_stream)),1228 theXMLEmitter(new xml_emitter(the_serializer, the_stream, aEmitAttributes)),
1228 theJSONEmitter(new json_emitter(the_serializer, the_stream))1229 theJSONEmitter(new json_emitter(the_serializer, the_stream))
1229{1230{
1230}1231}
@@ -2668,7 +2669,7 @@
2668 else if (method == PARAMETER_VALUE_JSON)2669 else if (method == PARAMETER_VALUE_JSON)
2669 e = new json_emitter(this, *tr);2670 e = new json_emitter(this, *tr);
2670 else if (method == PARAMETER_VALUE_JSONIQ)2671 else if (method == PARAMETER_VALUE_JSONIQ)
2671 e = new jsoniq_emitter(this, *tr);2672 e = new jsoniq_emitter(this, *tr, aEmitAttributes);
2672#endif2673#endif
2673 else2674 else
2674 {2675 {
26752676
=== modified file 'src/api/serialization/serializer.h'
--- src/api/serialization/serializer.h 2012-07-25 00:15:29 +0000
+++ src/api/serialization/serializer.h 2012-08-14 07:19:22 +0000
@@ -423,7 +423,10 @@
423 class jsoniq_emitter : public emitter423 class jsoniq_emitter : public emitter
424 {424 {
425 public:425 public:
426 jsoniq_emitter(serializer* the_serializer, std::ostream& the_stream);426 jsoniq_emitter(
427 serializer* the_serializer,
428 std::ostream& the_stream,
429 bool aEmitAttributes = false);
427430
428 virtual ~jsoniq_emitter();431 virtual ~jsoniq_emitter();
429432

Subscribers

People subscribed via source and target branches