Merge lp:~zorba-coders/zorba/bug-1026250 into lp:zorba

Proposed by Matthias Brantner
Status: Merged
Merged at revision: 11609
Proposed branch: lp:~zorba-coders/zorba/bug-1026250
Merge into: lp:zorba
Diff against target: 993 lines (+563/-31)
31 files modified
include/zorba/pregenerated/diagnostic_list.h (+2/-0)
modules/pregenerated/zorba-errors.xq (+4/-0)
src/compiler/codegen/plan_visitor.cpp (+8/-7)
src/compiler/expression/flwor_expr.cpp (+22/-1)
src/compiler/expression/flwor_expr.h (+5/-2)
src/compiler/parser/parser.y (+4/-10)
src/compiler/parsetree/parsenodes.h (+1/-1)
src/compiler/translator/translator.cpp (+27/-0)
src/diagnostics/diagnostic_en.xml (+5/-1)
src/diagnostics/pregenerated/diagnostic_list.cpp (+3/-0)
src/diagnostics/pregenerated/dict_en.cpp (+2/-1)
src/store/naive/simple_collection.cpp (+25/-6)
src/store/naive/simple_collection.h (+3/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor24.iter (+56/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor25.iter (+56/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor26.iter (+66/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor27.iter (+63/-0)
test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor28.iter (+57/-0)
test/rbkt/ExpQueryResults/zorba/flwor/flwor24.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/flwor/flwor25.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/flwor/flwor27.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/flwor/flwor28.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res (+0/-2)
test/rbkt/Queries/zorba/flwor/flwor24.xml (+5/-0)
test/rbkt/Queries/zorba/flwor/flwor24.xq (+25/-0)
test/rbkt/Queries/zorba/flwor/flwor25.xq (+29/-0)
test/rbkt/Queries/zorba/flwor/flwor26.spec (+1/-0)
test/rbkt/Queries/zorba/flwor/flwor26.xq (+30/-0)
test/rbkt/Queries/zorba/flwor/flwor27.xq (+30/-0)
test/rbkt/Queries/zorba/flwor/flwor28.xq (+29/-0)
test/rbkt/Queries/zorba/scripting/flwor2.spec (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/bug-1026250
Reviewer Review Type Date Requested Status
Markos Zaharioudakis Approve
Matthias Brantner Approve
Review via email: mp+138044@code.launchpad.net

Commit message

fix for bug lp:1026250

Description of the change

- annotation to turn on sequential flwor streaming
- introduce support for pragmas and allows the body of a pragma to be a statement (recent scripting extension)
- collections are versioned in order to avoid deadlocks when modifying a collection that is currently read from (instead raise an error)

To post a comment you must log in.
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

The attempt to merge lp:~zorba-coders/zorba/bug-1026250 into lp:zorba failed. Below is the output from the failed tests.

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:275 (message):
  Validation queue job bug-1026250-2012-12-05T01-32-06.304Z is finished. The
  final status was:

  13 tests did not succeed - changes not commited.

Error in read script: /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

Of the failing tests, only some have been modified. If you changed the default behavior, shouldn't you also have to change every affected test by adding the pragma?

lp:~zorba-coders/zorba/bug-1026250 updated
11088. By Paul J. Lucas

Cosmetic change.

11089. By Paul J. Lucas

Cleaned-up assert message.

11090. By Paul J. Lucas

Added operator<< for flwor_expr::ClauseKind.

11091. By Paul J. Lucas

Cleaned-up assert message.

Revision history for this message
Paul J. Lucas (paul-lucas) wrote :

I modified test flwor10.xq to be:

declare namespace ext = "http://www.zorba-xquery.com/extensions";

variable $x := 0;

(# ext:materialize #) {
  for $i in (1, 2, 3)
  let $y := { $x := $x + $i; () }
  return $x
}

ran it and got:

Zorba error [zerr:ZXQP0002]: "false": assertion failed with the message: ClauseKind = materialize_clause; raised at /Users/pjl/src/flwor/zorba/repo/bug-1026250/zorba/src/compiler/codegen/plan_visitor.cpp:1028

The switch statement doesn't have a case for materialize_clause. Either it should, or it should never be the case that a materialize_clause should occur here.

FYI: I modified the code on the branch to overload operator<< for ClauseKind -- makes it handy for debugging.

Revision history for this message
Chris Hillery (ceejatec) wrote :

Please put a more descriptive commit message for this change.

Revision history for this message
Chris Hillery (ceejatec) wrote :

Matthias will get this scheduled within 28msec, hopefully soon.

lp:~zorba-coders/zorba/bug-1026250 updated
11092. By Federico Cavalieri

Merged trunk into the branch

11093. By Federico Cavalieri

Fixed compilation

11094. By Federico Cavalieri

Inverted annotation semantic

11095. By Federico Cavalieri

Implemented no-streaming extension

Revision history for this message
Federico Cavalieri (fcavalieri) wrote :

Ready for review

Revision history for this message
Ghislain Fourny (gislenius) wrote :

One of the tests uses ext:nomaterialization without dash. Is this intented?

Revision history for this message
Federico Cavalieri (fcavalieri) wrote :

nope, let me fix it

On Wed, Aug 14, 2013 at 3:14 PM, Ghislain Fourny <ghislain.fourny@28msec.com
> wrote:

> One of the tests uses ext:nomaterialization without dash. Is this intented?
> --
> https://code.launchpad.net/~zorba-coders/zorba/bug-1026250/+merge/138044
> Your team Zorba Coders is subscribed to branch lp:zorba.
>
> --
> Mailing list: https://launchpad.net/~zorba-coders
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~zorba-coders
> More help : https://help.launchpad.net/ListHelp
>

lp:~zorba-coders/zorba/bug-1026250 updated
11096. By Federico Cavalieri

Fixed test28

Revision history for this message
Federico Cavalieri (fcavalieri) wrote :

Fixed and pushed

On Wed, Aug 14, 2013 at 9:36 PM, Federico Cavalieri <
federico.cavalieri@28msec.com> wrote:

> nope, let me fix it
>
>
> On Wed, Aug 14, 2013 at 3:14 PM, Ghislain Fourny <
> ghislain.fourny@28msec.com> wrote:
>
>> One of the tests uses ext:nomaterialization without dash. Is this
>> intented?
>> --
>> https://code.launchpad.net/~zorba-coders/zorba/bug-1026250/+merge/138044
>> Your team Zorba Coders is subscribed to branch lp:zorba.
>>
>> --
>> Mailing list: https://launchpad.net/~zorba-coders
>> Post to : <email address hidden>
>> Unsubscribe : https://launchpad.net/~zorba-coders
>> More help : https://help.launchpad.net/ListHelp
>>
>
>

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

Nice change.

The modifications in the following files don't seem to be needed:
- test/rbkt/Queries/zorba/updates/flwor1.xq
- test/rbkt/Queries/zorba/scripting/flwor6.xq
- test/rbkt/Queries/zorba/updates/flwor1.xq
- test/rbkt/Queries/zorba/no-copy/dataguide-c.xq

I'll add Markos as a second reviewer.

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
lp:~zorba-coders/zorba/bug-1026250 updated
11097. By Federico Cavalieri

Completely reverted unnecessary test modifications

11098. By Federico Cavalieri

Reverted additional unnecessary test modification

11099. By Federico Cavalieri

Reverted further unnecessary modifications

Revision history for this message
Federico Cavalieri (fcavalieri) wrote :

Thanks for the review.
Can you explain me why
SYNC_CODE(theCollection->theLatch.rlock();)
and
SYNC_CODE(theCollection->theLatch.unlock();)
has been commented in this branch?
They were already commented in the branch when I started working on it.

Revision history for this message
Matthias Brantner (matthias-brantner) wrote :

> Thanks for the review.
> Can you explain me why
> SYNC_CODE(theCollection->theLatch.rlock();)
> and
> SYNC_CODE(theCollection->theLatch.unlock();)
> has been commented in this branch?
> They were already commented in the branch when I started working on it.
They were causing a deadlock when the collection being read from was modified. This is now fixed using collection versioning. The two lines can be removed.

Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

I did not like very much the versioning solution for the collection deadlock. It certainly does not work with multi-threading. But this is not the only thing that is wrong for multi-threading, so I will approve.

I think a better solution would be that any dml:collection() function that is executed within a nonmaterialize pragma acquires the collection lock in exclussive mode. Of course that would require changes in the compiler, runtime, and store api.

review: Approve
Revision history for this message
Markos Zaharioudakis (markos-za) wrote :

I did not like very much the versioning solution for the collection deadlock. It certainly does not work with multi-threading. But this is not the only thing that is wrong for multi-threading, so I will approve.

I think a better solution would be that any dml:collection() function that is executed within a nonmaterialize pragma acquires the collection lock in exclussive mode. Of course that would require changes in the compiler, runtime, and store api.

review: Approve
Revision history for this message
Federico Cavalieri (fcavalieri) wrote :

Thanks for the feedback.
Merging

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

Validation queue starting for the following merge proposals:
https://code.launchpad.net/~zorba-coders/zorba/bug-1026250/+merge/138044

Progress dashboard at http://jenkins.lambda.nu/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 'include/zorba/pregenerated/diagnostic_list.h'
2--- include/zorba/pregenerated/diagnostic_list.h 2013-08-01 09:41:39 +0000
3+++ include/zorba/pregenerated/diagnostic_list.h 2013-08-16 07:08:59 +0000
4@@ -692,6 +692,8 @@
5
6 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0040_INCONSISTENT_EDIT;
7
8+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION;
9+
10 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED;
11
12 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED;
13
14=== modified file 'modules/pregenerated/zorba-errors.xq'
15--- modules/pregenerated/zorba-errors.xq 2013-08-07 05:28:39 +0000
16+++ modules/pregenerated/zorba-errors.xq 2013-08-16 07:08:59 +0000
17@@ -602,6 +602,10 @@
18
19 (:~
20 :)
21+declare variable $zerr:ZDDY0041 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0041");
22+
23+(:~
24+:)
25 declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001");
26
27 (:~
28
29=== modified file 'src/compiler/codegen/plan_visitor.cpp'
30--- src/compiler/codegen/plan_visitor.cpp 2013-07-01 18:59:06 +0000
31+++ src/compiler/codegen/plan_visitor.cpp 2013-08-16 07:08:59 +0000
32@@ -935,6 +935,9 @@
33
34 if (v.is_sequential())
35 {
36+ pragma* pr = 0;
37+ theCCB->lookup_pragma(&v, "no-materialization", pr);
38+
39 if (!isGeneral)
40 {
41 if (v.has_sequential_clauses())
42@@ -983,15 +986,13 @@
43
44 // Note: a materialize clause may exist already in case plan serialization
45 // is on (see comment in materialize_clause::clone)
46- if (!isGeneral &&
47+ if (!pr && !isGeneral &&
48 v.get_return_expr()->is_sequential() &&
49 v.get_clause(numClauses-1)->get_kind() != flwor_clause::materialize_clause &&
50 (v.get_order_clause() != NULL || v.get_group_clause() == NULL))
51 {
52- materialize_clause* mat =
53- theCCB->theEM->create_materialize_clause(v.get_sctx(),
54+ materialize_clause* mat = theCCB->theEM->create_materialize_clause(v.get_sctx(),
55 v.get_return_expr()->get_loc());
56-
57 v.add_clause(mat);
58 ++numClauses;
59 }
60@@ -1027,7 +1028,7 @@
61 ++numForClauses;
62 }
63
64- if (domExpr->is_sequential() &&
65+ if (!pr && domExpr->is_sequential() &&
66 (k == flwor_clause::for_clause ||
67 k == flwor_clause::window_clause ||
68 numForClauses > 0))
69@@ -1066,8 +1067,8 @@
70 break;
71 }
72 default:
73- ZORBA_ASSERT(false);
74- }
75+ ZORBA_ASSERT_WITH_MSG(false, "ClauseKind = " << k);
76+ } // switch
77
78 ++i;
79 }
80
81=== modified file 'src/compiler/expression/flwor_expr.cpp'
82--- src/compiler/expression/flwor_expr.cpp 2013-06-14 04:50:39 +0000
83+++ src/compiler/expression/flwor_expr.cpp 2013-08-16 07:08:59 +0000
84@@ -52,6 +52,27 @@
85 /*******************************************************************************
86
87 ********************************************************************************/
88+std::ostream& operator<<( std::ostream &o, flwor_clause::ClauseKind k ) {
89+ char const *const s[] = {
90+ "for_clause",
91+ "let_clause",
92+ "window_clause",
93+ "group_clause",
94+ "order_clause",
95+ "count_clause",
96+ "where_clause",
97+ "materialize_clause"
98+ };
99+ if ( k >= flwor_clause::for_clause && k <= flwor_clause::materialize_clause )
100+ o << s[k];
101+ else
102+ o << "[invalid ClauseKind: " << (int)k << ']';
103+ return o;
104+}
105+
106+/*******************************************************************************
107+
108+********************************************************************************/
109 forletwin_clause::forletwin_clause(
110 static_context* sctx,
111 CompilerCB* ccb,
112@@ -671,7 +692,7 @@
113 expr::substitution_t& subst) const
114 {
115 // we will reach here under the following scenario:
116- // 1. We do plan seriazation
117+ // 1. We do plan serialization
118 // 2. getPlan is called on udf A; this causes a mat clause to be created
119 // during the codegen on A's body
120 // 3. getPlan is called on udf B, which invokes A, and A's body is
121
122=== modified file 'src/compiler/expression/flwor_expr.h'
123--- src/compiler/expression/flwor_expr.h 2013-06-14 04:50:39 +0000
124+++ src/compiler/expression/flwor_expr.h 2013-08-16 07:08:59 +0000
125@@ -50,7 +50,7 @@
126 public:
127 typedef var_rebind_list_t rebind_list_t;
128
129- typedef enum
130+ enum ClauseKind
131 {
132 for_clause,
133 let_clause,
134@@ -60,7 +60,8 @@
135 count_clause,
136 where_clause,
137 materialize_clause
138- } ClauseKind;
139+ // if you change this, also ensure that operator<< for it is still correct
140+ };
141
142 protected:
143 static_context * theContext;
144@@ -106,6 +107,8 @@
145 expr::substitution_t& substitution) const = 0;
146 };
147
148+// for debugging
149+std::ostream& operator<<( std::ostream&, flwor_clause::ClauseKind );
150
151 /***************************************************************************//**
152
153
154=== modified file 'src/compiler/parser/parser.y'
155--- src/compiler/parser/parser.y 2013-06-17 20:05:21 +0000
156+++ src/compiler/parser/parser.y 2013-08-16 07:08:59 +0000
157@@ -4048,16 +4048,10 @@
158
159 // [64]
160 ExtensionExpr :
161- Pragma_list LBRACE RBRACE
162- {
163- $$ = new ExtensionExpr(
164- LOC(@$), dynamic_cast<PragmaList*>($1), NULL
165- );
166- }
167- | Pragma_list LBRACE Expr RBRACE
168- {
169- $$ = new ExtensionExpr(
170- LOC(@$), dynamic_cast<PragmaList*>($1), $3
171+ Pragma_list BlockExpr
172+ {
173+ $$ = new ExtensionExpr(
174+ LOC(@$), dynamic_cast<PragmaList*>($1), $2
175 );
176 }
177 ;
178
179=== modified file 'src/compiler/parsetree/parsenodes.h'
180--- src/compiler/parsetree/parsenodes.h 2013-08-05 13:20:52 +0000
181+++ src/compiler/parsetree/parsenodes.h 2013-08-16 07:08:59 +0000
182@@ -3506,7 +3506,7 @@
183
184
185 /*******************************************************************************
186- [88] ExtensionExpr ::= PragmaList "{" Expr? "}"
187+ [88] ExtensionExpr ::= PragmaList BlockExpr
188 ********************************************************************************/
189 class ExtensionExpr : public exprnode
190 {
191
192=== modified file 'src/compiler/translator/translator.cpp'
193--- src/compiler/translator/translator.cpp 2013-08-12 09:28:02 +0000
194+++ src/compiler/translator/translator.cpp 2013-08-16 07:08:59 +0000
195@@ -2451,6 +2451,31 @@
196 }
197
198
199+/*******************************************************************************
200+********************************************************************************/
201+void
202+recognizePragma(expr* e, const zstring& aLocalName)
203+{
204+ for (std::vector<pragma*>::const_iterator lIter = theScopedPragmas.begin();
205+ lIter != theScopedPragmas.end();
206+ ++lIter)
207+ {
208+ pragma* p = *lIter;
209+ if (p->theQName->getNamespace() == ZORBA_EXTENSIONS_NS)
210+ {
211+ if (p->theQName->getLocalName() == aLocalName)
212+ {
213+ e->get_ccb()->add_pragma(e, p);
214+ e->setContainsPragma(ANNOTATION_TRUE);
215+ break;
216+ }
217+ }
218+ }
219+}
220+
221+
222+
223+
224 /////////////////////////////////////////////////////////////////////////////////
225 // //
226 // Module, VersionDecl, MainModule, LibraryModule, ModuleDecl //
227@@ -6938,6 +6963,8 @@
228
229 theFlworClausesStack.resize(curClausePos);
230
231+ recognizePragma(flwor, "no-materialization");
232+
233 push_nodestack(flwor);
234 }
235
236
237=== modified file 'src/diagnostics/diagnostic_en.xml'
238--- src/diagnostics/diagnostic_en.xml 2013-08-14 04:05:45 +0000
239+++ src/diagnostics/diagnostic_en.xml 2013-08-16 07:08:59 +0000
240@@ -2279,7 +2279,7 @@
241 A Zorba programming assertion failed. If this error occurs, it is a bug
242 and should be reported.
243 </comment>
244- <value>"$1": assertion failed.${ The following information might help: 2}</value>
245+ <value>"$1": assertion failed${ with the message: 2}</value>
246 </diagnostic>
247
248 <diagnostic code="ZXQP0003" name="INTERNAL_ERROR">
249@@ -2847,6 +2847,10 @@
250 <diagnostic code="ZDDY0040" name="INCONSISTENT_EDIT">
251 <value>attempt to edit an item with a template of a different kind (for example an object with a node).</value>
252 </diagnostic>
253+
254+ <diagnostic code="ZDDY0041" name="CONCURRENT_MODIFICATION">
255+ <value>"$1": collection was modified while reading</value>
256+ </diagnostic>
257
258 <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED">
259 <value>"$1": collection already declared</value>
260
261=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
262--- src/diagnostics/pregenerated/diagnostic_list.cpp 2013-08-01 09:41:39 +0000
263+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2013-08-16 07:08:59 +0000
264@@ -1017,6 +1017,9 @@
265 ZorbaErrorCode ZDDY0040_INCONSISTENT_EDIT( "ZDDY0040" );
266
267
268+ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION( "ZDDY0041" );
269+
270+
271 ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" );
272
273
274
275=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
276--- src/diagnostics/pregenerated/dict_en.cpp 2013-08-14 04:12:57 +0000
277+++ src/diagnostics/pregenerated/dict_en.cpp 2013-08-16 07:08:59 +0000
278@@ -356,6 +356,7 @@
279 { "ZDDY0038", "\"$1\": illegal edit from queue collection" },
280 { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" },
281 { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." },
282+ { "ZDDY0041", "\"$1\": collection was modified while reading" },
283 { "ZDST0001", "\"$1\": collection already declared" },
284 { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" },
285 { "ZDST0003", "\"$1\": collection declaration not allowed in main module" },
286@@ -462,7 +463,7 @@
287 { "ZXQD0006", "\"$1\": invalid UTF-8 byte sequence" },
288 { "ZXQP0000", "no error" },
289 { "ZXQP0001", "dynamic runtime error${: 1}" },
290- { "ZXQP0002", "\"$1\": assertion failed.${ The following information might help: 2}" },
291+ { "ZXQP0002", "\"$1\": assertion failed${ with the message: 2}" },
292 { "ZXQP0003", "internal error${: 1}" },
293 { "ZXQP0004", "not yet implemented: $1" },
294 { "ZXQP0005", "\"$1\": feature not enabled" },
295
296=== modified file 'src/store/naive/simple_collection.cpp'
297--- src/store/naive/simple_collection.cpp 2013-06-15 02:57:08 +0000
298+++ src/store/naive/simple_collection.cpp 2013-08-16 07:08:59 +0000
299@@ -41,8 +41,9 @@
300 bool isDynamic)
301 :
302 Collection(name),
303- theIsDynamic(isDynamic),
304- theAnnotations(annotations)
305+ theIsDynamic(isDynamic),
306+ theAnnotations(annotations),
307+ theVersion(0)
308 {
309 theId = GET_STORE().createCollectionId();
310 theTreeIdGenerator = GET_STORE().getTreeIdGeneratorFactory().createTreeGenerator(0);
311@@ -55,7 +56,8 @@
312 ********************************************************************************/
313 SimpleCollection::SimpleCollection()
314 :
315- theIsDynamic(false)
316+ theIsDynamic(false),
317+ theVersion(0)
318 {
319 theTreeIdGenerator = GET_STORE().getTreeIdGeneratorFactory().createTreeGenerator(0);
320 }
321@@ -282,7 +284,8 @@
322 ERROR_PARAMS(ZED(ZXQD0004_NOT_WITHIN_RANGE), position)
323 );
324 }
325-
326+
327+ ++theVersion;
328 }
329
330
331@@ -382,6 +385,8 @@
332 theTrees[targetPos + i].transfer(items[i]);
333 }
334
335+ ++theVersion;
336+
337 return xs_integer(targetPos);
338 }
339
340@@ -415,6 +420,7 @@
341 {
342 csize pos = to_xs_unsignedInt(position);
343 theTrees.erase(theTrees.begin() + pos);
344+ ++theVersion;
345 return true;
346 }
347 catch (const std::range_error&)
348@@ -468,6 +474,7 @@
349 structuredItem->detachFromCollection();
350
351 theTrees.erase(theTrees.begin() + pos);
352+ ++theVersion;
353 return true;
354 }
355 }
356@@ -533,6 +540,7 @@
357 theTrees.erase(theTrees.begin() + pos);
358 }
359
360+ ++theVersion;
361 return xs_integer(last - pos);
362 }
363 }
364@@ -623,11 +631,14 @@
365 ********************************************************************************/
366 void SimpleCollection::CollectionIter::open()
367 {
368- SYNC_CODE(theCollection->theLatch.rlock();)
369+ //SYNC_CODE(theCollection->theLatch.rlock();)
370 theHaveLock = true;
371
372 theIterator = theCollection->theTrees.begin();
373 theEnd = theCollection->theTrees.end();
374+
375+ theVersion = theCollection->theVersion;
376+
377 skip();
378 }
379
380@@ -637,6 +648,12 @@
381 ********************************************************************************/
382 bool SimpleCollection::CollectionIter::next(store::Item_t& result)
383 {
384+ if (theVersion != theCollection->theVersion)
385+ {
386+ throw ZORBA_EXCEPTION(zerr::ZDDY0041_CONCURRENT_MODIFICATION,
387+ ERROR_PARAMS(theCollection->getName()->getStringValue()));
388+ }
389+
390 if (!theHaveLock)
391 {
392 throw ZORBA_EXCEPTION(zerr::ZDDY0019_COLLECTION_ITERATOR_NOT_OPEN,
393@@ -663,6 +680,8 @@
394 {
395 theIterator = theCollection->theTrees.begin();
396 theEnd = theCollection->theTrees.end();
397+
398+ theVersion = theCollection->theVersion;
399 skip();
400 }
401
402@@ -674,7 +693,7 @@
403 {
404 assert(theHaveLock);
405 theHaveLock = false;
406- SYNC_CODE(theCollection->theLatch.unlock();)
407+ //SYNC_CODE(theCollection->theLatch.unlock();)
408 }
409
410 } // namespace simplestore
411
412=== modified file 'src/store/naive/simple_collection.h'
413--- src/store/naive/simple_collection.h 2013-02-26 04:12:43 +0000
414+++ src/store/naive/simple_collection.h 2013-08-16 07:08:59 +0000
415@@ -84,6 +84,7 @@
416 checked_vector<store::Item_t>::iterator theEnd;
417 bool theHaveLock;
418 csize theSkip;
419+ ulong theVersion;
420
421 public:
422 CollectionIter(SimpleCollection* collection, const xs_integer& skip);
423@@ -111,6 +112,8 @@
424
425 const std::vector<store::Annotation_t> theAnnotations;
426
427+ ulong theVersion;
428+
429 SYNC_CODE(Latch theLatch;)
430
431 protected:
432
433=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor24.iter'
434--- test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor24.iter 1970-01-01 00:00:00 +0000
435+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor24.iter 2013-08-16 07:08:59 +0000
436@@ -0,0 +1,56 @@
437+Iterator tree for const-folded expr:
438+<FunctionTraceIterator>
439+ <FnConcatIterator/>
440+</FunctionTraceIterator>
441+
442+Iterator tree for main query:
443+<SequentialIterator>
444+ <CtxVarDeclareIterator varid="4" varname="xmlcontents">
445+ <UDFunctionCallIterator function="fetch:content">
446+ <SingletonIterator value="xs:string($RBKT_SRC_DIR/Queries/zorba/flwor/flwor24.xml)"/>
447+ </UDFunctionCallIterator>
448+ </CtxVarDeclareIterator>
449+ <flwor::FLWORIterator>
450+ <ForVariable name="w">
451+ <FnZorbaParseXmlFragmentIterator>
452+ <PromoteIterator type="xs:string">
453+ <FnDataIterator>
454+ <CtxVarIterator varid="4" varname="xmlcontents" varkind="local"/>
455+ </FnDataIterator>
456+ </PromoteIterator>
457+ <TreatIterator type="[NodeXQType elementNode nametest=[uri: http://zorba.io/modules/xml-options, local: options] content=[XQType ANY_TYPE_KIND*]]" quant="?">
458+ <ElementIterator>
459+ <SingletonIterator value="xs:QName(http://zorba.io/modules/xml-options,opt,options)"/>
460+ <ElementIterator>
461+ <SingletonIterator value="xs:QName(http://zorba.io/modules/xml-options,opt,parse-external-parsed-entity)"/>
462+ <AttributeIterator qname="xs:QName(http://zorba.io/modules/xml-options,opt,skip-root-nodes)">
463+ <SingletonIterator value="xs:string(1)"/>
464+ </AttributeIterator>
465+ </ElementIterator>
466+ </ElementIterator>
467+ </TreatIterator>
468+ </FnZorbaParseXmlFragmentIterator>
469+ </ForVariable>
470+ <MaterializeClause>
471+ <MaterializeForVariable inputVar="w : "/>
472+ </MaterializeClause>
473+ <ReturnClause>
474+ <SequentialIterator>
475+ <ApplyIterator>
476+ <FnConcatIterator/>
477+ </ApplyIterator>
478+ <ForVarIterator varname="w"/>
479+ </SequentialIterator>
480+ </ReturnClause>
481+ </flwor::FLWORIterator>
482+</SequentialIterator>
483+
484+Iterator tree for fetch:content:
485+<FunctionTraceIterator>
486+ <FetchContentIterator>
487+ <LetVarIterator varname="uri"/>
488+ <SingletonIterator value="xs:string(SOME_CONTENT)"/>
489+ <SingletonIterator value="xs:string(UTF-8)"/>
490+ </FetchContentIterator>
491+</FunctionTraceIterator>
492+
493
494=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor25.iter'
495--- test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor25.iter 1970-01-01 00:00:00 +0000
496+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor25.iter 2013-08-16 07:08:59 +0000
497@@ -0,0 +1,56 @@
498+Iterator tree for const-folded expr:
499+<FunctionTraceIterator>
500+ <FnConcatIterator/>
501+</FunctionTraceIterator>
502+
503+Iterator tree for main query:
504+<SequentialIterator>
505+ <CtxVarDeclareIterator varid="4" varname="xmlcontents">
506+ <UDFunctionCallIterator function="fetch:content">
507+ <SingletonIterator value="xs:string($RBKT_SRC_DIR/Queries/zorba/flwor/flwor24.xml)"/>
508+ </UDFunctionCallIterator>
509+ </CtxVarDeclareIterator>
510+ <CtxVarDeclareIterator varid="5" varname="contents">
511+ <FnZorbaParseXmlFragmentIterator>
512+ <PromoteIterator type="xs:string">
513+ <FnDataIterator>
514+ <CtxVarIterator varid="4" varname="xmlcontents" varkind="local"/>
515+ </FnDataIterator>
516+ </PromoteIterator>
517+ <TreatIterator type="[NodeXQType elementNode nametest=[uri: http://zorba.io/modules/xml-options, local: options] content=[XQType ANY_TYPE_KIND*]]" quant="?">
518+ <ElementIterator>
519+ <SingletonIterator value="xs:QName(http://zorba.io/modules/xml-options,opt,options)"/>
520+ <ElementIterator>
521+ <SingletonIterator value="xs:QName(http://zorba.io/modules/xml-options,opt,parse-external-parsed-entity)"/>
522+ <AttributeIterator qname="xs:QName(http://zorba.io/modules/xml-options,opt,skip-root-nodes)">
523+ <SingletonIterator value="xs:string(1)"/>
524+ </AttributeIterator>
525+ </ElementIterator>
526+ </ElementIterator>
527+ </TreatIterator>
528+ </FnZorbaParseXmlFragmentIterator>
529+ </CtxVarDeclareIterator>
530+ <flwor::FLWORIterator>
531+ <ForVariable name="w">
532+ <CtxVarIterator varid="5" varname="contents" varkind="local"/>
533+ </ForVariable>
534+ <ReturnClause>
535+ <SequentialIterator>
536+ <ApplyIterator>
537+ <FnConcatIterator/>
538+ </ApplyIterator>
539+ <ForVarIterator varname="w"/>
540+ </SequentialIterator>
541+ </ReturnClause>
542+ </flwor::FLWORIterator>
543+</SequentialIterator>
544+
545+Iterator tree for fetch:content:
546+<FunctionTraceIterator>
547+ <FetchContentIterator>
548+ <LetVarIterator varname="uri"/>
549+ <SingletonIterator value="xs:string(SOME_CONTENT)"/>
550+ <SingletonIterator value="xs:string(UTF-8)"/>
551+ </FetchContentIterator>
552+</FunctionTraceIterator>
553+
554
555=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor26.iter'
556--- test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor26.iter 1970-01-01 00:00:00 +0000
557+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor26.iter 2013-08-16 07:08:59 +0000
558@@ -0,0 +1,66 @@
559+Iterator tree for main query:
560+<SequentialIterator>
561+ <CtxVarDeclareIterator varid="4" varname="coll">
562+ <SingletonIterator value="xs:QName(http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl,ddl,coll1)"/>
563+ </CtxVarDeclareIterator>
564+ <SequentialIterator>
565+ <ApplyIterator>
566+ <ZorbaCreateCollectionIterator>
567+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
568+ </ZorbaCreateCollectionIterator>
569+ </ApplyIterator>
570+ <ApplyIterator>
571+ <ZorbaInsertNodesLastIterator is-dynamic="true" need-to-copy="true">
572+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
573+ <FnConcatIterator>
574+ <ElementIterator>
575+ <SingletonIterator value="xs:QName(,,a)"/>
576+ </ElementIterator>
577+ <ElementIterator>
578+ <SingletonIterator value="xs:QName(,,c)"/>
579+ </ElementIterator>
580+ <ElementIterator>
581+ <SingletonIterator value="xs:QName(,,b)"/>
582+ </ElementIterator>
583+ </FnConcatIterator>
584+ </ZorbaInsertNodesLastIterator>
585+ </ApplyIterator>
586+ <flwor::FLWORIterator>
587+ <ForVariable name="w">
588+ <ZorbaCollectionIterator>
589+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
590+ </ZorbaCollectionIterator>
591+ </ForVariable>
592+ <ReturnClause>
593+ <SequentialIterator>
594+ <ApplyIterator>
595+ <FunctionTraceIterator>
596+ <IfThenElseIterator>
597+ <TypedValueCompareIterator_INTEGER>
598+ <ForVarIterator varname="pos"/>
599+ <SingletonIterator value="xs:integer(1)"/>
600+ </TypedValueCompareIterator_INTEGER>
601+ <ApplyIterator>
602+ <ZorbaInsertNodesLastIterator is-dynamic="true" need-to-copy="true">
603+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
604+ <ElementIterator>
605+ <SingletonIterator value="xs:QName(,,d)"/>
606+ <EnclosedIterator attr_cont="false">
607+ <ForVarIterator varname="pos"/>
608+ </EnclosedIterator>
609+ </ElementIterator>
610+ </ZorbaInsertNodesLastIterator>
611+ </ApplyIterator>
612+ <ApplyIterator>
613+ <FnConcatIterator/>
614+ </ApplyIterator>
615+ </IfThenElseIterator>
616+ </FunctionTraceIterator>
617+ </ApplyIterator>
618+ <ForVarIterator varname="w"/>
619+ </SequentialIterator>
620+ </ReturnClause>
621+ </flwor::FLWORIterator>
622+ </SequentialIterator>
623+</SequentialIterator>
624+
625
626=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor27.iter'
627--- test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor27.iter 1970-01-01 00:00:00 +0000
628+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor27.iter 2013-08-16 07:08:59 +0000
629@@ -0,0 +1,63 @@
630+Iterator tree for const-folded expr:
631+<FunctionTraceIterator>
632+ <FnConcatIterator/>
633+</FunctionTraceIterator>
634+
635+Iterator tree for main query:
636+<SequentialIterator>
637+ <CtxVarDeclareIterator varid="4" varname="xmlcontents">
638+ <UDFunctionCallIterator function="fetch:content">
639+ <SingletonIterator value="xs:string($RBKT_SRC_DIR/Queries/zorba/flwor/flwor24.xml)"/>
640+ </UDFunctionCallIterator>
641+ </CtxVarDeclareIterator>
642+ <CtxVarDeclareIterator varid="5" varname="contents">
643+ <FnZorbaParseXmlFragmentIterator>
644+ <PromoteIterator type="xs:string">
645+ <FnDataIterator>
646+ <CtxVarIterator varid="4" varname="xmlcontents" varkind="local"/>
647+ </FnDataIterator>
648+ </PromoteIterator>
649+ <TreatIterator type="[NodeXQType elementNode nametest=[uri: http://zorba.io/modules/xml-options, local: options] content=[XQType ANY_TYPE_KIND*]]" quant="?">
650+ <ElementIterator>
651+ <SingletonIterator value="xs:QName(http://zorba.io/modules/xml-options,opt,options)"/>
652+ <ElementIterator>
653+ <SingletonIterator value="xs:QName(http://zorba.io/modules/xml-options,opt,parse-external-parsed-entity)"/>
654+ <AttributeIterator qname="xs:QName(http://zorba.io/modules/xml-options,opt,skip-root-nodes)">
655+ <SingletonIterator value="xs:string(1)"/>
656+ </AttributeIterator>
657+ </ElementIterator>
658+ </ElementIterator>
659+ </TreatIterator>
660+ </FnZorbaParseXmlFragmentIterator>
661+ </CtxVarDeclareIterator>
662+ <flwor::FLWORIterator>
663+ <ForVariable name="w">
664+ <CtxVarIterator varid="5" varname="contents" varkind="local"/>
665+ </ForVariable>
666+ <OrderBySpec>
667+ <FnLocalNameIterator>
668+ <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="?">
669+ <ForVarIterator varname="w"/>
670+ </TreatIterator>
671+ </FnLocalNameIterator>
672+ </OrderBySpec>
673+ <ReturnClause>
674+ <SequentialIterator>
675+ <ApplyIterator>
676+ <FnConcatIterator/>
677+ </ApplyIterator>
678+ <ForVarIterator varname="w"/>
679+ </SequentialIterator>
680+ </ReturnClause>
681+ </flwor::FLWORIterator>
682+</SequentialIterator>
683+
684+Iterator tree for fetch:content:
685+<FunctionTraceIterator>
686+ <FetchContentIterator>
687+ <LetVarIterator varname="uri"/>
688+ <SingletonIterator value="xs:string(SOME_CONTENT)"/>
689+ <SingletonIterator value="xs:string(UTF-8)"/>
690+ </FetchContentIterator>
691+</FunctionTraceIterator>
692+
693
694=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor28.iter'
695--- test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor28.iter 1970-01-01 00:00:00 +0000
696+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/flwor/flwor28.iter 2013-08-16 07:08:59 +0000
697@@ -0,0 +1,57 @@
698+Iterator tree for const-folded expr:
699+<FunctionTraceIterator>
700+ <FnConcatIterator/>
701+</FunctionTraceIterator>
702+
703+Iterator tree for main query:
704+<SequentialIterator>
705+ <CtxVarDeclareIterator varid="4" varname="coll">
706+ <SingletonIterator value="xs:QName(http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl,ddl,coll1)"/>
707+ </CtxVarDeclareIterator>
708+ <SequentialIterator>
709+ <ApplyIterator>
710+ <ZorbaCreateCollectionIterator>
711+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
712+ </ZorbaCreateCollectionIterator>
713+ </ApplyIterator>
714+ <ApplyIterator>
715+ <ZorbaInsertNodesLastIterator is-dynamic="true" need-to-copy="true">
716+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
717+ <FnConcatIterator>
718+ <ElementIterator>
719+ <SingletonIterator value="xs:QName(,,a)"/>
720+ </ElementIterator>
721+ <ElementIterator>
722+ <SingletonIterator value="xs:QName(,,c)"/>
723+ </ElementIterator>
724+ <ElementIterator>
725+ <SingletonIterator value="xs:QName(,,b)"/>
726+ </ElementIterator>
727+ </FnConcatIterator>
728+ </ZorbaInsertNodesLastIterator>
729+ </ApplyIterator>
730+ <flwor::FLWORIterator>
731+ <ForVariable name="w">
732+ <ZorbaCollectionIterator>
733+ <CtxVarIterator varid="4" varname="coll" varkind="global"/>
734+ </ZorbaCollectionIterator>
735+ </ForVariable>
736+ <OrderBySpec>
737+ <FnLocalNameIterator>
738+ <TreatIterator type="[NodeXQType anyNode content=[XQType ANY_TYPE_KIND*]]" quant="?">
739+ <ForVarIterator varname="w"/>
740+ </TreatIterator>
741+ </FnLocalNameIterator>
742+ </OrderBySpec>
743+ <ReturnClause>
744+ <SequentialIterator>
745+ <ApplyIterator>
746+ <FnConcatIterator/>
747+ </ApplyIterator>
748+ <ForVarIterator varname="w"/>
749+ </SequentialIterator>
750+ </ReturnClause>
751+ </flwor::FLWORIterator>
752+ </SequentialIterator>
753+</SequentialIterator>
754+
755
756=== added file 'test/rbkt/ExpQueryResults/zorba/flwor/flwor24.xml.res'
757--- test/rbkt/ExpQueryResults/zorba/flwor/flwor24.xml.res 1970-01-01 00:00:00 +0000
758+++ test/rbkt/ExpQueryResults/zorba/flwor/flwor24.xml.res 2013-08-16 07:08:59 +0000
759@@ -0,0 +1,1 @@
760+<a/><c/><b/>
761\ No newline at end of file
762
763=== added file 'test/rbkt/ExpQueryResults/zorba/flwor/flwor25.xml.res'
764--- test/rbkt/ExpQueryResults/zorba/flwor/flwor25.xml.res 1970-01-01 00:00:00 +0000
765+++ test/rbkt/ExpQueryResults/zorba/flwor/flwor25.xml.res 2013-08-16 07:08:59 +0000
766@@ -0,0 +1,1 @@
767+<a/><c/><b/>
768\ No newline at end of file
769
770=== added file 'test/rbkt/ExpQueryResults/zorba/flwor/flwor27.xml.res'
771--- test/rbkt/ExpQueryResults/zorba/flwor/flwor27.xml.res 1970-01-01 00:00:00 +0000
772+++ test/rbkt/ExpQueryResults/zorba/flwor/flwor27.xml.res 2013-08-16 07:08:59 +0000
773@@ -0,0 +1,1 @@
774+<c/><b/><a/>
775\ No newline at end of file
776
777=== added file 'test/rbkt/ExpQueryResults/zorba/flwor/flwor28.xml.res'
778--- test/rbkt/ExpQueryResults/zorba/flwor/flwor28.xml.res 1970-01-01 00:00:00 +0000
779+++ test/rbkt/ExpQueryResults/zorba/flwor/flwor28.xml.res 2013-08-16 07:08:59 +0000
780@@ -0,0 +1,1 @@
781+<c/><b/><a/>
782\ No newline at end of file
783
784=== added file 'test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res'
785--- test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res 1970-01-01 00:00:00 +0000
786+++ test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res 2013-08-16 07:08:59 +0000
787@@ -0,0 +1,2 @@
788+<?xml version="1.0" encoding="UTF-8"?>
789+true
790
791=== removed file 'test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res'
792--- test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res 2013-02-07 17:24:36 +0000
793+++ test/rbkt/ExpQueryResults/zorba/scripting/flwor2.xml.res 1970-01-01 00:00:00 +0000
794@@ -1,2 +0,0 @@
795-<?xml version="1.0" encoding="UTF-8"?>
796-true
797
798=== added file 'test/rbkt/Queries/zorba/flwor/flwor24.xml'
799--- test/rbkt/Queries/zorba/flwor/flwor24.xml 1970-01-01 00:00:00 +0000
800+++ test/rbkt/Queries/zorba/flwor/flwor24.xml 2013-08-16 07:08:59 +0000
801@@ -0,0 +1,5 @@
802+<root>
803+ <a/>
804+ <c/>
805+ <b/>
806+</root>
807\ No newline at end of file
808
809=== added file 'test/rbkt/Queries/zorba/flwor/flwor24.xq'
810--- test/rbkt/Queries/zorba/flwor/flwor24.xq 1970-01-01 00:00:00 +0000
811+++ test/rbkt/Queries/zorba/flwor/flwor24.xq 2013-08-16 07:08:59 +0000
812@@ -0,0 +1,25 @@
813+import module namespace parse-xml = "http://zorba.io/modules/xml";
814+import schema namespace opt = "http://zorba.io/modules/xml-options";
815+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
816+
817+declare namespace an = "http://zorba.io/annotations";
818+
819+declare %an:sequential function local:test-sequential()
820+{
821+
822+};
823+
824+variable $xmlcontents := fetch:content("$RBKT_SRC_DIR/Queries/zorba/flwor/flwor24.xml");
825+
826+let $contents := parse-xml:parse(
827+ $xmlcontents,
828+ <opt:options>
829+ <opt:parse-external-parsed-entity opt:skip-root-nodes="1" />
830+ </opt:options>)
831+
832+for $w at $pos in $contents
833+return
834+{
835+ local:test-sequential();
836+ $w
837+}
838\ No newline at end of file
839
840=== added file 'test/rbkt/Queries/zorba/flwor/flwor25.xq'
841--- test/rbkt/Queries/zorba/flwor/flwor25.xq 1970-01-01 00:00:00 +0000
842+++ test/rbkt/Queries/zorba/flwor/flwor25.xq 2013-08-16 07:08:59 +0000
843@@ -0,0 +1,29 @@
844+import module namespace parse-xml = "http://zorba.io/modules/xml";
845+import schema namespace opt = "http://zorba.io/modules/xml-options";
846+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
847+
848+declare namespace an = "http://zorba.io/annotations";
849+declare namespace ext = "http://zorba.io/extensions";
850+
851+declare %an:sequential function local:test-sequential()
852+{
853+
854+};
855+
856+variable $xmlcontents := fetch:content("$RBKT_SRC_DIR/Queries/zorba/flwor/flwor24.xml");
857+
858+variable $contents := parse-xml:parse(
859+ $xmlcontents,
860+ <opt:options>
861+ <opt:parse-external-parsed-entity opt:skip-root-nodes="1" />
862+ </opt:options>);
863+
864+(# ext:no-materialization #)
865+{
866+ for $w at $pos in $contents
867+ return
868+ {
869+ local:test-sequential();
870+ $w
871+ }
872+}
873\ No newline at end of file
874
875=== added file 'test/rbkt/Queries/zorba/flwor/flwor26.spec'
876--- test/rbkt/Queries/zorba/flwor/flwor26.spec 1970-01-01 00:00:00 +0000
877+++ test/rbkt/Queries/zorba/flwor/flwor26.spec 2013-08-16 07:08:59 +0000
878@@ -0,0 +1,1 @@
879+Error: http://zorba.io/errors:ZDDY0041
880\ No newline at end of file
881
882=== added file 'test/rbkt/Queries/zorba/flwor/flwor26.xq'
883--- test/rbkt/Queries/zorba/flwor/flwor26.xq 1970-01-01 00:00:00 +0000
884+++ test/rbkt/Queries/zorba/flwor/flwor26.xq 2013-08-16 07:08:59 +0000
885@@ -0,0 +1,30 @@
886+import module namespace parse-xml = "http://zorba.io/modules/xml";
887+import schema namespace opt = "http://zorba.io/modules/xml-options";
888+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
889+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
890+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
891+
892+declare namespace an = "http://zorba.io/annotations";
893+declare namespace ext = "http://zorba.io/extensions";
894+
895+declare variable $coll := xs:QName("ddl:coll1");
896+
897+declare %an:sequential function local:test-sequential($pos)
898+{
899+ if ($pos eq 1)
900+ then dml:insert-nodes-last($coll, <d>{$pos}</d>);
901+ else ();
902+};
903+
904+ddl:create($coll);
905+dml:insert-nodes-last($coll, (<a/>,<c/>,<b/>));
906+
907+(# ext:no-materialization #)
908+{
909+ for $w at $pos in dml:collection($coll)
910+ return
911+ {
912+ local:test-sequential($pos);
913+ $w
914+ }
915+}
916\ No newline at end of file
917
918=== added file 'test/rbkt/Queries/zorba/flwor/flwor27.xq'
919--- test/rbkt/Queries/zorba/flwor/flwor27.xq 1970-01-01 00:00:00 +0000
920+++ test/rbkt/Queries/zorba/flwor/flwor27.xq 2013-08-16 07:08:59 +0000
921@@ -0,0 +1,30 @@
922+import module namespace parse-xml = "http://zorba.io/modules/xml";
923+import schema namespace opt = "http://zorba.io/modules/xml-options";
924+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
925+
926+declare namespace an = "http://zorba.io/annotations";
927+declare namespace ext = "http://zorba.io/extensions";
928+
929+declare %an:sequential function local:test-sequential($pos)
930+{
931+
932+};
933+
934+variable $xmlcontents := fetch:content("$RBKT_SRC_DIR/Queries/zorba/flwor/flwor24.xml");
935+
936+variable $contents := parse-xml:parse(
937+ $xmlcontents,
938+ <opt:options>
939+ <opt:parse-external-parsed-entity opt:skip-root-nodes="1" />
940+ </opt:options>);
941+
942+(# ext:no-materialization #)
943+{
944+ for $w at $pos in $contents
945+ order by local-name($w) descending
946+ return
947+ {
948+ local:test-sequential($pos);
949+ $w
950+ }
951+}
952\ No newline at end of file
953
954=== added file 'test/rbkt/Queries/zorba/flwor/flwor28.xq'
955--- test/rbkt/Queries/zorba/flwor/flwor28.xq 1970-01-01 00:00:00 +0000
956+++ test/rbkt/Queries/zorba/flwor/flwor28.xq 2013-08-16 07:08:59 +0000
957@@ -0,0 +1,29 @@
958+import module namespace parse-xml = "http://zorba.io/modules/xml";
959+import schema namespace opt = "http://zorba.io/modules/xml-options";
960+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
961+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
962+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
963+
964+declare namespace an = "http://zorba.io/annotations";
965+declare namespace ext = "http://zorba.io/extensions";
966+
967+declare variable $coll := xs:QName("ddl:coll1");
968+
969+declare %an:sequential function local:test-sequential($pos)
970+{
971+
972+};
973+
974+ddl:create($coll);
975+dml:insert-nodes-last($coll, (<a/>,<c/>,<b/>));
976+
977+(# ext:no-materialization #)
978+{
979+ for $w at $pos in dml:collection($coll)
980+ order by local-name($w) descending
981+ return
982+ {
983+ local:test-sequential($pos);
984+ $w
985+ }
986+}
987\ No newline at end of file
988
989=== added file 'test/rbkt/Queries/zorba/scripting/flwor2.spec'
990--- test/rbkt/Queries/zorba/scripting/flwor2.spec 1970-01-01 00:00:00 +0000
991+++ test/rbkt/Queries/zorba/scripting/flwor2.spec 2013-08-16 07:08:59 +0000
992@@ -0,0 +1,1 @@
993+Error: http://www.zorba-xquery.com/errors:ZDDY0037

Subscribers

People subscribed via source and target branches