Merge lp:~paul-lucas/zorba/pjl-misc into lp:zorba

Proposed by Paul J. Lucas
Status: Merged
Approved by: Paul J. Lucas
Approved revision: 11461
Merged at revision: 11700
Proposed branch: lp:~paul-lucas/zorba/pjl-misc
Merge into: lp:zorba
Diff against target: 151 lines (+44/-11)
9 files modified
bin/zorbacmd_args.cpp (+2/-2)
src/runtime/csv/csv_impl.cpp (+21/-4)
src/runtime/csv/pregenerated/csv.cpp (+0/-4)
src/runtime/spec/csv/csv.xml (+1/-1)
test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-02.xml.res (+3/-0)
test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-empty.xml.res (+1/-0)
test/rbkt/Queries/zorba/csv/csv-serialize-02.jq (+10/-0)
test/rbkt/Queries/zorba/csv/csv-serialize-02.spec (+1/-0)
test/rbkt/Queries/zorba/csv/csv-serialize-empty.jq (+5/-0)
To merge this branch: bzr merge lp:~paul-lucas/zorba/pjl-misc
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Paul J. Lucas Approve
Review via email: mp+208711@code.launchpad.net

Commit message

1. Fixed assertion failure for ().
2. Fixed state reset bug.
3. Added -n as a synonym for --trailing-nl.

Description of the change

1. Fixed assertion failure for ().
2. Fixed state reset bug.
3. Added -n as a synonym for --trailing-nl.

To post a comment you must log in.
lp:~paul-lucas/zorba/pjl-misc updated
11460. By Paul J. Lucas

New tests.

11461. By Paul J. Lucas

Fixed reset bug.

Revision history for this message
Paul J. Lucas (paul-lucas) :
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~paul-lucas/zorba/pjl-misc/+merge/208711

Progress dashboard at http://jenkins.zorba.io:8180/view/ValidationQueue

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

Validation queue succeeded - proposal merged!

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'bin/zorbacmd_args.cpp'
2--- bin/zorbacmd_args.cpp 2014-02-21 14:58:32 +0000
3+++ bin/zorbacmd_args.cpp 2014-02-28 01:46:33 +0000
4@@ -322,7 +322,7 @@
5 "Trace the translator.\n\n"
6 #endif /* NDEBUG */
7
8- HELP_OPT( "--trailing-nl" )
9+ HELP_OPT( "--trailing-nl, -n" )
10 "Print a trailing newline after the result of the query.\n\n"
11
12 ////////// u //////////////////////////////////////////////////////////////
13@@ -771,7 +771,7 @@
14 else if ( IS_LONG_OPT( "--trace-translator" ) )
15 z_props.setTraceTranslator( true );
16 #endif /* NDEBUG */
17- else if ( IS_LONG_OPT( "--trailing-nl" ) )
18+ else if ( IS_OPT( "--trailing-nl", "-n" ) )
19 zc_props.trailing_nl_ = true;
20
21 ////////// u //////////////////////////////////////////////////////////////
22
23=== modified file 'src/runtime/csv/csv_impl.cpp'
24--- src/runtime/csv/csv_impl.cpp 2014-01-20 16:52:44 +0000
25+++ src/runtime/csv/csv_impl.cpp 2014-02-28 01:46:33 +0000
26@@ -534,6 +534,18 @@
27
28 ///////////////////////////////////////////////////////////////////////////////
29
30+void CsvSerializeIteratorState::reset( PlanState &state ) {
31+ PlanIteratorState::reset( state );
32+ boolean_string_[0] = "false";
33+ boolean_string_[1] = "true";
34+ header_item_ = nullptr;
35+ keys_.clear();
36+ null_string_ = "null";
37+ quote_ = '"';
38+ quote_esc_ = "\"\"";
39+ separator_ = ',';
40+}
41+
42 bool CsvSerializeIterator::nextImpl( store::Item_t &result,
43 PlanState &plan_state ) const {
44 char char_opt;
45@@ -589,7 +601,8 @@
46 while ( i->next( item ) )
47 state->keys_.push_back( item );
48 i->close();
49- }
50+ } else
51+ goto end; // empty sequence: we're done
52 }
53
54 if ( do_header ) {
55@@ -601,9 +614,11 @@
56 separator = true;
57 line += (*key)->getStringValue();
58 }
59- line += "\r\n";
60- GENV_ITEMFACTORY->createString( result, line );
61- STACK_PUSH( true, state );
62+ if ( !line.empty() ) {
63+ line += "\r\n";
64+ GENV_ITEMFACTORY->createString( result, line );
65+ STACK_PUSH( true, state );
66+ }
67 }
68
69 if ( !state->header_item_.isNull() ) {
70@@ -655,6 +670,8 @@
71 GENV_ITEMFACTORY->createString( result, line );
72 STACK_PUSH( true, state );
73 } // while
74+
75+end:
76 STACK_END( state );
77 }
78
79
80=== modified file 'src/runtime/csv/pregenerated/csv.cpp'
81--- src/runtime/csv/pregenerated/csv.cpp 2014-01-31 01:39:38 +0000
82+++ src/runtime/csv/pregenerated/csv.cpp 2014-02-28 01:46:33 +0000
83@@ -111,10 +111,6 @@
84
85 CsvSerializeIteratorState::~CsvSerializeIteratorState() {}
86
87-
88-void CsvSerializeIteratorState::reset(PlanState& planState) {
89- PlanIteratorState::reset(planState);
90-}
91 // </CsvSerializeIterator>
92
93
94
95=== modified file 'src/runtime/spec/csv/csv.xml'
96--- src/runtime/spec/csv/csv.xml 2013-12-27 15:11:16 +0000
97+++ src/runtime/spec/csv/csv.xml 2014-02-28 01:46:33 +0000
98@@ -68,7 +68,7 @@
99 <zorba:output>xs:string*</zorba:output>
100 </zorba:signature>
101 </zorba:function>
102- <zorba:state generateInit="use-default">
103+ <zorba:state generateInit="use-default" generateReset="false">
104 <zorba:member type="zstring" name="boolean_string_[2]"/>
105 <zorba:member type="store::Item_t" name="header_item_"/>
106 <zorba:member type="std::vector&lt;store::Item_t&gt;" name="keys_"/>
107
108=== added file 'test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-02.xml.res'
109--- test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-02.xml.res 1970-01-01 00:00:00 +0000
110+++ test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-02.xml.res 2014-02-28 01:46:33 +0000
111@@ -0,0 +1,3 @@
112+1
113+2
114+3
115
116=== added file 'test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-empty.xml.res'
117--- test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-empty.xml.res 1970-01-01 00:00:00 +0000
118+++ test/rbkt/ExpQueryResults/zorba/csv/csv-serialize-empty.xml.res 2014-02-28 01:46:33 +0000
119@@ -0,0 +1,1 @@
120+
121
122=== added file 'test/rbkt/Queries/zorba/csv/csv-serialize-02.jq'
123--- test/rbkt/Queries/zorba/csv/csv-serialize-02.jq 1970-01-01 00:00:00 +0000
124+++ test/rbkt/Queries/zorba/csv/csv-serialize-02.jq 2014-02-28 01:46:33 +0000
125@@ -0,0 +1,10 @@
126+import module namespace csv = "http://zorba.io/modules/json-csv";
127+
128+let $options := { "serialize-header" : false }
129+return string-join(
130+ for $i in 1 to 3
131+ let $o := { "foo" : $i }
132+ return csv:serialize( $o, $options )
133+)
134+
135+(: vim:set et sw=2 ts=2: :)
136
137=== added file 'test/rbkt/Queries/zorba/csv/csv-serialize-02.spec'
138--- test/rbkt/Queries/zorba/csv/csv-serialize-02.spec 1970-01-01 00:00:00 +0000
139+++ test/rbkt/Queries/zorba/csv/csv-serialize-02.spec 2014-02-28 01:46:33 +0000
140@@ -0,0 +1,1 @@
141+Serialization: method=text
142
143=== added file 'test/rbkt/Queries/zorba/csv/csv-serialize-empty.jq'
144--- test/rbkt/Queries/zorba/csv/csv-serialize-empty.jq 1970-01-01 00:00:00 +0000
145+++ test/rbkt/Queries/zorba/csv/csv-serialize-empty.jq 2014-02-28 01:46:33 +0000
146@@ -0,0 +1,5 @@
147+import module namespace csv = "http://zorba.io/modules/json-csv";
148+
149+csv:serialize( () )
150+
151+(: vim:set syntax=xquery et sw=2 ts=2: :)

Subscribers

People subscribed via source and target branches