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

Proposed by David Graf
Status: Merged
Approved by: David Graf
Approved revision: 10902
Merged at revision: 10904
Proposed branch: lp:~davidagraf/zorba/paging
Merge into: lp:zorba
Diff against target: 524 lines (+242/-33)
20 files modified
ChangeLog (+1/-0)
modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq (+17/-0)
modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq (+17/-0)
src/functions/func_sequences_impl.cpp (+13/-18)
src/functions/pregenerated/func_collections.cpp (+26/-0)
src/functions/pregenerated/function_enum.h (+2/-0)
src/runtime/collections/collections_impl.cpp (+48/-5)
src/runtime/spec/collections/collections.xml (+14/-2)
src/store/api/collection.h (+5/-1)
src/store/naive/collection.h (+1/-1)
src/store/naive/simple_collection.cpp (+9/-4)
src/store/naive/simple_collection.h (+3/-2)
test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res (+1/-0)
test/rbkt/Queries/zorba/collections/paging_1.xq (+20/-0)
test/rbkt/Queries/zorba/collections/paging_2.xq (+21/-0)
test/rbkt/Queries/zorba/collections/paging_3.xq (+20/-0)
test/rbkt/Queries/zorba/collections/paging_4.xq (+21/-0)
To merge this branch: bzr merge lp:~davidagraf/zorba/paging
Reviewer Review Type Date Requested Status
Till Westmann Pending
Matthias Brantner Pending
Review via email: mp+112775@code.launchpad.net

This proposal supersedes a proposal from 2012-06-28.

Description of the change

Positional pagination

To post a comment you must log in.
Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

- code conventions in collections_impl.cpp
- getIterator(xs_integer aSkip)
  - should be getIterator(xs_integer& aSkip) because xs_integer can be MAPM
  - could be one function with default parameter 0
- to_xs_long conversion in SimpleCollection can raise an error which should be caught somewhere in the iterator and a location needs to be added
- CollectionIter(SimpleCollection* collection, xs_integer aSkip); => CollectionIter(SimpleCollection* collection, xs_integer& aSkip);
- store::Iterator_t getIterator(xs_integer aSkip); => store::Iterator_t getIterator(xs_integer& aSkip);
- functions should be in the .xq modules and have documentation
- dml:collection(xs:QName("local:test2"), -1) produces a segfault
- dml:collection(xs:QName("local:test2"), x) produces a segfault if x is bigger than the size of the collection
- skip and count optimizations don't seem to play well together (maybe not needed)

review: Needs Fixing
Revision history for this message
Till Westmann (tillw) : Posted in a previous version of this proposal
review: Approve
Revision history for this message
Matthias Brantner (matthias-brantner) wrote : Posted in a previous version of this proposal

The documentation of the two functions is a little weak. For example, it doesn't say what's happening to the skip parameter if it's negative or bigger than the size of the collection. Also, it would make sense to say that the function also makes sense for unordered collections because nodes are returned in a stable order.

review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal

Attempt to merge into lp:zorba failed due to conflicts:

text conflict in ChangeLog

Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

Validation queue job paging-2012-06-29T13-48-12.365Z 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 'ChangeLog'
2--- ChangeLog 2012-06-28 22:07:25 +0000
3+++ ChangeLog 2012-06-29 13:52:27 +0000
4@@ -10,6 +10,7 @@
5 - fn:parse-xml-fragment#1
6 * Added support for transient maps to the http://www.zorba-xquery.com/modules/store/data-structures/unordered-map module.
7 * Added support for fragments to fn:path
8+ * Positional pagination support for collections
9
10 Optimizations:
11 * Small optimization of comparison operations.
12
13=== modified file 'modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq'
14--- modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq 2012-06-28 04:14:03 +0000
15+++ modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq 2012-06-29 13:52:27 +0000
16@@ -615,6 +615,23 @@
17
18
19 (:~
20+ : The collection function returns the sequence of nodes and/or json items
21+ : that belong to the collection identified by the given name.
22+ :
23+ : @param $name The name of the collection.
24+ : @param $skip The number of collection items to skip.
25+ :
26+ : @return The sequence contained in the given collection.
27+ :
28+ : @error zerr:ZDDY0003 If available collections does not provide a mapping
29+ : for the expanded QName $name.
30+ :
31+ :)
32+declare function
33+dml:collection($name as xs:QName, $skip as xs:integer) as item()* external;
34+
35+
36+(:~
37 : The collection-name function returns the name of the collection the given
38 : item (node or json item) belongs to.
39 :
40
41=== modified file 'modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq'
42--- modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq 2012-06-28 04:14:03 +0000
43+++ modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq 2012-06-29 13:52:27 +0000
44@@ -867,6 +867,23 @@
45
46
47 (:~
48+ : The collection function returns the sequence of nodes and/or json items
49+ : that belong to the collection identified by the given name.
50+ :
51+ : @param $name The name of the collection.
52+ : @param $skip The number of collection items to skip.
53+ :
54+ : @return The sequence contained in the given collection.
55+ :
56+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
57+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
58+ :
59+ :)
60+declare function
61+cdml:collection($name as xs:QName, $skip as xs:integer) as item()* external;
62+
63+
64+(:~
65 : The collection-name function returns the name of the collection the given
66 : item (node or json item) belongs to.
67 :
68
69=== modified file 'src/functions/func_sequences_impl.cpp'
70--- src/functions/func_sequences_impl.cpp 2012-06-28 04:14:03 +0000
71+++ src/functions/func_sequences_impl.cpp 2012-06-29 13:52:27 +0000
72@@ -543,20 +543,16 @@
73 ZorbaCollectionIterator& collection =
74 static_cast<ZorbaCollectionIterator&>(*argv[0]);
75
76- if (collection.isDynamic())
77- {
78- return new CountCollectionIterator(sctx,
79- loc,
80- collection.getChildren(),
81- CountCollectionIterator::ZORBADYNAMIC);
82- }
83- else
84- {
85- return new CountCollectionIterator(sctx,
86- loc,
87- collection.getChildren(),
88- CountCollectionIterator::ZORBASTATIC);
89- }
90+ return new CountCollectionIterator(
91+ sctx,
92+ loc,
93+ collection.getChildren(),
94+ (
95+ collection.isDynamic()
96+ ? CountCollectionIterator::ZORBADYNAMIC
97+ : CountCollectionIterator::ZORBASTATIC
98+ )
99+ );
100 }
101 else if (typeid(FnCollectionIterator) == counted_type)
102 {
103@@ -600,10 +596,9 @@
104 return new ProbeIndexRangeGeneralIterator(
105 sctx, loc, lIter.getChildren(), true);
106 }
107- else
108- {
109- return new FnCountIterator(sctx, loc, argv);
110- }
111+
112+ // fallback
113+ return new FnCountIterator(sctx, loc, argv);
114 }
115
116
117
118=== modified file 'src/functions/pregenerated/func_collections.cpp'
119--- src/functions/pregenerated/func_collections.cpp 2012-06-28 04:14:03 +0000
120+++ src/functions/pregenerated/func_collections.cpp 2012-06-29 13:52:27 +0000
121@@ -342,6 +342,19 @@
122
123 {
124 DECL_WITH_KIND(sctx, static_collections_dml_collection,
125+ (createQName("http://www.zorba-xquery.com/modules/store/static/collections/dml","","collection"),
126+ GENV_TYPESYSTEM.QNAME_TYPE_ONE,
127+ GENV_TYPESYSTEM.INTEGER_TYPE_ONE,
128+ GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
129+ FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_2);
130+
131+ }
132+
133+
134+
135+
136+ {
137+ DECL_WITH_KIND(sctx, static_collections_dml_collection,
138 (createQName("http://www.zorba-xquery.com/modules/store/dynamic/collections/dml","","collection"),
139 GENV_TYPESYSTEM.QNAME_TYPE_ONE,
140 GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
141@@ -353,6 +366,19 @@
142
143
144 {
145+ DECL_WITH_KIND(sctx, static_collections_dml_collection,
146+ (createQName("http://www.zorba-xquery.com/modules/store/dynamic/collections/dml","","collection"),
147+ GENV_TYPESYSTEM.QNAME_TYPE_ONE,
148+ GENV_TYPESYSTEM.INTEGER_TYPE_ONE,
149+ GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR),
150+ FunctionConsts::DYNAMIC_COLLECTIONS_DML_COLLECTION_2);
151+
152+ }
153+
154+
155+
156+
157+ {
158 DECL_WITH_KIND(sctx, static_collections_dml_collection_name,
159 (createQName("http://www.zorba-xquery.com/modules/store/static/collections/dml","","collection-name"),
160 GENV_TYPESYSTEM.ANY_NODE_TYPE_ONE,
161
162=== modified file 'src/functions/pregenerated/function_enum.h'
163--- src/functions/pregenerated/function_enum.h 2012-06-28 21:54:08 +0000
164+++ src/functions/pregenerated/function_enum.h 2012-06-29 13:52:27 +0000
165@@ -54,7 +54,9 @@
166 FN_COLLECTION_0,
167 FN_COLLECTION_1,
168 STATIC_COLLECTIONS_DML_COLLECTION_1,
169+ STATIC_COLLECTIONS_DML_COLLECTION_2,
170 DYNAMIC_COLLECTIONS_DML_COLLECTION_1,
171+ DYNAMIC_COLLECTIONS_DML_COLLECTION_2,
172 STATIC_COLLECTIONS_DML_COLLECTION_NAME_1,
173 DYNAMIC_COLLECTIONS_DML_COLLECTION_NAME_1,
174 STATIC_COLLECTIONS_DML_INDEX_OF_1,
175
176=== modified file 'src/runtime/collections/collections_impl.cpp'
177--- src/runtime/collections/collections_impl.cpp 2012-06-28 04:14:03 +0000
178+++ src/runtime/collections/collections_impl.cpp 2012-06-29 13:52:27 +0000
179@@ -230,6 +230,7 @@
180 {
181 store::Collection_t coll;
182 store::Item_t name;
183+ xs_integer lCount;
184
185 PlanIteratorState* state;
186 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
187@@ -245,7 +246,20 @@
188 coll = getW3CCollection(planState);
189 }
190
191- STACK_PUSH(GENV_ITEMFACTORY->createInteger(result, coll->size()), state);
192+ lCount = coll->size();
193+ if (theChildren.size() > 1)
194+ {
195+ // skip parameter passed
196+ store::Item_t lSkipItem;
197+ consumeNext(lSkipItem, theChildren[1].getp(), planState);
198+ xs_integer lSkip = lSkipItem->getIntegerValue();
199+ // negative is transformed into 0
200+ lCount -= ( lSkip <= xs_integer::zero() ? xs_integer::zero() : lSkip );
201+ // negative is transformed into 0
202+ lCount = ( lCount < xs_integer::zero() ? xs_integer::zero() : lCount );
203+ }
204+
205+ STACK_PUSH(GENV_ITEMFACTORY->createInteger(result, lCount), state);
206
207 STACK_END(state);
208 }
209@@ -360,6 +374,7 @@
210 {
211 store::Item_t name;
212 store::Collection_t collection;
213+ xs_integer lSkip;
214
215 ZorbaCollectionIteratorState* state;
216 DEFAULT_STACK_INIT(ZorbaCollectionIteratorState, state, planState);
217@@ -368,10 +383,39 @@
218
219 (void)getCollection(theSctx, name, loc, theIsDynamic, collection);
220
221- // return the nodes of the collection
222- state->theIterator = collection->getIterator();
223+ if (theChildren.size() > 1)
224+ {
225+ // skip parameter passed
226+ store::Item_t lSkipItem;
227+ consumeNext(lSkipItem, theChildren[1].getp(), planState);
228+ lSkip = lSkipItem->getIntegerValue();
229+ // negative is transformed into 0
230+ state->theIterator = ( lSkip > xs_integer::zero()
231+ ? collection->getIterator(lSkip)
232+ : collection->getIterator()
233+ );
234+ }
235+ else
236+ {
237+ state->theIterator = collection->getIterator();
238+ }
239+
240 ZORBA_ASSERT(state->theIterator != NULL);
241- state->theIterator->open();
242+
243+ try
244+ {
245+ state->theIterator->open();
246+ }
247+ catch ( std::range_error const& )
248+ {
249+ throw XQUERY_EXCEPTION(
250+ zerr::ZXQD0004_INVALID_PARAMETER,
251+ ERROR_PARAMS(ZED(ZXQD0004_NOT_WITHIN_RANGE),
252+ lSkip),
253+ ERROR_LOC( loc )
254+ );
255+ }
256+
257 state->theIteratorOpened = true;
258
259 while (state->theIterator->next(result))
260@@ -384,7 +428,6 @@
261 STACK_END(state);
262 }
263
264-
265 /*******************************************************************************
266 declare function index-of($name as xs:QName,
267 $target as node()) as xs:integer
268
269=== modified file 'src/runtime/spec/collections/collections.xml'
270--- src/runtime/spec/collections/collections.xml 2012-06-28 04:14:03 +0000
271+++ src/runtime/spec/collections/collections.xml 2012-06-29 13:52:27 +0000
272@@ -249,8 +249,20 @@
273 <zorba:output>structured-item()*</zorba:output>
274 </zorba:signature>
275
276- <zorba:signature localname="collection" prefix="dynamic-collections-dml">
277- <zorba:param>xs:QName</zorba:param>
278+ <zorba:signature localname="collection" prefix="static-collections-dml">
279+ <zorba:param>xs:QName</zorba:param>
280+ <zorba:param>xs:integer</zorba:param><!-- nodes to skip -->
281+ <zorba:output>structured-item()*</zorba:output>
282+ </zorba:signature>
283+
284+ <zorba:signature localname="collection" prefix="dynamic-collections-dml">
285+ <zorba:param>xs:QName</zorba:param>
286+ <zorba:output>structured-item()*</zorba:output>
287+ </zorba:signature>
288+
289+ <zorba:signature localname="collection" prefix="dynamic-collections-dml">
290+ <zorba:param>xs:QName</zorba:param>
291+ <zorba:param>xs:integer</zorba:param><!-- nodes to skip -->
292 <zorba:output>structured-item()*</zorba:output>
293 </zorba:signature>
294
295
296=== modified file 'src/store/api/collection.h'
297--- src/store/api/collection.h 2012-06-28 04:14:03 +0000
298+++ src/store/api/collection.h 2012-06-29 13:52:27 +0000
299@@ -53,8 +53,12 @@
300 *
301 * It is allowed to have several concurrent iterators on the same Collection,
302 * but each iterator should be used by a single thread only.
303+ *
304+ * @param aSkip The number of collection entries to skip.
305+ * @return Iterator
306 */
307- virtual Iterator_t getIterator() = 0;
308+ virtual Iterator_t getIterator(
309+ const xs_integer& aSkip = xs_integer::zero()) = 0;
310
311 /**
312 * Get the node at the given position in the collection.
313
314=== modified file 'src/store/naive/collection.h'
315--- src/store/naive/collection.h 2012-06-28 04:14:03 +0000
316+++ src/store/naive/collection.h 2012-06-29 13:52:27 +0000
317@@ -54,7 +54,7 @@
318
319 zorba::xs_integer size() const = 0;
320
321- zorba::store::Iterator_t getIterator() = 0;
322+ zorba::store::Iterator_t getIterator(const xs_integer& aSkip) = 0;
323
324 virtual zorba::store::Item_t nodeAt(xs_integer position) = 0;
325
326
327=== modified file 'src/store/naive/simple_collection.cpp'
328--- src/store/naive/simple_collection.cpp 2012-06-28 04:14:03 +0000
329+++ src/store/naive/simple_collection.cpp 2012-06-29 13:52:27 +0000
330@@ -81,9 +81,9 @@
331 Note: it is allowed to have several concurrent iterators on the same collection
332 but each iterator should be used by a single thread only.
333 ********************************************************************************/
334-store::Iterator_t SimpleCollection::getIterator()
335+store::Iterator_t SimpleCollection::getIterator(const xs_integer& aSkip)
336 {
337- return new CollectionIter(this);
338+ return new CollectionIter(this, aSkip);
339 }
340
341
342@@ -607,10 +607,13 @@
343 /*******************************************************************************
344
345 ********************************************************************************/
346-SimpleCollection::CollectionIter::CollectionIter(SimpleCollection* collection)
347+SimpleCollection::CollectionIter::CollectionIter(
348+ SimpleCollection* collection,
349+ const xs_integer& aSkip)
350 :
351 theCollection(collection),
352- theHaveLock(false)
353+ theHaveLock(false),
354+ theSkip(aSkip)
355 {
356 }
357
358@@ -634,6 +637,7 @@
359 theHaveLock = true;
360
361 theIterator = theCollection->theXmlTrees.begin();
362+ theIterator += to_xs_long(theSkip);
363 theEnd = theCollection->theXmlTrees.end();
364 }
365
366@@ -668,6 +672,7 @@
367 void SimpleCollection::CollectionIter::reset()
368 {
369 theIterator = theCollection->theXmlTrees.begin();
370+ theIterator += to_xs_long(theSkip);
371 theEnd = theCollection->theXmlTrees.end();
372 }
373
374
375=== modified file 'src/store/naive/simple_collection.h'
376--- src/store/naive/simple_collection.h 2012-06-28 04:14:03 +0000
377+++ src/store/naive/simple_collection.h 2012-06-29 13:52:27 +0000
378@@ -54,9 +54,10 @@
379 checked_vector<store::Item_t>::iterator theIterator;
380 checked_vector<store::Item_t>::iterator theEnd;
381 bool theHaveLock;
382+ xs_integer theSkip;
383
384 public:
385- CollectionIter(SimpleCollection* collection);
386+ CollectionIter(SimpleCollection* collection, const xs_integer& aSkip);
387
388 ~CollectionIter();
389
390@@ -109,7 +110,7 @@
391
392 TreeId createTreeId();
393
394- store::Iterator_t getIterator();
395+ store::Iterator_t getIterator(const xs_integer& aSkip);
396
397 void addNode(store::Item* node, xs_integer position = xs_integer(-1));
398
399
400=== added file 'test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res'
401--- test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res 1970-01-01 00:00:00 +0000
402+++ test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res 2012-06-29 13:52:27 +0000
403@@ -0,0 +1,1 @@
404+<d/><e/><a/><b/><c/><d/><e/>
405
406=== added file 'test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res'
407--- test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res 1970-01-01 00:00:00 +0000
408+++ test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res 2012-06-29 13:52:27 +0000
409@@ -0,0 +1,1 @@
410+2 5 0
411
412=== added file 'test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res'
413--- test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res 1970-01-01 00:00:00 +0000
414+++ test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res 2012-06-29 13:52:27 +0000
415@@ -0,0 +1,1 @@
416+<d/><e/><a/><b/><c/><d/><e/>
417
418=== added file 'test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res'
419--- test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res 1970-01-01 00:00:00 +0000
420+++ test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res 2012-06-29 13:52:27 +0000
421@@ -0,0 +1,1 @@
422+2 5 0
423
424=== added file 'test/rbkt/Queries/zorba/collections/paging_1.xq'
425--- test/rbkt/Queries/zorba/collections/paging_1.xq 1970-01-01 00:00:00 +0000
426+++ test/rbkt/Queries/zorba/collections/paging_1.xq 2012-06-29 13:52:27 +0000
427@@ -0,0 +1,20 @@
428+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
429+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
430+import module namespace ns = "http://example.org/datamodule/" at "collections.xqdata";
431+
432+declare namespace ann = "http://www.zorba-xquery.com/annotations";
433+
434+declare %ann:sequential function local:test()
435+{
436+ ddl:create(xs:QName("ns:test2"));
437+ dml:insert-nodes(xs:QName("ns:test2"), <a/>);
438+ dml:insert-nodes(xs:QName("ns:test2"), <b/>);
439+ dml:insert-nodes(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
440+ (
441+ dml:collection(xs:QName("ns:test2"), 3),
442+ dml:collection(xs:QName("ns:test2"), -1)
443+ )
444+};
445+
446+local:test()
447+
448
449=== added file 'test/rbkt/Queries/zorba/collections/paging_2.xq'
450--- test/rbkt/Queries/zorba/collections/paging_2.xq 1970-01-01 00:00:00 +0000
451+++ test/rbkt/Queries/zorba/collections/paging_2.xq 2012-06-29 13:52:27 +0000
452@@ -0,0 +1,21 @@
453+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
454+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
455+import module namespace ns = "http://example.org/datamodule/" at "collections.xqdata";
456+
457+declare namespace ann = "http://www.zorba-xquery.com/annotations";
458+
459+declare %ann:sequential function local:test()
460+{
461+ ddl:create(xs:QName("ns:test2"));
462+ dml:insert-nodes(xs:QName("ns:test2"), <a/>);
463+ dml:insert-nodes(xs:QName("ns:test2"), <b/>);
464+ dml:insert-nodes(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
465+ (
466+ fn:count(dml:collection(xs:QName("ns:test2"), 3)),
467+ fn:count(dml:collection(xs:QName("ns:test2"), -1)),
468+ fn:count(dml:collection(xs:QName("ns:test2"), 100))
469+ )
470+};
471+
472+local:test()
473+
474
475=== added file 'test/rbkt/Queries/zorba/collections/paging_3.xq'
476--- test/rbkt/Queries/zorba/collections/paging_3.xq 1970-01-01 00:00:00 +0000
477+++ test/rbkt/Queries/zorba/collections/paging_3.xq 2012-06-29 13:52:27 +0000
478@@ -0,0 +1,20 @@
479+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
480+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
481+
482+declare namespace ann = "http://www.zorba-xquery.com/annotations";
483+declare namespace ns = "http://www.zorba-xquery.com/test";
484+
485+declare %ann:sequential function local:test()
486+{
487+ ddl:create(xs:QName("ns:test2"));
488+ dml:insert-nodes-last(xs:QName("ns:test2"), <a/>);
489+ dml:insert-nodes-last(xs:QName("ns:test2"), <b/>);
490+ dml:insert-nodes-last(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
491+ (
492+ dml:collection(xs:QName("ns:test2"), 3),
493+ dml:collection(xs:QName("ns:test2"), -1)
494+ )
495+};
496+
497+local:test()
498+
499
500=== added file 'test/rbkt/Queries/zorba/collections/paging_4.xq'
501--- test/rbkt/Queries/zorba/collections/paging_4.xq 1970-01-01 00:00:00 +0000
502+++ test/rbkt/Queries/zorba/collections/paging_4.xq 2012-06-29 13:52:27 +0000
503@@ -0,0 +1,21 @@
504+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
505+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
506+
507+declare namespace ann = "http://www.zorba-xquery.com/annotations";
508+declare namespace ns = "http://www.zorba-xquery.com/test";
509+
510+declare %ann:sequential function local:test()
511+{
512+ ddl:create(xs:QName("ns:test2"));
513+ dml:insert-nodes-last(xs:QName("ns:test2"), <a/>);
514+ dml:insert-nodes-last(xs:QName("ns:test2"), <b/>);
515+ dml:insert-nodes-last(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
516+ (
517+ fn:count(dml:collection(xs:QName("ns:test2"), 3)),
518+ fn:count(dml:collection(xs:QName("ns:test2"), -1)),
519+ fn:count(dml:collection(xs:QName("ns:test2"), 100))
520+ )
521+};
522+
523+local:test()
524+

Subscribers

People subscribed via source and target branches