Merge lp:~zorba-coders/zorba/bug-1189804 into lp:zorba
- bug-1189804
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Matthias Brantner | ||||
Approved revision: | 11613 | ||||
Merged at revision: | 11612 | ||||
Proposed branch: | lp:~zorba-coders/zorba/bug-1189804 | ||||
Merge into: | lp:zorba | ||||
Diff against target: |
4065 lines (+1469/-1340) 54 files modified
include/zorba/pregenerated/diagnostic_list.h (+4/-0) modules/CMakeLists.txt (+1/-0) modules/com/zorba-xquery/www/modules/CMakeLists.txt (+0/-2) modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq (+0/-256) modules/pregenerated/zorba-errors.xq (+8/-0) modules/store/CMakeLists.txt (+16/-0) modules/store/unordered-maps.xq (+312/-0) src/context/dynamic_context.cpp (+37/-19) src/context/dynamic_context.h (+3/-1) src/context/static_context.cpp (+4/-3) src/context/static_context.h (+1/-1) src/diagnostics/diagnostic_en.xml (+8/-0) src/diagnostics/pregenerated/diagnostic_list.cpp (+6/-0) src/diagnostics/pregenerated/dict_en.cpp (+2/-0) src/functions/pregenerated/func_maps.cpp (+138/-147) src/functions/pregenerated/func_maps.h (+119/-138) src/functions/pregenerated/function_enum.h (+10/-10) src/runtime/indexing/index_func_impl.cpp (+1/-1) src/runtime/pregenerated/iterator_enum.h (+3/-4) src/runtime/spec/mappings.xml (+2/-2) src/runtime/spec/store/maps.xml (+58/-86) src/runtime/store/maps_impl.cpp (+442/-308) src/runtime/store/pregenerated/maps.cpp (+40/-70) src/runtime/store/pregenerated/maps.h (+34/-68) src/runtime/visitors/pregenerated/planiter_visitor.h (+9/-14) src/runtime/visitors/pregenerated/printer_visitor.cpp (+22/-36) src/runtime/visitors/pregenerated/printer_visitor.h (+6/-9) test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter (+28/-29) test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter (+28/-29) test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res (+1/-0) test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res (+1/-0) test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res (+1/-1) test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res (+1/-1) test/rbkt/Queries/zorba/no-copy/dataguide-c.xq (+4/-5) test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq (+5/-6) test/rbkt/Queries/zorba/reference/reference_3.xq (+5/-5) test/rbkt/Queries/zorba/scripting/flwor15.xq (+2/-5) test/rbkt/Queries/zorba/scripting/nonsequential3.xq (+2/-2) test/rbkt/Queries/zorba/scripting/udf1.xq (+2/-3) test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq (+6/-0) test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec (+2/-0) test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq (+6/-0) test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec (+1/-0) test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq (+6/-0) test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq (+6/-0) test/rbkt/Queries/zorba/store/unordered-map/map0.xq (+13/-16) test/rbkt/Queries/zorba/store/unordered-map/map1.xq (+6/-6) test/rbkt/Queries/zorba/store/unordered-map/map2.xq (+9/-9) test/rbkt/Queries/zorba/store/unordered-map/map3.xq (+11/-11) test/rbkt/Queries/zorba/store/unordered-map/map4.xq (+6/-6) test/rbkt/Queries/zorba/store/unordered-map/map5.xq (+6/-6) test/rbkt/Queries/zorba/store/unordered-map/map6.xq (+6/-6) test/rbkt/Queries/zorba/store/unordered-map/map7.xq (+11/-11) test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq (+8/-8) |
||||
To merge this branch: | bzr merge lp:~zorba-coders/zorba/bug-1189804 | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Matthias Brantner | Approve | ||
Ghislain Fourny | Approve | ||
Review via email: mp+181973@code.launchpad.net |
This proposal supersedes a proposal from 2013-08-24.
Commit message
JSONify unordered-maps module, changed name, improved documentation. Also, maps are now inherited from a parent static context (e.g. if used in eval).
Description of the change
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue result for https:/
Stage "BuildZorbaUbuntu" failed.
Check compiler output at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
12 tests failed (8407 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : Posted in a previous version of this proposal | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
4 tests failed (8407 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
4 tests failed (8409 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
1 tests failed (8409 total tests run).
Check test results at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "ZorbaVQ" failed.
Check console output at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Voting criteria failed for the following merge proposals:
https:/
Votes: {'Pending': 2, 'Needs commit message': 1}
https:/
Votes: {'Pending': 2}
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "CommitZorba" failed.
Check console output at http://
Ghislain Fourny (gislenius) wrote : | # |
Looks good! Here are some comments:
- Did you check that the invalid option type error does not exist already? Will it be consistent also in all other modules?
- Should JSONiq modules not be suffixed as .jq (but it's only cosmetics of course).
- empty-sequence() -> ()
- array() -> array
- Why remove variadic="true"? I forgot what the semantics for this attribute are.
- In the implementation of map:key: why not reserve the vector size at the beginning (unless you cannot get the size of an ItemVector in constant time?).
- 11610. By Matthias Brantner
-
address review comments
Matthias Brantner (matthias-brantner) wrote : | # |
> Looks good! Here are some comments:
>
> - Did you check that the invalid option type error does not exist already?
> Will it be consistent also in all other modules?
Yes, I did. This will become consistent as soon as the JSound implementation is there.
> - Should JSONiq modules not be suffixed as .jq (but it's only cosmetics of
> course).
That's not possible at the moment (see bug #1192043)
> - empty-sequence() -> ()
done
> - array() -> array
done
> - Why remove variadic="true"? I forgot what the semantics for this attribute
> are.
Variadic was only required in the previous version to be able to deal with
an arbitrary number of keys. Now that we have arrays, we can make the function
non-variadic. Arrays make this much easier to use.
> - In the implementation of map:key: why not reserve the vector size at the
> beginning (unless you cannot get the size of an ItemVector in constant time?).
Fixed.
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Voting criteria failed for the following merge proposals:
https:/
Votes: {'Pending': 1, 'Needs Fixing': 1, 'Needs commit message': 1}
https:/
Votes: {'Pending': 2}
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "CommitZorba" failed.
Check console output at http://
- 11611. By Matthias Brantner
-
inherit maps from a parent dynamic context (useful in eval)
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Voting criteria failed for the following merge proposals:
https:/
Votes: {'Pending': 1, 'Needs Fixing': 1}
https:/
Votes: {'Pending': 2}
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "CommitZorba" failed.
Check console output at http://
Ghislain Fourny (gislenius) : | # |
Matthias Brantner (matthias-brantner) : | # |
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "ZorbaVQ" failed.
Check console output at http://
- 11612. By Matthias Brantner
-
merge
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "TestZorbaUbuntu" failed.
2 tests failed (8425 total tests run).
Check test results at http://
- 11613. By Matthias Brantner
-
fixed invalid resolution of merge conflict
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Voting criteria failed for the following merge proposals:
https:/
Votes: {'Pending': 2}
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue result for https:/
Stage "CommitZorba" failed.
Check console output at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue starting for the following merge proposals:
https:/
https:/
Progress dashboard at http://
Zorba Build Bot (zorba-buildbot) wrote : | # |
Validation queue succeeded - proposal merged!
Preview Diff
1 | === modified file 'include/zorba/pregenerated/diagnostic_list.h' | |||
2 | --- include/zorba/pregenerated/diagnostic_list.h 2013-08-12 13:05:15 +0000 | |||
3 | +++ include/zorba/pregenerated/diagnostic_list.h 2013-09-02 20:59:05 +0000 | |||
4 | @@ -694,6 +694,10 @@ | |||
5 | 694 | 694 | ||
6 | 695 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION; | 695 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION; |
7 | 696 | 696 | ||
8 | 697 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION; | ||
9 | 698 | |||
10 | 699 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0043_INVALID_OPTION_TYPE; | ||
11 | 700 | |||
12 | 697 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED; | 701 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED; |
13 | 698 | 702 | ||
14 | 699 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED; | 703 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED; |
15 | 700 | 704 | ||
16 | === modified file 'modules/CMakeLists.txt' | |||
17 | --- modules/CMakeLists.txt 2013-08-30 17:32:32 +0000 | |||
18 | +++ modules/CMakeLists.txt 2013-09-02 20:59:05 +0000 | |||
19 | @@ -13,6 +13,7 @@ | |||
20 | 13 | # limitations under the License. | 13 | # limitations under the License. |
21 | 14 | 14 | ||
22 | 15 | ADD_SUBDIRECTORY(atomic) | 15 | ADD_SUBDIRECTORY(atomic) |
23 | 16 | ADD_SUBDIRECTORY(store) | ||
24 | 16 | ADD_SUBDIRECTORY(com) | 17 | ADD_SUBDIRECTORY(com) |
25 | 17 | ADD_SUBDIRECTORY(org) | 18 | ADD_SUBDIRECTORY(org) |
26 | 18 | ADD_SUBDIRECTORY(functx) | 19 | ADD_SUBDIRECTORY(functx) |
27 | 19 | 20 | ||
28 | === modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt' | |||
29 | --- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-08-30 17:45:50 +0000 | |||
30 | +++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2013-09-02 20:59:05 +0000 | |||
31 | @@ -32,8 +32,6 @@ | |||
32 | 32 | DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0 | 32 | DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0 |
33 | 33 | URI "http://www.zorba-xquery.com/modules/introspection/sctx") | 33 | URI "http://www.zorba-xquery.com/modules/introspection/sctx") |
34 | 34 | 34 | ||
35 | 35 | DECLARE_ZORBA_MODULE(FILE store/data-structures/unordered-map.xq VERSION 2.0 | ||
36 | 36 | URI "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map") | ||
37 | 37 | DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.0 | 35 | DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.0 |
38 | 38 | URI "http://www.zorba-xquery.com/modules/store/dynamic/documents") | 36 | URI "http://www.zorba-xquery.com/modules/store/dynamic/documents") |
39 | 39 | DECLARE_ZORBA_MODULE(FILE store/dynamic/collections/ddl.xq VERSION 2.0 | 37 | DECLARE_ZORBA_MODULE(FILE store/dynamic/collections/ddl.xq VERSION 2.0 |
40 | 40 | 38 | ||
41 | === removed file 'modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq' | |||
42 | --- modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq 2013-08-09 08:27:30 +0000 | |||
43 | +++ modules/com/zorba-xquery/www/modules/store/data-structures/unordered-map.xq 1970-01-01 00:00:00 +0000 | |||
44 | @@ -1,256 +0,0 @@ | |||
45 | 1 | xquery version "3.0"; | ||
46 | 2 | (: | ||
47 | 3 | : Copyright 2006-2012 The FLWOR Foundation. | ||
48 | 4 | : | ||
49 | 5 | : Licensed under the Apache License, Version 2.0 (the "License"); | ||
50 | 6 | : you may not use this file except in compliance with the License. | ||
51 | 7 | : You may obtain a copy of the License at | ||
52 | 8 | : | ||
53 | 9 | : http://www.apache.org/licenses/LICENSE-2.0 | ||
54 | 10 | : | ||
55 | 11 | : Unless required by applicable law or agreed to in writing, software | ||
56 | 12 | : distributed under the License is distributed on an "AS IS" BASIS, | ||
57 | 13 | : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
58 | 14 | : See the License for the specific language governing permissions and | ||
59 | 15 | : limitations under the License. | ||
60 | 16 | :) | ||
61 | 17 | |||
62 | 18 | (:~ | ||
63 | 19 | : <p>This module defines a set of functions for working with maps. A map | ||
64 | 20 | : is identified by a QName and can be created using the map:create or | ||
65 | 21 | : map:create-transient functions and deleted using the map:delete function, | ||
66 | 22 | : respectively.</p> | ||
67 | 23 | : | ||
68 | 24 | : <p>The lifetime of a transient map is limited by the execution of the | ||
69 | 25 | : current XQuery program. A non-transient (or persistent) map lives until | ||
70 | 26 | : it is explicitly deleted. Accordingly, it's also available | ||
71 | 27 | : to other XQuery programs.</p> | ||
72 | 28 | : | ||
73 | 29 | : <p>The key of a particular entry in the map can consist of a tuple of | ||
74 | 30 | : atomic values (called attributes). The actual type of each attribute | ||
75 | 31 | : is determined when the map is created. The value of each attribute can | ||
76 | 32 | : be an arbitrary sequence of items.</p> | ||
77 | 33 | : | ||
78 | 34 | : @see <a href="../../html/data_lifecycle.html">Data Lifecycle</a> | ||
79 | 35 | : @see <a href="modules_http:__zorba.io_modules_zorba-errors.html">http://zorba.io/errors</a> | ||
80 | 36 | : | ||
81 | 37 | : @author Matthias Brantner | ||
82 | 38 | : | ||
83 | 39 | : @project Zorba/Data Store/Data Structures/Unordered Map | ||
84 | 40 | :) | ||
85 | 41 | module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | ||
86 | 42 | |||
87 | 43 | declare namespace zerr = "http://zorba.io/errors"; | ||
88 | 44 | declare namespace err = "http://www.w3.org/2005/xqt-errors"; | ||
89 | 45 | declare namespace an = "http://zorba.io/annotations"; | ||
90 | 46 | |||
91 | 47 | declare namespace ver = "http://zorba.io/options/versioning"; | ||
92 | 48 | declare option ver:module-version "2.0"; | ||
93 | 49 | |||
94 | 50 | (:~ | ||
95 | 51 | : Create a map with a given name and a set of type identifiers for each key | ||
96 | 52 | : attribute. Note that the function is variadic and might take an arbitrary | ||
97 | 53 | : number of type identifiers for the key attributes. Also note that the | ||
98 | 54 | : function is sequential and immediately creates the map in the store. | ||
99 | 55 | : | ||
100 | 56 | : @param $name the name of the map | ||
101 | 57 | : @param $key-type an arbitrary number of types, one | ||
102 | 58 | : for each key attribute. | ||
103 | 59 | : | ||
104 | 60 | : @return the function is sequential and immediately creates | ||
105 | 61 | : the corresponding map but returns the empty-sequence. | ||
106 | 62 | : | ||
107 | 63 | : @error err:XPTY0004 if any of the attribute types is not a subtype of | ||
108 | 64 | : xs:anyAtomicType. | ||
109 | 65 | : @error zerr:ZSTR0001 if a map with the given name already exists. | ||
110 | 66 | :) | ||
111 | 67 | declare %an:variadic %an:sequential function map:create( | ||
112 | 68 | $name as xs:QName, | ||
113 | 69 | $key-type as xs:QName) as empty-sequence() external; | ||
114 | 70 | |||
115 | 71 | (:~ | ||
116 | 72 | : Create a transient map with a given name and a set of type identifiers | ||
117 | 73 | : for each key attribute. Note that the function is variadic and might | ||
118 | 74 | : take an arbitrary number of type identifiers for the key attributes. | ||
119 | 75 | : | ||
120 | 76 | : @param $name the name of the map | ||
121 | 77 | : @param $key-type an arbitrary number of types, one | ||
122 | 78 | : for each key attribute. | ||
123 | 79 | : | ||
124 | 80 | : @return the function is sequential and immediately creates | ||
125 | 81 | : the corresponding map but returns the empty-sequence. | ||
126 | 82 | : | ||
127 | 83 | : @error err:XPTY0004 if any of the attribute types is not a subtype of | ||
128 | 84 | : xs:anyAtomicType. | ||
129 | 85 | : @error zerr:ZSTR0001 if a map with the given name already exists. | ||
130 | 86 | :) | ||
131 | 87 | declare %an:variadic %an:sequential function map:create-transient( | ||
132 | 88 | $name as xs:QName, | ||
133 | 89 | $key-type as xs:QName) as empty-sequence() external; | ||
134 | 90 | |||
135 | 91 | (:~ | ||
136 | 92 | : Destroys the map with the given name. | ||
137 | 93 | : | ||
138 | 94 | : @param $name the name of the map to delete | ||
139 | 95 | : | ||
140 | 96 | : @return the function is sequential and immediately deletes | ||
141 | 97 | : the map but returns the empty-sequence. | ||
142 | 98 | : | ||
143 | 99 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
144 | 100 | :) | ||
145 | 101 | declare %an:sequential function map:delete( | ||
146 | 102 | $name as xs:QName) as empty-sequence() external; | ||
147 | 103 | |||
148 | 104 | (:~ | ||
149 | 105 | : Inserts a new entry into the map with the given name. Note that the | ||
150 | 106 | : function is variadic and might take an arbitrary number of key attributes. | ||
151 | 107 | : If an entry with the given key already exists in the map, the value | ||
152 | 108 | : sequences of the existing entry and the sequence passed using $value | ||
153 | 109 | : argument are concatenated. | ||
154 | 110 | : | ||
155 | 111 | : Note that it is possible to insert entries with empty key attributes. | ||
156 | 112 | : However as the getting the entries is based on the "eq" comparison and | ||
157 | 113 | : as "eq" with an empty sequence always return false, it is not possible | ||
158 | 114 | : to retrieve these entries. | ||
159 | 115 | : | ||
160 | 116 | : @param $name the name of the map | ||
161 | 117 | : @param $value the value of the entry to insert | ||
162 | 118 | : @param $key an arbitrary number of key attributes. | ||
163 | 119 | : | ||
164 | 120 | : @return the function is sequential and immediately inserts | ||
165 | 121 | : the entry into the map but returns the | ||
166 | 122 | : empty-sequence. | ||
167 | 123 | : | ||
168 | 124 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
169 | 125 | : @error zerr:ZDDY0025 if the given number of key attributes does not match | ||
170 | 126 | : the number of key attributes specified when creating | ||
171 | 127 | : the map (see the map:create function). | ||
172 | 128 | : @error zerr:ZXQD0005 if any of the given key attributes can not | ||
173 | 129 | : be cast (or is not a subtype) of the corresponding key attribute | ||
174 | 130 | : specified when creating the map. | ||
175 | 131 | : | ||
176 | 132 | : @see map:create | ||
177 | 133 | : | ||
178 | 134 | :) | ||
179 | 135 | declare %an:variadic %an:sequential function map:insert( | ||
180 | 136 | $name as xs:QName, | ||
181 | 137 | $value as item()*, | ||
182 | 138 | $key as xs:anyAtomicType?) as empty-sequence() external; | ||
183 | 139 | |||
184 | 140 | (:~ | ||
185 | 141 | : Returns the value of the entry with the given key from the map. | ||
186 | 142 | : | ||
187 | 143 | : Note that it is possible to insert entries with empty key attributes. | ||
188 | 144 | : However as the getting the entries is based on the "eq" comparison and | ||
189 | 145 | : as "eq" with an empty sequence always return false, it is not possible | ||
190 | 146 | : to retrieve these entries. | ||
191 | 147 | : | ||
192 | 148 | : @param $name the name of the map | ||
193 | 149 | : @param an arbitrary number of search key attributes. | ||
194 | 150 | : | ||
195 | 151 | : @return the value of the entry in the map identified | ||
196 | 152 | : by the given key. The empty-sequence will be returned | ||
197 | 153 | : if no entry with the given key is contained in the map. | ||
198 | 154 | : | ||
199 | 155 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
200 | 156 | : @error zerr:ZDDY0025 if the given number of key attributes does not match | ||
201 | 157 | : the number of key attributes specified when creating | ||
202 | 158 | : the map (see the map:create function). | ||
203 | 159 | : @error zerr:ZXQD0005 if any of the given key attributes can not | ||
204 | 160 | : be cast (or is not a subtype) of the corresponding key attribute | ||
205 | 161 | : specified when creating the map. | ||
206 | 162 | : | ||
207 | 163 | : @see map:create | ||
208 | 164 | :) | ||
209 | 165 | declare %an:variadic function map:get( | ||
210 | 166 | $name as xs:QName, | ||
211 | 167 | $key as xs:anyAtomicType?) as item()* external; | ||
212 | 168 | |||
213 | 169 | (:~ | ||
214 | 170 | : Removes an entry identified by the given key from the map. | ||
215 | 171 | : | ||
216 | 172 | : Note that it is possible to insert entries with empty key attributes. | ||
217 | 173 | : However as the removing the entries is based on the "eq" comparison and | ||
218 | 174 | : as "eq" with an empty sequence always return false, it is not possible | ||
219 | 175 | : to remove these entries. | ||
220 | 176 | : | ||
221 | 177 | : @param $name the name of the map | ||
222 | 178 | : @param an arbitrary number of search key attributes. | ||
223 | 179 | : | ||
224 | 180 | : @return the function is sequential and immediately removes | ||
225 | 181 | : the entry into the map but returns the | ||
226 | 182 | : empty-sequence. | ||
227 | 183 | : | ||
228 | 184 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
229 | 185 | : @error zerr:ZDDY0025 if the given number of key attributes does not match | ||
230 | 186 | : the number of key attributes specified when creating | ||
231 | 187 | : the map (see the map:create function). | ||
232 | 188 | : @error zerr:ZXQD0005 if any of the given key attributes can not | ||
233 | 189 | : be cast (or is not a subtype) of the corresponding key attribute | ||
234 | 190 | : specified when creating the map. | ||
235 | 191 | : | ||
236 | 192 | : @see map:create | ||
237 | 193 | :) | ||
238 | 194 | declare %an:variadic %an:sequential function map:remove( | ||
239 | 195 | $name as xs:QName, | ||
240 | 196 | $key as xs:anyAtomicType?) as empty-sequence() external; | ||
241 | 197 | |||
242 | 198 | (:~ | ||
243 | 199 | : Returns the keys of all entries of a map. The keys | ||
244 | 200 | : are returned as sequence of nodes of the form: | ||
245 | 201 | : | ||
246 | 202 | : <pre> | ||
247 | 203 | : <key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"> | ||
248 | 204 | : <attribute value="key1_value"/> | ||
249 | 205 | : <attribute value="key2_value"/> | ||
250 | 206 | : <attribute value="key3_value"/> | ||
251 | 207 | : </key> | ||
252 | 208 | : </pre> | ||
253 | 209 | : | ||
254 | 210 | : The following condition always holds: | ||
255 | 211 | : <tt>map:size($name) eq fn:count(map:keys($name))</tt> | ||
256 | 212 | : | ||
257 | 213 | : @param $name the name of the map | ||
258 | 214 | : | ||
259 | 215 | : @return all keys in the map. | ||
260 | 216 | : | ||
261 | 217 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
262 | 218 | : | ||
263 | 219 | :) | ||
264 | 220 | declare function map:keys( | ||
265 | 221 | $name as xs:QName) as node()* external; | ||
266 | 222 | |||
267 | 223 | (:~ | ||
268 | 224 | : The number of entries in a map. | ||
269 | 225 | : | ||
270 | 226 | : The following condition always holds: | ||
271 | 227 | : <tt>map:size($name) eq fn:count(map:keys($name))</tt> | ||
272 | 228 | : | ||
273 | 229 | : @param $name the name of the map | ||
274 | 230 | : | ||
275 | 231 | : @return the number of entries in the map. | ||
276 | 232 | : | ||
277 | 233 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
278 | 234 | :) | ||
279 | 235 | declare function map:size($name as xs:QName) as xs:integer external; | ||
280 | 236 | |||
281 | 237 | (:~ | ||
282 | 238 | : The function returns a sequence of QNames of the maps that are | ||
283 | 239 | : available. The sequence will be empty if there are no maps. | ||
284 | 240 | : | ||
285 | 241 | : @return A sequence of QNames, one for each available map, or an emtpy sequence. | ||
286 | 242 | : | ||
287 | 243 | :) | ||
288 | 244 | declare function map:available-maps() as xs:QName* external; | ||
289 | 245 | |||
290 | 246 | (:~ | ||
291 | 247 | : The function returns true if the map identified by the given QName | ||
292 | 248 | : is transient, false otherwise. | ||
293 | 249 | : | ||
294 | 250 | : @param $name the name of the map | ||
295 | 251 | : | ||
296 | 252 | : @return true if the map is transient, false otherwise. | ||
297 | 253 | : | ||
298 | 254 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
299 | 255 | :) | ||
300 | 256 | declare function map:is-transient($name as xs:QName) as xs:boolean external; | ||
301 | 257 | 0 | ||
302 | === modified file 'modules/pregenerated/zorba-errors.xq' | |||
303 | --- modules/pregenerated/zorba-errors.xq 2013-08-12 13:05:15 +0000 | |||
304 | +++ modules/pregenerated/zorba-errors.xq 2013-09-02 20:59:05 +0000 | |||
305 | @@ -606,6 +606,14 @@ | |||
306 | 606 | 606 | ||
307 | 607 | (:~ | 607 | (:~ |
308 | 608 | :) | 608 | :) |
309 | 609 | declare variable $zerr:ZDDY0042 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0042"); | ||
310 | 610 | |||
311 | 611 | (:~ | ||
312 | 612 | :) | ||
313 | 613 | declare variable $zerr:ZDDY0043 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0043"); | ||
314 | 614 | |||
315 | 615 | (:~ | ||
316 | 616 | :) | ||
317 | 609 | declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001"); | 617 | declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001"); |
318 | 610 | 618 | ||
319 | 611 | (:~ | 619 | (:~ |
320 | 612 | 620 | ||
321 | === added directory 'modules/store' | |||
322 | === added file 'modules/store/CMakeLists.txt' | |||
323 | --- modules/store/CMakeLists.txt 1970-01-01 00:00:00 +0000 | |||
324 | +++ modules/store/CMakeLists.txt 2013-09-02 20:59:05 +0000 | |||
325 | @@ -0,0 +1,16 @@ | |||
326 | 1 | # Copyright 2013 The FLWOR Foundation. | ||
327 | 2 | # | ||
328 | 3 | # Licensed under the Apache License, Version 2.0 (the "License"); | ||
329 | 4 | # you may not use this file except in compliance with the License. | ||
330 | 5 | # You may obtain a copy of the License at | ||
331 | 6 | # | ||
332 | 7 | # http://www.apache.org/licenses/LICENSE-2.0 | ||
333 | 8 | # | ||
334 | 9 | # Unless required by applicable law or agreed to in writing, software | ||
335 | 10 | # distributed under the License is distributed on an "AS IS" BASIS, | ||
336 | 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
337 | 12 | # See the License for the specific language governing permissions and | ||
338 | 13 | # limitations under the License. | ||
339 | 14 | |||
340 | 15 | DECLARE_ZORBA_MODULE(FILE unordered-maps.xq VERSION 1.0 | ||
341 | 16 | URI "http://zorba.io/modules/unordered-maps") | ||
342 | 0 | 17 | ||
343 | === added file 'modules/store/unordered-maps.xq' | |||
344 | --- modules/store/unordered-maps.xq 1970-01-01 00:00:00 +0000 | |||
345 | +++ modules/store/unordered-maps.xq 2013-09-02 20:59:05 +0000 | |||
346 | @@ -0,0 +1,312 @@ | |||
347 | 1 | jsoniq version "1.0"; | ||
348 | 2 | |||
349 | 3 | (: | ||
350 | 4 | : Copyright 2013 The FLWOR Foundation. | ||
351 | 5 | : | ||
352 | 6 | : Licensed under the Apache License, Version 2.0 (the "License"); | ||
353 | 7 | : you may not use this file except in compliance with the License. | ||
354 | 8 | : You may obtain a copy of the License at | ||
355 | 9 | : | ||
356 | 10 | : http://www.apache.org/licenses/LICENSE-2.0 | ||
357 | 11 | : | ||
358 | 12 | : Unless required by applicable law or agreed to in writing, software | ||
359 | 13 | : distributed under the License is distributed on an "AS IS" BASIS, | ||
360 | 14 | : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
361 | 15 | : See the License for the specific language governing permissions and | ||
362 | 16 | : limitations under the License. | ||
363 | 17 | :) | ||
364 | 18 | |||
365 | 19 | (:~ | ||
366 | 20 | : This module defines a set of functions for working with maps. A map | ||
367 | 21 | : is identified by a string and can be created using the map:create function | ||
368 | 22 | : and dropped using the map:drop function. | ||
369 | 23 | : <p/> | ||
370 | 24 | : It is possible to create persistent and transient maps. The lifetime of a | ||
371 | 25 | : transient map is limited by the execution of the current query. | ||
372 | 26 | : A persistent map lives until it is explicitly dropped. | ||
373 | 27 | : Accordingly, it is also available to other requests. | ||
374 | 28 | : <p/> | ||
375 | 29 | : For example, | ||
376 | 30 | : <pre>map:create("my-map", ["string", "integer"], { "persistent" : false })</pre> | ||
377 | 31 | : will create a transient map named my-map having two keys. | ||
378 | 32 | : The types of the keys are string and integer. | ||
379 | 33 | : <p/> | ||
380 | 34 | : The key of a particular entry in the map can consist of a tuple of | ||
381 | 35 | : atomic values (called key attributes). The actual type of each attribute | ||
382 | 36 | : is determined when the map is created. The value of each entry is a | ||
383 | 37 | : sequence of items. If an item in this sequence is a object or array, | ||
384 | 38 | : this item needs to belong to a collection, otherwise, an error is raised. | ||
385 | 39 | : | ||
386 | 40 | : @author Matthias Brantner | ||
387 | 41 | :) | ||
388 | 42 | module namespace map = "http://zorba.io/modules/unordered-maps"; | ||
389 | 43 | |||
390 | 44 | declare namespace an = "http://zorba.io/annotations"; | ||
391 | 45 | declare namespace zerr = "http://zorba.io/errors"; | ||
392 | 46 | |||
393 | 47 | declare namespace ver = "http://zorba.io/options/versioning"; | ||
394 | 48 | declare option ver:module-version "1.0"; | ||
395 | 49 | |||
396 | 50 | (:~ | ||
397 | 51 | : Constant containing the field name of the options object | ||
398 | 52 | : indiciating whether a map is persistent or transient. | ||
399 | 53 | :) | ||
400 | 54 | declare variable $map:PERSISTENT as string := "persistent"; | ||
401 | 55 | |||
402 | 56 | (:~ | ||
403 | 57 | : Create a persistent map with a given name and type identifiers for the key | ||
404 | 58 | : attributes. | ||
405 | 59 | : <p/> | ||
406 | 60 | : If the map has only one key attribute, a single type identifier is given, | ||
407 | 61 | : for more than one key attribute an array of type identifiers is given. | ||
408 | 62 | : Calling this function is equivalent to calling create with the options | ||
409 | 63 | : <code>{ "persistent" : true }</code> | ||
410 | 64 | : Note that the function is sequential and immediately creates the map. | ||
411 | 65 | : <p/> | ||
412 | 66 | : Each key-type should be specified as string (e.g. "integer", | ||
413 | 67 | : "string", "boolean", "double", or "datetime"). | ||
414 | 68 | : <p/> | ||
415 | 69 | : For example, | ||
416 | 70 | : <pre>map:create("my-map", "string")</pre> or | ||
417 | 71 | : <pre>map:create("my-map", ["string", "integer"])</pre>. | ||
418 | 72 | : | ||
419 | 73 | : @param $name the name of the map (the restrictions on collection names apply) | ||
420 | 74 | : @param $key-type one type identifier or an array of type identifiers for the | ||
421 | 75 | : key attributes | ||
422 | 76 | : | ||
423 | 77 | : @return the function is sequential and immediately creates | ||
424 | 78 | : the corresponding map. It returns the empty-sequence. | ||
425 | 79 | : | ||
426 | 80 | : @error err:XPTY0004 if any of the key attribute types is not a subtype of | ||
427 | 81 | : anyAtomicType. | ||
428 | 82 | : @error zerr:ZSTR0001 if a map with the given name already exists. | ||
429 | 83 | : @error zerr:ZDDY1000 if the given name is not a legal collection name | ||
430 | 84 | : @error zerr:ZDDY0043 if any of the given options has an invalid type | ||
431 | 85 | : | ||
432 | 86 | : @see map:create#3 | ||
433 | 87 | :) | ||
434 | 88 | declare %an:sequential function map:create( | ||
435 | 89 | $name as string, | ||
436 | 90 | $key-types as item) as () external; | ||
437 | 91 | |||
438 | 92 | (:~ | ||
439 | 93 | : Create a map with a given name, type identifiers for the key attributes, and | ||
440 | 94 | : options. | ||
441 | 95 | : <p/> | ||
442 | 96 | : If the map has only one key attribute, a single type identifier is given, | ||
443 | 97 | : for more than one key attribute an array of type identifiers is given. | ||
444 | 98 | : Currently only one option is supported: To create a transient map the object | ||
445 | 99 | : <code>{ "persistent" : false }</code> | ||
446 | 100 | : has to be passed to the $options parameter. | ||
447 | 101 | : Note that the function is sequential and immediately creates the map in the | ||
448 | 102 | : store. | ||
449 | 103 | : <p/> | ||
450 | 104 | : Note that a map cannot be created if it already exists in a parent context. | ||
451 | 105 | : For example, a map that was created in an outer query cannot be | ||
452 | 106 | : created again in an inner query executed using the | ||
453 | 107 | : <code>reflection:eval-s</code> function. | ||
454 | 108 | : | ||
455 | 109 | : @param $name the name of the map (the restrictions on collection names apply) | ||
456 | 110 | : @param $key-type one type identifier or an array of type identifiers for the | ||
457 | 111 | : key attributes | ||
458 | 112 | : @param $options an object describing options for the map | ||
459 | 113 | : | ||
460 | 114 | : @return the function is sequential and immediately creates | ||
461 | 115 | : the corresponding map but returns the empty-sequence. | ||
462 | 116 | : | ||
463 | 117 | : @error err:XPTY0004 if any of the attribute types is not a subtype of | ||
464 | 118 | : anyAtomicType. | ||
465 | 119 | : @error zerr:ZSTR0001 if a map with the given name already exists. | ||
466 | 120 | : @error zerr:ZDDY1000 if the given name is not a legal collection name | ||
467 | 121 | : @error zerr:ZDDY0043 if any of the given options has an invalid type | ||
468 | 122 | : | ||
469 | 123 | : @see map:create#2 | ||
470 | 124 | :) | ||
471 | 125 | declare %an:sequential function map:create( | ||
472 | 126 | $name as string, | ||
473 | 127 | $key-types as item, | ||
474 | 128 | $options as object) as () external; | ||
475 | 129 | |||
476 | 130 | (:~ | ||
477 | 131 | : Deletes the map with the given name. | ||
478 | 132 | : <p/> | ||
479 | 133 | : Note that a map can only be dropped in the context it was created. | ||
480 | 134 | : For example, a map that was created in an outer query cannot be | ||
481 | 135 | : dropped in an inner query executed using the | ||
482 | 136 | : <code>reflection:eval-s</code> function. | ||
483 | 137 | : | ||
484 | 138 | : @param $name the name of the map to drop | ||
485 | 139 | : | ||
486 | 140 | : @return the function is sequential and immediately drops | ||
487 | 141 | : the map. It returns the empty-sequence. | ||
488 | 142 | : | ||
489 | 143 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
490 | 144 | :) | ||
491 | 145 | declare %an:sequential function map:drop( | ||
492 | 146 | $name as string) as () external; | ||
493 | 147 | |||
494 | 148 | (:~ | ||
495 | 149 | : Inserts a new entry into the map with the given name. | ||
496 | 150 | : <p/> | ||
497 | 151 | : If the map has only one key attribute, a single key value is given, for | ||
498 | 152 | : more than one key attribute an array of key values is given. | ||
499 | 153 | : If an entry with the given key already exists in the map, the value | ||
500 | 154 | : sequences of the existing entry and the sequence passed using $value | ||
501 | 155 | : argument are concatenated. | ||
502 | 156 | : <p/> | ||
503 | 157 | : If an item in the value sequence is an object or array, this | ||
504 | 158 | : item needs to belong to a collection, otherwise, an an error | ||
505 | 159 | : is raised. | ||
506 | 160 | : <p/> | ||
507 | 161 | : Note that it is possible to insert entries with empty key attributes | ||
508 | 162 | : or key attributes having the value <code>null</code>. However, as | ||
509 | 163 | : the comparison with an empty sequence or null always returns false, | ||
510 | 164 | : it is not possible to retrieve these entries. | ||
511 | 165 | : <p/> | ||
512 | 166 | : For example, | ||
513 | 167 | : <pre>map:insert("my-map", "key", "value")</pre> or | ||
514 | 168 | : <pre>map:insert("my-map", [ "key1", "key2" ] , (42, "value"))</pre>. | ||
515 | 169 | : | ||
516 | 170 | : | ||
517 | 171 | : @param $name the name of the map | ||
518 | 172 | : @param $key either a single attribute key or an array of keys | ||
519 | 173 | : @param $value the value of the entry to insert | ||
520 | 174 | : | ||
521 | 175 | : @return the function is sequential and immediately inserts | ||
522 | 176 | : the entry into the map. It returns the empty-sequence. | ||
523 | 177 | : | ||
524 | 178 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
525 | 179 | : @error zerr:ZDDY0025 if the given number of key attributes does not match | ||
526 | 180 | : the number of key attributes specified when creating | ||
527 | 181 | : the map (see the map:create function). | ||
528 | 182 | : @error zerr:ZXQD0005 if any of the given key attributes can not | ||
529 | 183 | : be cast (or is not a subtype) of the corresponding key attribute | ||
530 | 184 | : specified when creating the map. | ||
531 | 185 | : @error zerr:ZDDY1003 if the value to insert is an object or array | ||
532 | 186 | : it must belong to a collection. | ||
533 | 187 | :) | ||
534 | 188 | declare %an:sequential function map:insert( | ||
535 | 189 | $name as string, | ||
536 | 190 | $key as item, | ||
537 | 191 | $value as item*) as () external; | ||
538 | 192 | |||
539 | 193 | (:~ | ||
540 | 194 | : Returns the value of the entry with the given key from the map. | ||
541 | 195 | : <p/> | ||
542 | 196 | : If the map has only one key attribute, a single key value is given, for | ||
543 | 197 | : more than one key attribute an array of key values is given. | ||
544 | 198 | : <p/> | ||
545 | 199 | : Note that it is possible to insert entries with empty key attributes. | ||
546 | 200 | : However as the getting the entries is based on the "eq" comparison and | ||
547 | 201 | : as "eq" with an empty sequence always return false, it is not possible | ||
548 | 202 | : to retrieve these entries. | ||
549 | 203 | : <p/> | ||
550 | 204 | : For example, | ||
551 | 205 | : <pre>map:get("my-map", "key")</pre> or | ||
552 | 206 | : <pre>map:get("my-map", [ "key1", "key2" ])</pre>. | ||
553 | 207 | : | ||
554 | 208 | : @param $name the name of the map | ||
555 | 209 | : @param $key either a single attribute key or an array of keys | ||
556 | 210 | : | ||
557 | 211 | : @return the value of the entry in the map identified | ||
558 | 212 | : by the given key. The empty-sequence will be returned | ||
559 | 213 | : if no entry with the given key is contained in the map. | ||
560 | 214 | : | ||
561 | 215 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
562 | 216 | : @error zerr:ZDDY0025 if the given number of key attributes does not match | ||
563 | 217 | : the number of key attributes specified when creating | ||
564 | 218 | : the map (see the map:create function). | ||
565 | 219 | : @error zerr:ZXQD0005 if any of the given key attributes can not | ||
566 | 220 | : be cast (or is not a subtype) of the corresponding key attribute | ||
567 | 221 | : specified when creating the map. | ||
568 | 222 | : | ||
569 | 223 | : @see map:create | ||
570 | 224 | :) | ||
571 | 225 | declare function map:get( | ||
572 | 226 | $name as string, | ||
573 | 227 | $key as item) as item* external; | ||
574 | 228 | |||
575 | 229 | (:~ | ||
576 | 230 | : Removes an entry identified by the given key from the map. | ||
577 | 231 | : <p/> | ||
578 | 232 | : If the map has only one key attribute, a single key value is given, for | ||
579 | 233 | : more than one key attribute an array of key values is given. | ||
580 | 234 | : <p/> | ||
581 | 235 | : Note that it is possible to insert entries with empty key attributes. | ||
582 | 236 | : However as the removing the entries is based on the "eq" comparison and | ||
583 | 237 | : as "eq" with an empty sequence always return false, it is not possible | ||
584 | 238 | : to delete these entries. | ||
585 | 239 | : | ||
586 | 240 | : @param $name the name of the map | ||
587 | 241 | : @param $key either a single attribute key or an array of keys | ||
588 | 242 | : | ||
589 | 243 | : @return the function is sequential and immediately deletes | ||
590 | 244 | : the entry into the map but returns the | ||
591 | 245 | : empty-sequence. | ||
592 | 246 | : | ||
593 | 247 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
594 | 248 | : @error zerr:ZDDY0025 if the given number of key attributes does not match | ||
595 | 249 | : the number of key attributes specified when creating | ||
596 | 250 | : the map (see the map:create function). | ||
597 | 251 | : @error zerr:ZXQD0005 if any of the given key attributes can not | ||
598 | 252 | : be cast (or is not a subtype) of the corresponding key attribute | ||
599 | 253 | : specified when creating the map. | ||
600 | 254 | : | ||
601 | 255 | : @see map:create | ||
602 | 256 | :) | ||
603 | 257 | declare %an:sequential function map:delete( | ||
604 | 258 | $name as string, | ||
605 | 259 | $key as item) as () external; | ||
606 | 260 | |||
607 | 261 | (:~ | ||
608 | 262 | : Returns the keys of all entries of a map. The keys | ||
609 | 263 | : are returned as sequence of arrays. | ||
610 | 264 | : <p/> | ||
611 | 265 | : The following condition always holds: | ||
612 | 266 | : <tt>map:size($name) eq count(map:keys($name))</tt> | ||
613 | 267 | : | ||
614 | 268 | : @param $name the name of the map | ||
615 | 269 | : | ||
616 | 270 | : @return an sequence of arrays each array containing the values of all | ||
617 | 271 | : attributes of one key. | ||
618 | 272 | : | ||
619 | 273 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
620 | 274 | :) | ||
621 | 275 | declare function map:keys($name as string) as array* external; | ||
622 | 276 | |||
623 | 277 | (:~ | ||
624 | 278 | : Returns the number of entries in a map. | ||
625 | 279 | : <p/> | ||
626 | 280 | : The following condition always holds: | ||
627 | 281 | : <tt>map:size($name) eq count(map:keys($name))</tt> | ||
628 | 282 | : | ||
629 | 283 | : @param $name the name of the map | ||
630 | 284 | : | ||
631 | 285 | : @return the number of entries in the map. | ||
632 | 286 | : | ||
633 | 287 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
634 | 288 | :) | ||
635 | 289 | declare function map:size($name as string) as integer external; | ||
636 | 290 | |||
637 | 291 | (:~ | ||
638 | 292 | : The function returns a sequence of names of the maps that are | ||
639 | 293 | : available (persistent and non-persistent). The sequence will be | ||
640 | 294 | : empty if there are no maps. | ||
641 | 295 | : <p/> | ||
642 | 296 | : | ||
643 | 297 | : @return A sequence of string, one for each available map, or | ||
644 | 298 | : an empty sequence. | ||
645 | 299 | :) | ||
646 | 300 | declare function map:available-maps() as string* external; | ||
647 | 301 | |||
648 | 302 | (:~ | ||
649 | 303 | : The function returns the options that were passed during creation or the | ||
650 | 304 | : default options if no options were passed. | ||
651 | 305 | : | ||
652 | 306 | : @param $name the name of the map | ||
653 | 307 | : | ||
654 | 308 | : @return an options object | ||
655 | 309 | : | ||
656 | 310 | : @error zerr:ZDDY0023 if a map with the given name does not exist. | ||
657 | 311 | :) | ||
658 | 312 | declare function map:options($name as string) as object external; | ||
659 | 0 | 313 | ||
660 | === modified file 'src/context/dynamic_context.cpp' | |||
661 | --- src/context/dynamic_context.cpp 2013-08-02 18:36:02 +0000 | |||
662 | +++ src/context/dynamic_context.cpp 2013-09-02 20:59:05 +0000 | |||
663 | @@ -743,21 +743,29 @@ | |||
664 | 743 | /******************************************************************************* | 743 | /******************************************************************************* |
665 | 744 | 744 | ||
666 | 745 | ********************************************************************************/ | 745 | ********************************************************************************/ |
668 | 746 | store::Index* dynamic_context::getMap(store::Item* qname) const | 746 | store::Index* dynamic_context::getMap( |
669 | 747 | store::Item* qname, | ||
670 | 748 | bool lookupParent) const | ||
671 | 747 | { | 749 | { |
672 | 748 | if (theAvailableMaps == NULL) | ||
673 | 749 | return NULL; | ||
674 | 750 | |||
675 | 751 | store::Index_t map; | 750 | store::Index_t map; |
676 | 751 | const dynamic_context* c = this; | ||
677 | 752 | 752 | ||
686 | 753 | if (theAvailableMaps->get(qname, map)) | 753 | while (c) |
687 | 754 | { | 754 | { |
688 | 755 | return map.getp(); | 755 | if (c->theAvailableMaps && c->theAvailableMaps->get(qname, map)) |
689 | 756 | } | 756 | { |
690 | 757 | else | 757 | return map.getp(); |
691 | 758 | { | 758 | } |
692 | 759 | return NULL; | 759 | else |
693 | 760 | } | 760 | { |
694 | 761 | if (lookupParent) | ||
695 | 762 | c = c->getParent(); | ||
696 | 763 | else | ||
697 | 764 | c = NULL; | ||
698 | 765 | continue; | ||
699 | 766 | } | ||
700 | 767 | } | ||
701 | 768 | return NULL; | ||
702 | 761 | } | 769 | } |
703 | 762 | 770 | ||
704 | 763 | 771 | ||
705 | @@ -783,8 +791,12 @@ | |||
706 | 783 | ********************************************************************************/ | 791 | ********************************************************************************/ |
707 | 784 | void dynamic_context::unbindMap(store::Item* qname) | 792 | void dynamic_context::unbindMap(store::Item* qname) |
708 | 785 | { | 793 | { |
710 | 786 | if (theAvailableMaps != NULL) | 794 | store::Index_t map; |
711 | 795 | |||
712 | 796 | if (theAvailableMaps && theAvailableMaps->get(qname, map)) | ||
713 | 797 | { | ||
714 | 787 | theAvailableMaps->erase(qname); | 798 | theAvailableMaps->erase(qname); |
715 | 799 | } | ||
716 | 788 | } | 800 | } |
717 | 789 | 801 | ||
718 | 790 | 802 | ||
719 | @@ -793,14 +805,20 @@ | |||
720 | 793 | ********************************************************************************/ | 805 | ********************************************************************************/ |
721 | 794 | void dynamic_context::getMapNames(std::vector<store::Item_t>& names) const | 806 | void dynamic_context::getMapNames(std::vector<store::Item_t>& names) const |
722 | 795 | { | 807 | { |
725 | 796 | if (theAvailableMaps == NULL) | 808 | const dynamic_context* c = this; |
724 | 797 | return; | ||
726 | 798 | 809 | ||
730 | 799 | for (IndexMap::iterator lIter = theAvailableMaps->begin(); | 810 | while (c) |
728 | 800 | lIter != theAvailableMaps->end(); | ||
729 | 801 | ++lIter) | ||
731 | 802 | { | 811 | { |
733 | 803 | names.push_back(lIter.getKey()); | 812 | if (c->theAvailableMaps) |
734 | 813 | { | ||
735 | 814 | for (IndexMap::iterator lIter = c->theAvailableMaps->begin(); | ||
736 | 815 | lIter != c->theAvailableMaps->end(); | ||
737 | 816 | ++lIter) | ||
738 | 817 | { | ||
739 | 818 | names.push_back(lIter.getKey()); | ||
740 | 819 | } | ||
741 | 820 | } | ||
742 | 821 | c = c->getParent(); | ||
743 | 804 | } | 822 | } |
744 | 805 | } | 823 | } |
745 | 806 | 824 | ||
746 | 807 | 825 | ||
747 | === modified file 'src/context/dynamic_context.h' | |||
748 | --- src/context/dynamic_context.h 2013-06-11 23:38:49 +0000 | |||
749 | +++ src/context/dynamic_context.h 2013-09-02 20:59:05 +0000 | |||
750 | @@ -156,6 +156,8 @@ | |||
751 | 156 | 156 | ||
752 | 157 | dynamic_context* getParent() { return theParent; } | 157 | dynamic_context* getParent() { return theParent; } |
753 | 158 | 158 | ||
754 | 159 | const dynamic_context* getParent() const { return theParent; } | ||
755 | 160 | |||
756 | 159 | store::Item_t get_default_collection() const; | 161 | store::Item_t get_default_collection() const; |
757 | 160 | 162 | ||
758 | 161 | void set_default_collection(const store::Item_t& default_collection_uri); | 163 | void set_default_collection(const store::Item_t& default_collection_uri); |
759 | @@ -244,7 +246,7 @@ | |||
760 | 244 | 246 | ||
761 | 245 | void unbindIndex(store::Item* qname); | 247 | void unbindIndex(store::Item* qname); |
762 | 246 | 248 | ||
764 | 247 | store::Index* getMap(store::Item* qname) const; | 249 | store::Index* getMap(store::Item* qname, bool lookupParent = true) const; |
765 | 248 | 250 | ||
766 | 249 | void bindMap(store::Item* qname, store::Index_t& index); | 251 | void bindMap(store::Item* qname, store::Index_t& index); |
767 | 250 | 252 | ||
768 | 251 | 253 | ||
769 | === modified file 'src/context/static_context.cpp' | |||
770 | --- src/context/static_context.cpp 2013-08-30 17:45:50 +0000 | |||
771 | +++ src/context/static_context.cpp 2013-09-02 20:59:05 +0000 | |||
772 | @@ -407,8 +407,8 @@ | |||
773 | 407 | "http://www.zorba-xquery.com/modules/store/dynamic/documents"; | 407 | "http://www.zorba-xquery.com/modules/store/dynamic/documents"; |
774 | 408 | 408 | ||
775 | 409 | const char* | 409 | const char* |
778 | 410 | static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS = | 410 | static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS = |
779 | 411 | "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 411 | "http://zorba.io/modules/unordered-maps"; |
780 | 412 | 412 | ||
781 | 413 | const char* | 413 | const char* |
782 | 414 | static_context::JSONIQ_DM_NS = | 414 | static_context::JSONIQ_DM_NS = |
783 | @@ -536,7 +536,7 @@ | |||
784 | 536 | ns == ZORBA_NODEPOS_FN_NS || | 536 | ns == ZORBA_NODEPOS_FN_NS || |
785 | 537 | 537 | ||
786 | 538 | ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS || | 538 | ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS || |
788 | 539 | ns == ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS || | 539 | ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS || |
789 | 540 | ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS || | 540 | ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS || |
790 | 541 | ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS || | 541 | ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS || |
791 | 542 | ns == ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS || | 542 | ns == ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS || |
792 | @@ -620,6 +620,7 @@ | |||
793 | 620 | ns == ZORBA_XQDOC_FN_NS || | 620 | ns == ZORBA_XQDOC_FN_NS || |
794 | 621 | ns == ZORBA_URI_FN_NS || | 621 | ns == ZORBA_URI_FN_NS || |
795 | 622 | ns == ZORBA_RANDOM_FN_NS || | 622 | ns == ZORBA_RANDOM_FN_NS || |
796 | 623 | ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS || | ||
797 | 623 | ns == ZORBA_FETCH_FN_NS || | 624 | ns == ZORBA_FETCH_FN_NS || |
798 | 624 | #ifndef ZORBA_NO_FULL_TEXT | 625 | #ifndef ZORBA_NO_FULL_TEXT |
799 | 625 | ns == ZORBA_FULL_TEXT_FN_NS || | 626 | ns == ZORBA_FULL_TEXT_FN_NS || |
800 | 626 | 627 | ||
801 | === modified file 'src/context/static_context.h' | |||
802 | --- src/context/static_context.h 2013-07-26 20:43:25 +0000 | |||
803 | +++ src/context/static_context.h 2013-09-02 20:59:05 +0000 | |||
804 | @@ -533,7 +533,7 @@ | |||
805 | 533 | static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DDL_FN_NS; | 533 | static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DDL_FN_NS; |
806 | 534 | static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DML_FN_NS; | 534 | static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DML_FN_NS; |
807 | 535 | static const char* ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS; | 535 | static const char* ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS; |
809 | 536 | static const char* ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS; | 536 | static const char* ZORBA_STORE_UNORDERED_MAPS_FN_NS; |
810 | 537 | 537 | ||
811 | 538 | static const char* JSONIQ_DM_NS; | 538 | static const char* JSONIQ_DM_NS; |
812 | 539 | static const char* JSONIQ_FN_NS; | 539 | static const char* JSONIQ_FN_NS; |
813 | 540 | 540 | ||
814 | === modified file 'src/diagnostics/diagnostic_en.xml' | |||
815 | --- src/diagnostics/diagnostic_en.xml 2013-08-30 14:50:21 +0000 | |||
816 | +++ src/diagnostics/diagnostic_en.xml 2013-09-02 20:59:05 +0000 | |||
817 | @@ -2852,6 +2852,14 @@ | |||
818 | 2852 | <value>"$1": collection was modified while reading</value> | 2852 | <value>"$1": collection was modified while reading</value> |
819 | 2853 | </diagnostic> | 2853 | </diagnostic> |
820 | 2854 | 2854 | ||
821 | 2855 | <diagnostic code="ZDDY0042" name="ITEM_NOT_IN_COLLECTION"> | ||
822 | 2856 | <value>"$1": map insertion requires $2 to belong to a collection</value> | ||
823 | 2857 | </diagnostic> | ||
824 | 2858 | |||
825 | 2859 | <diagnostic code="ZDDY0043" name="INVALID_OPTION_TYPE"> | ||
826 | 2860 | <value>"$1": invalid type for option "$2"</value> | ||
827 | 2861 | </diagnostic> | ||
828 | 2862 | |||
829 | 2855 | <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED"> | 2863 | <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED"> |
830 | 2856 | <value>"$1": collection already declared</value> | 2864 | <value>"$1": collection already declared</value> |
831 | 2857 | </diagnostic> | 2865 | </diagnostic> |
832 | 2858 | 2866 | ||
833 | === modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp' | |||
834 | --- src/diagnostics/pregenerated/diagnostic_list.cpp 2013-08-12 13:05:15 +0000 | |||
835 | +++ src/diagnostics/pregenerated/diagnostic_list.cpp 2013-09-02 20:59:05 +0000 | |||
836 | @@ -1020,6 +1020,12 @@ | |||
837 | 1020 | ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION( "ZDDY0041" ); | 1020 | ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION( "ZDDY0041" ); |
838 | 1021 | 1021 | ||
839 | 1022 | 1022 | ||
840 | 1023 | ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION( "ZDDY0042" ); | ||
841 | 1024 | |||
842 | 1025 | |||
843 | 1026 | ZorbaErrorCode ZDDY0043_INVALID_OPTION_TYPE( "ZDDY0043" ); | ||
844 | 1027 | |||
845 | 1028 | |||
846 | 1023 | ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" ); | 1029 | ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" ); |
847 | 1024 | 1030 | ||
848 | 1025 | 1031 | ||
849 | 1026 | 1032 | ||
850 | === modified file 'src/diagnostics/pregenerated/dict_en.cpp' | |||
851 | --- src/diagnostics/pregenerated/dict_en.cpp 2013-08-30 14:50:21 +0000 | |||
852 | +++ src/diagnostics/pregenerated/dict_en.cpp 2013-09-02 20:59:05 +0000 | |||
853 | @@ -357,6 +357,8 @@ | |||
854 | 357 | { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" }, | 357 | { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" }, |
855 | 358 | { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." }, | 358 | { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." }, |
856 | 359 | { "ZDDY0041", "\"$1\": collection was modified while reading" }, | 359 | { "ZDDY0041", "\"$1\": collection was modified while reading" }, |
857 | 360 | { "ZDDY0042", "\"$1\": map insertion requires $2 to belong to a collection" }, | ||
858 | 361 | { "ZDDY0043", "\"$1\": invalid type for option \"$2\"" }, | ||
859 | 360 | { "ZDST0001", "\"$1\": collection already declared" }, | 362 | { "ZDST0001", "\"$1\": collection already declared" }, |
860 | 361 | { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" }, | 363 | { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" }, |
861 | 362 | { "ZDST0003", "\"$1\": collection declaration not allowed in main module" }, | 364 | { "ZDST0003", "\"$1\": collection declaration not allowed in main module" }, |
862 | 363 | 365 | ||
863 | === modified file 'src/functions/pregenerated/func_maps.cpp' | |||
864 | --- src/functions/pregenerated/func_maps.cpp 2013-03-05 23:11:50 +0000 | |||
865 | +++ src/functions/pregenerated/func_maps.cpp 2013-09-02 20:59:05 +0000 | |||
866 | @@ -31,7 +31,7 @@ | |||
867 | 31 | 31 | ||
868 | 32 | 32 | ||
869 | 33 | 33 | ||
871 | 34 | PlanIter_t zorba_store_data_structure_unordered_map_create::codegen( | 34 | PlanIter_t zorba_store_unordered_maps_create::codegen( |
872 | 35 | CompilerCB*, | 35 | CompilerCB*, |
873 | 36 | static_context* sctx, | 36 | static_context* sctx, |
874 | 37 | const QueryLoc& loc, | 37 | const QueryLoc& loc, |
875 | @@ -41,27 +41,17 @@ | |||
876 | 41 | return new MapCreateIterator(sctx, loc, argv); | 41 | return new MapCreateIterator(sctx, loc, argv); |
877 | 42 | } | 42 | } |
878 | 43 | 43 | ||
900 | 44 | PlanIter_t zorba_store_data_structure_unordered_map_create_transient::codegen( | 44 | PlanIter_t zorba_store_unordered_maps_drop::codegen( |
901 | 45 | CompilerCB*, | 45 | CompilerCB*, |
902 | 46 | static_context* sctx, | 46 | static_context* sctx, |
903 | 47 | const QueryLoc& loc, | 47 | const QueryLoc& loc, |
904 | 48 | std::vector<PlanIter_t>& argv, | 48 | std::vector<PlanIter_t>& argv, |
905 | 49 | expr& ann) const | 49 | expr& ann) const |
906 | 50 | { | 50 | { |
907 | 51 | return new MapCreateTransientIterator(sctx, loc, argv); | 51 | return new MapDropIterator(sctx, loc, argv); |
908 | 52 | } | 52 | } |
909 | 53 | 53 | ||
910 | 54 | PlanIter_t zorba_store_data_structure_unordered_map_delete::codegen( | 54 | PlanIter_t zorba_store_unordered_maps_get::codegen( |
890 | 55 | CompilerCB*, | ||
891 | 56 | static_context* sctx, | ||
892 | 57 | const QueryLoc& loc, | ||
893 | 58 | std::vector<PlanIter_t>& argv, | ||
894 | 59 | expr& ann) const | ||
895 | 60 | { | ||
896 | 61 | return new MapDestroyIterator(sctx, loc, argv); | ||
897 | 62 | } | ||
898 | 63 | |||
899 | 64 | PlanIter_t zorba_store_data_structure_unordered_map_get::codegen( | ||
911 | 65 | CompilerCB*, | 55 | CompilerCB*, |
912 | 66 | static_context* sctx, | 56 | static_context* sctx, |
913 | 67 | const QueryLoc& loc, | 57 | const QueryLoc& loc, |
914 | @@ -71,7 +61,7 @@ | |||
915 | 71 | return new MapGetIterator(sctx, loc, argv); | 61 | return new MapGetIterator(sctx, loc, argv); |
916 | 72 | } | 62 | } |
917 | 73 | 63 | ||
919 | 74 | PlanIter_t zorba_store_data_structure_unordered_map_insert::codegen( | 64 | PlanIter_t zorba_store_unordered_maps_insert::codegen( |
920 | 75 | CompilerCB*, | 65 | CompilerCB*, |
921 | 76 | static_context* sctx, | 66 | static_context* sctx, |
922 | 77 | const QueryLoc& loc, | 67 | const QueryLoc& loc, |
923 | @@ -81,17 +71,17 @@ | |||
924 | 81 | return new MapInsertIterator(sctx, loc, argv); | 71 | return new MapInsertIterator(sctx, loc, argv); |
925 | 82 | } | 72 | } |
926 | 83 | 73 | ||
928 | 84 | PlanIter_t zorba_store_data_structure_unordered_map_remove::codegen( | 74 | PlanIter_t zorba_store_unordered_maps_delete::codegen( |
929 | 85 | CompilerCB*, | 75 | CompilerCB*, |
930 | 86 | static_context* sctx, | 76 | static_context* sctx, |
931 | 87 | const QueryLoc& loc, | 77 | const QueryLoc& loc, |
932 | 88 | std::vector<PlanIter_t>& argv, | 78 | std::vector<PlanIter_t>& argv, |
933 | 89 | expr& ann) const | 79 | expr& ann) const |
934 | 90 | { | 80 | { |
936 | 91 | return new MapRemoveIterator(sctx, loc, argv); | 81 | return new MapDeleteIterator(sctx, loc, argv); |
937 | 92 | } | 82 | } |
938 | 93 | 83 | ||
940 | 94 | PlanIter_t zorba_store_data_structure_unordered_map_keys::codegen( | 84 | PlanIter_t zorba_store_unordered_maps_keys::codegen( |
941 | 95 | CompilerCB*, | 85 | CompilerCB*, |
942 | 96 | static_context* sctx, | 86 | static_context* sctx, |
943 | 97 | const QueryLoc& loc, | 87 | const QueryLoc& loc, |
944 | @@ -101,7 +91,7 @@ | |||
945 | 101 | return new MapKeysIterator(sctx, loc, argv); | 91 | return new MapKeysIterator(sctx, loc, argv); |
946 | 102 | } | 92 | } |
947 | 103 | 93 | ||
949 | 104 | PlanIter_t zorba_store_data_structure_unordered_map_size::codegen( | 94 | PlanIter_t zorba_store_unordered_maps_size::codegen( |
950 | 105 | CompilerCB*, | 95 | CompilerCB*, |
951 | 106 | static_context* sctx, | 96 | static_context* sctx, |
952 | 107 | const QueryLoc& loc, | 97 | const QueryLoc& loc, |
953 | @@ -111,7 +101,7 @@ | |||
954 | 111 | return new MapSizeIterator(sctx, loc, argv); | 101 | return new MapSizeIterator(sctx, loc, argv); |
955 | 112 | } | 102 | } |
956 | 113 | 103 | ||
958 | 114 | PlanIter_t zorba_store_data_structure_unordered_map_available_maps::codegen( | 104 | PlanIter_t zorba_store_unordered_maps_available_maps::codegen( |
959 | 115 | CompilerCB*, | 105 | CompilerCB*, |
960 | 116 | static_context* sctx, | 106 | static_context* sctx, |
961 | 117 | const QueryLoc& loc, | 107 | const QueryLoc& loc, |
962 | @@ -121,14 +111,14 @@ | |||
963 | 121 | return new AvailableMapsIterator(sctx, loc, argv); | 111 | return new AvailableMapsIterator(sctx, loc, argv); |
964 | 122 | } | 112 | } |
965 | 123 | 113 | ||
967 | 124 | PlanIter_t zorba_store_data_structure_unordered_map_is_transient::codegen( | 114 | PlanIter_t zorba_store_unordered_maps_options::codegen( |
968 | 125 | CompilerCB*, | 115 | CompilerCB*, |
969 | 126 | static_context* sctx, | 116 | static_context* sctx, |
970 | 127 | const QueryLoc& loc, | 117 | const QueryLoc& loc, |
971 | 128 | std::vector<PlanIter_t>& argv, | 118 | std::vector<PlanIter_t>& argv, |
972 | 129 | expr& ann) const | 119 | expr& ann) const |
973 | 130 | { | 120 | { |
975 | 131 | return new MapIsTransientIterator(sctx, loc, argv); | 121 | return new MapOptionsIterator(sctx, loc, argv); |
976 | 132 | } | 122 | } |
977 | 133 | 123 | ||
978 | 134 | void populate_context_maps(static_context* sctx) | 124 | void populate_context_maps(static_context* sctx) |
979 | @@ -136,124 +126,125 @@ | |||
980 | 136 | 126 | ||
981 | 137 | 127 | ||
982 | 138 | { | 128 | { |
1076 | 139 | std::vector<xqtref_t> lParamTypes; | 129 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create, |
1077 | 140 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); | 130 | (createQName("http://zorba.io/modules/unordered-maps","","create"), |
1078 | 141 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create, | 131 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1079 | 142 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create"), | 132 | GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1080 | 143 | lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), | 133 | GENV_TYPESYSTEM.EMPTY_TYPE), |
1081 | 144 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N); | 134 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_2); |
1082 | 145 | 135 | ||
1083 | 146 | } | 136 | } |
1084 | 147 | 137 | ||
1085 | 148 | 138 | ||
1086 | 149 | 139 | ||
1087 | 150 | 140 | ||
1088 | 151 | { | 141 | { |
1089 | 152 | std::vector<xqtref_t> lParamTypes; | 142 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create, |
1090 | 153 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); | 143 | (createQName("http://zorba.io/modules/unordered-maps","","create"), |
1091 | 154 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create_transient, | 144 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1092 | 155 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create-transient"), | 145 | GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1093 | 156 | lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), | 146 | GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, |
1094 | 157 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N); | 147 | GENV_TYPESYSTEM.EMPTY_TYPE), |
1095 | 158 | 148 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_3); | |
1096 | 159 | } | 149 | |
1097 | 160 | 150 | } | |
1098 | 161 | 151 | ||
1099 | 162 | 152 | ||
1100 | 163 | 153 | ||
1101 | 164 | { | 154 | |
1102 | 165 | DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_delete, | 155 | { |
1103 | 166 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","delete"), | 156 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_drop, |
1104 | 167 | GENV_TYPESYSTEM.QNAME_TYPE_ONE, | 157 | (createQName("http://zorba.io/modules/unordered-maps","","drop"), |
1105 | 168 | GENV_TYPESYSTEM.EMPTY_TYPE), | 158 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1106 | 169 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1); | 159 | GENV_TYPESYSTEM.EMPTY_TYPE), |
1107 | 170 | 160 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DROP_1); | |
1108 | 171 | } | 161 | |
1109 | 172 | 162 | } | |
1110 | 173 | 163 | ||
1111 | 174 | 164 | ||
1112 | 175 | 165 | ||
1113 | 176 | { | 166 | |
1114 | 177 | std::vector<xqtref_t> lParamTypes; | 167 | { |
1115 | 178 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); | 168 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_get, |
1116 | 179 | lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_get, | 169 | (createQName("http://zorba.io/modules/unordered-maps","","get"), |
1117 | 180 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","get"), | 170 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1118 | 181 | lParamTypes, GENV_TYPESYSTEM.ITEM_TYPE_STAR, true), | 171 | GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1119 | 182 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N); | 172 | GENV_TYPESYSTEM.ITEM_TYPE_STAR), |
1120 | 183 | 173 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_GET_2); | |
1121 | 184 | } | 174 | |
1122 | 185 | 175 | } | |
1123 | 186 | 176 | ||
1124 | 187 | 177 | ||
1125 | 188 | 178 | ||
1126 | 189 | { | 179 | |
1127 | 190 | std::vector<xqtref_t> lParamTypes; | 180 | { |
1128 | 191 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); | 181 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_insert, |
1129 | 192 | lParamTypes.push_back(GENV_TYPESYSTEM.ITEM_TYPE_STAR); | 182 | (createQName("http://zorba.io/modules/unordered-maps","","insert"), |
1130 | 193 | lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_insert, | 183 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1131 | 194 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","insert"), | 184 | GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1132 | 195 | lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), | 185 | GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
1133 | 196 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N); | 186 | GENV_TYPESYSTEM.EMPTY_TYPE), |
1134 | 197 | 187 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_INSERT_3); | |
1135 | 198 | } | 188 | |
1136 | 199 | 189 | } | |
1137 | 200 | 190 | ||
1138 | 201 | 191 | ||
1139 | 202 | 192 | ||
1140 | 203 | { | 193 | |
1141 | 204 | std::vector<xqtref_t> lParamTypes; | 194 | { |
1142 | 205 | lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); | 195 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_delete, |
1143 | 206 | lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_remove, | 196 | (createQName("http://zorba.io/modules/unordered-maps","","delete"), |
1144 | 207 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","remove"), | 197 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1145 | 208 | lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), | 198 | GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1146 | 209 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N); | 199 | GENV_TYPESYSTEM.EMPTY_TYPE), |
1147 | 210 | 200 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DELETE_2); | |
1148 | 211 | } | 201 | |
1149 | 212 | 202 | } | |
1150 | 213 | 203 | ||
1151 | 214 | 204 | ||
1152 | 215 | 205 | ||
1153 | 216 | { | 206 | |
1154 | 217 | DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_keys, | 207 | { |
1155 | 218 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","keys"), | 208 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_keys, |
1156 | 219 | GENV_TYPESYSTEM.QNAME_TYPE_ONE, | 209 | (createQName("http://zorba.io/modules/unordered-maps","","keys"), |
1157 | 220 | GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR), | 210 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1158 | 221 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1); | 211 | GENV_TYPESYSTEM.JSON_ARRAY_TYPE_STAR), |
1159 | 222 | 212 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_KEYS_1); | |
1160 | 223 | } | 213 | |
1161 | 224 | 214 | } | |
1162 | 225 | 215 | ||
1163 | 226 | 216 | ||
1164 | 227 | 217 | ||
1165 | 228 | { | 218 | |
1166 | 229 | DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_size, | 219 | { |
1167 | 230 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","size"), | 220 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_size, |
1168 | 231 | GENV_TYPESYSTEM.QNAME_TYPE_ONE, | 221 | (createQName("http://zorba.io/modules/unordered-maps","","size"), |
1169 | 222 | GENV_TYPESYSTEM.STRING_TYPE_ONE, | ||
1170 | 232 | GENV_TYPESYSTEM.INTEGER_TYPE_ONE), | 223 | GENV_TYPESYSTEM.INTEGER_TYPE_ONE), |
1195 | 233 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1); | 224 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_SIZE_1); |
1196 | 234 | 225 | ||
1197 | 235 | } | 226 | } |
1198 | 236 | 227 | ||
1199 | 237 | 228 | ||
1200 | 238 | 229 | ||
1201 | 239 | 230 | ||
1202 | 240 | { | 231 | { |
1203 | 241 | DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_available_maps, | 232 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_available_maps, |
1204 | 242 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","available-maps"), | 233 | (createQName("http://zorba.io/modules/unordered-maps","","available-maps"), |
1205 | 243 | GENV_TYPESYSTEM.QNAME_TYPE_STAR), | 234 | GENV_TYPESYSTEM.STRING_TYPE_STAR), |
1206 | 244 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0); | 235 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0); |
1207 | 245 | 236 | ||
1208 | 246 | } | 237 | } |
1209 | 247 | 238 | ||
1210 | 248 | 239 | ||
1211 | 249 | 240 | ||
1212 | 250 | 241 | ||
1213 | 251 | { | 242 | { |
1214 | 252 | DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_is_transient, | 243 | DECL_WITH_KIND(sctx, zorba_store_unordered_maps_options, |
1215 | 253 | (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","is-transient"), | 244 | (createQName("http://zorba.io/modules/unordered-maps","","options"), |
1216 | 254 | GENV_TYPESYSTEM.QNAME_TYPE_ONE, | 245 | GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1217 | 255 | GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE), | 246 | GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE), |
1218 | 256 | FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1); | 247 | FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1); |
1219 | 257 | 248 | ||
1220 | 258 | } | 249 | } |
1221 | 259 | 250 | ||
1222 | 260 | 251 | ||
1223 | === modified file 'src/functions/pregenerated/func_maps.h' | |||
1224 | --- src/functions/pregenerated/func_maps.h 2013-03-05 23:11:50 +0000 | |||
1225 | +++ src/functions/pregenerated/func_maps.h 2013-09-02 20:59:05 +0000 | |||
1226 | @@ -38,85 +38,66 @@ | |||
1227 | 38 | 38 | ||
1228 | 39 | 39 | ||
1229 | 40 | 40 | ||
1309 | 41 | //zorba-store-data-structure-unordered-map:create | 41 | //zorba-store-unordered-maps:create |
1310 | 42 | class zorba_store_data_structure_unordered_map_create : public function | 42 | class zorba_store_unordered_maps_create : public function |
1311 | 43 | { | 43 | { |
1312 | 44 | public: | 44 | public: |
1313 | 45 | zorba_store_data_structure_unordered_map_create(const signature& sig, FunctionConsts::FunctionKind kind) | 45 | zorba_store_unordered_maps_create(const signature& sig, FunctionConsts::FunctionKind kind) |
1314 | 46 | : | 46 | : |
1315 | 47 | function(sig, kind) | 47 | function(sig, kind) |
1316 | 48 | { | 48 | { |
1317 | 49 | 49 | ||
1318 | 50 | } | 50 | } |
1319 | 51 | 51 | ||
1320 | 52 | unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } | 52 | unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1321 | 53 | 53 | ||
1322 | 54 | bool accessesDynCtx() const { return true; } | 54 | bool accessesDynCtx() const { return true; } |
1323 | 55 | 55 | ||
1324 | 56 | CODEGEN_DECL(); | 56 | CODEGEN_DECL(); |
1325 | 57 | }; | 57 | }; |
1326 | 58 | 58 | ||
1327 | 59 | 59 | ||
1328 | 60 | //zorba-store-data-structure-unordered-map:create-transient | 60 | //zorba-store-unordered-maps:drop |
1329 | 61 | class zorba_store_data_structure_unordered_map_create_transient : public function | 61 | class zorba_store_unordered_maps_drop : public function |
1330 | 62 | { | 62 | { |
1331 | 63 | public: | 63 | public: |
1332 | 64 | zorba_store_data_structure_unordered_map_create_transient(const signature& sig, FunctionConsts::FunctionKind kind) | 64 | zorba_store_unordered_maps_drop(const signature& sig, FunctionConsts::FunctionKind kind) |
1333 | 65 | : | 65 | : |
1334 | 66 | function(sig, kind) | 66 | function(sig, kind) |
1335 | 67 | { | 67 | { |
1336 | 68 | 68 | ||
1337 | 69 | } | 69 | } |
1338 | 70 | 70 | ||
1339 | 71 | unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } | 71 | unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1340 | 72 | 72 | ||
1341 | 73 | bool accessesDynCtx() const { return true; } | 73 | bool accessesDynCtx() const { return true; } |
1342 | 74 | 74 | ||
1343 | 75 | CODEGEN_DECL(); | 75 | CODEGEN_DECL(); |
1344 | 76 | }; | 76 | }; |
1345 | 77 | 77 | ||
1346 | 78 | 78 | ||
1347 | 79 | //zorba-store-data-structure-unordered-map:delete | 79 | //zorba-store-unordered-maps:get |
1348 | 80 | class zorba_store_data_structure_unordered_map_delete : public function | 80 | class zorba_store_unordered_maps_get : public function |
1349 | 81 | { | 81 | { |
1350 | 82 | public: | 82 | public: |
1351 | 83 | zorba_store_data_structure_unordered_map_delete(const signature& sig, FunctionConsts::FunctionKind kind) | 83 | zorba_store_unordered_maps_get(const signature& sig, FunctionConsts::FunctionKind kind) |
1352 | 84 | : | 84 | : |
1353 | 85 | function(sig, kind) | 85 | function(sig, kind) |
1354 | 86 | { | 86 | { |
1355 | 87 | 87 | ||
1356 | 88 | } | 88 | } |
1357 | 89 | 89 | ||
1358 | 90 | unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } | 90 | bool accessesDynCtx() const { return true; } |
1359 | 91 | 91 | ||
1360 | 92 | bool accessesDynCtx() const { return true; } | 92 | CODEGEN_DECL(); |
1361 | 93 | 93 | }; | |
1362 | 94 | CODEGEN_DECL(); | 94 | |
1363 | 95 | }; | 95 | |
1364 | 96 | 96 | //zorba-store-unordered-maps:insert | |
1365 | 97 | 97 | class zorba_store_unordered_maps_insert : public function | |
1366 | 98 | //zorba-store-data-structure-unordered-map:get | 98 | { |
1367 | 99 | class zorba_store_data_structure_unordered_map_get : public function | 99 | public: |
1368 | 100 | { | 100 | zorba_store_unordered_maps_insert(const signature& sig, FunctionConsts::FunctionKind kind) |
1290 | 101 | public: | ||
1291 | 102 | zorba_store_data_structure_unordered_map_get(const signature& sig, FunctionConsts::FunctionKind kind) | ||
1292 | 103 | : | ||
1293 | 104 | function(sig, kind) | ||
1294 | 105 | { | ||
1295 | 106 | |||
1296 | 107 | } | ||
1297 | 108 | |||
1298 | 109 | bool accessesDynCtx() const { return true; } | ||
1299 | 110 | |||
1300 | 111 | CODEGEN_DECL(); | ||
1301 | 112 | }; | ||
1302 | 113 | |||
1303 | 114 | |||
1304 | 115 | //zorba-store-data-structure-unordered-map:insert | ||
1305 | 116 | class zorba_store_data_structure_unordered_map_insert : public function | ||
1306 | 117 | { | ||
1307 | 118 | public: | ||
1308 | 119 | zorba_store_data_structure_unordered_map_insert(const signature& sig, FunctionConsts::FunctionKind kind) | ||
1369 | 120 | : | 101 | : |
1370 | 121 | function(sig, kind) | 102 | function(sig, kind) |
1371 | 122 | { | 103 | { |
1372 | @@ -133,11 +114,11 @@ | |||
1373 | 133 | }; | 114 | }; |
1374 | 134 | 115 | ||
1375 | 135 | 116 | ||
1378 | 136 | //zorba-store-data-structure-unordered-map:remove | 117 | //zorba-store-unordered-maps:delete |
1379 | 137 | class zorba_store_data_structure_unordered_map_remove : public function | 118 | class zorba_store_unordered_maps_delete : public function |
1380 | 138 | { | 119 | { |
1381 | 139 | public: | 120 | public: |
1383 | 140 | zorba_store_data_structure_unordered_map_remove(const signature& sig, FunctionConsts::FunctionKind kind) | 121 | zorba_store_unordered_maps_delete(const signature& sig, FunctionConsts::FunctionKind kind) |
1384 | 141 | : | 122 | : |
1385 | 142 | function(sig, kind) | 123 | function(sig, kind) |
1386 | 143 | { | 124 | { |
1387 | @@ -152,62 +133,62 @@ | |||
1388 | 152 | }; | 133 | }; |
1389 | 153 | 134 | ||
1390 | 154 | 135 | ||
1447 | 155 | //zorba-store-data-structure-unordered-map:keys | 136 | //zorba-store-unordered-maps:keys |
1448 | 156 | class zorba_store_data_structure_unordered_map_keys : public function | 137 | class zorba_store_unordered_maps_keys : public function |
1449 | 157 | { | 138 | { |
1450 | 158 | public: | 139 | public: |
1451 | 159 | zorba_store_data_structure_unordered_map_keys(const signature& sig, FunctionConsts::FunctionKind kind) | 140 | zorba_store_unordered_maps_keys(const signature& sig, FunctionConsts::FunctionKind kind) |
1452 | 160 | : | 141 | : |
1453 | 161 | function(sig, kind) | 142 | function(sig, kind) |
1454 | 162 | { | 143 | { |
1455 | 163 | 144 | ||
1456 | 164 | } | 145 | } |
1457 | 165 | 146 | ||
1458 | 166 | bool accessesDynCtx() const { return true; } | 147 | bool accessesDynCtx() const { return true; } |
1459 | 167 | 148 | ||
1460 | 168 | CODEGEN_DECL(); | 149 | CODEGEN_DECL(); |
1461 | 169 | }; | 150 | }; |
1462 | 170 | 151 | ||
1463 | 171 | 152 | ||
1464 | 172 | //zorba-store-data-structure-unordered-map:size | 153 | //zorba-store-unordered-maps:size |
1465 | 173 | class zorba_store_data_structure_unordered_map_size : public function | 154 | class zorba_store_unordered_maps_size : public function |
1466 | 174 | { | 155 | { |
1467 | 175 | public: | 156 | public: |
1468 | 176 | zorba_store_data_structure_unordered_map_size(const signature& sig, FunctionConsts::FunctionKind kind) | 157 | zorba_store_unordered_maps_size(const signature& sig, FunctionConsts::FunctionKind kind) |
1469 | 177 | : | 158 | : |
1470 | 178 | function(sig, kind) | 159 | function(sig, kind) |
1471 | 179 | { | 160 | { |
1472 | 180 | 161 | ||
1473 | 181 | } | 162 | } |
1474 | 182 | 163 | ||
1475 | 183 | bool accessesDynCtx() const { return true; } | 164 | bool accessesDynCtx() const { return true; } |
1476 | 184 | 165 | ||
1477 | 185 | CODEGEN_DECL(); | 166 | CODEGEN_DECL(); |
1478 | 186 | }; | 167 | }; |
1479 | 187 | 168 | ||
1480 | 188 | 169 | ||
1481 | 189 | //zorba-store-data-structure-unordered-map:available-maps | 170 | //zorba-store-unordered-maps:available-maps |
1482 | 190 | class zorba_store_data_structure_unordered_map_available_maps : public function | 171 | class zorba_store_unordered_maps_available_maps : public function |
1483 | 191 | { | 172 | { |
1484 | 192 | public: | 173 | public: |
1485 | 193 | zorba_store_data_structure_unordered_map_available_maps(const signature& sig, FunctionConsts::FunctionKind kind) | 174 | zorba_store_unordered_maps_available_maps(const signature& sig, FunctionConsts::FunctionKind kind) |
1486 | 194 | : | 175 | : |
1487 | 195 | function(sig, kind) | 176 | function(sig, kind) |
1488 | 196 | { | 177 | { |
1489 | 197 | 178 | ||
1490 | 198 | } | 179 | } |
1491 | 199 | 180 | ||
1492 | 200 | bool accessesDynCtx() const { return true; } | 181 | bool accessesDynCtx() const { return true; } |
1493 | 201 | 182 | ||
1494 | 202 | CODEGEN_DECL(); | 183 | CODEGEN_DECL(); |
1495 | 203 | }; | 184 | }; |
1496 | 204 | 185 | ||
1497 | 205 | 186 | ||
1498 | 206 | //zorba-store-data-structure-unordered-map:is-transient | 187 | //zorba-store-unordered-maps:options |
1499 | 207 | class zorba_store_data_structure_unordered_map_is_transient : public function | 188 | class zorba_store_unordered_maps_options : public function |
1500 | 208 | { | 189 | { |
1501 | 209 | public: | 190 | public: |
1502 | 210 | zorba_store_data_structure_unordered_map_is_transient(const signature& sig, FunctionConsts::FunctionKind kind) | 191 | zorba_store_unordered_maps_options(const signature& sig, FunctionConsts::FunctionKind kind) |
1503 | 211 | : | 192 | : |
1504 | 212 | function(sig, kind) | 193 | function(sig, kind) |
1505 | 213 | { | 194 | { |
1506 | 214 | 195 | ||
1507 | === modified file 'src/functions/pregenerated/function_enum.h' | |||
1508 | --- src/functions/pregenerated/function_enum.h 2013-08-16 13:00:06 +0000 | |||
1509 | +++ src/functions/pregenerated/function_enum.h 2013-09-02 20:59:05 +0000 | |||
1510 | @@ -444,16 +444,16 @@ | |||
1511 | 444 | ZORBA_STORE_DOCUMENTS_DOCUMENT_1, | 444 | ZORBA_STORE_DOCUMENTS_DOCUMENT_1, |
1512 | 445 | ZORBA_STORE_DOCUMENTS_AVAILABLE_DOCUMENTS_0, | 445 | ZORBA_STORE_DOCUMENTS_AVAILABLE_DOCUMENTS_0, |
1513 | 446 | ZORBA_STORE_DOCUMENTS_IS_AVAILABLE_DOCUMENT_1, | 446 | ZORBA_STORE_DOCUMENTS_IS_AVAILABLE_DOCUMENT_1, |
1524 | 447 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N, | 447 | ZORBA_STORE_UNORDERED_MAPS_CREATE_2, |
1525 | 448 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N, | 448 | ZORBA_STORE_UNORDERED_MAPS_CREATE_3, |
1526 | 449 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1, | 449 | ZORBA_STORE_UNORDERED_MAPS_DROP_1, |
1527 | 450 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N, | 450 | ZORBA_STORE_UNORDERED_MAPS_GET_2, |
1528 | 451 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N, | 451 | ZORBA_STORE_UNORDERED_MAPS_INSERT_3, |
1529 | 452 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N, | 452 | ZORBA_STORE_UNORDERED_MAPS_DELETE_2, |
1530 | 453 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1, | 453 | ZORBA_STORE_UNORDERED_MAPS_KEYS_1, |
1531 | 454 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1, | 454 | ZORBA_STORE_UNORDERED_MAPS_SIZE_1, |
1532 | 455 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0, | 455 | ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0, |
1533 | 456 | ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1, | 456 | ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1, |
1534 | 457 | FN_CODEPOINTS_TO_STRING_1, | 457 | FN_CODEPOINTS_TO_STRING_1, |
1535 | 458 | FN_STRING_TO_CODEPOINTS_1, | 458 | FN_STRING_TO_CODEPOINTS_1, |
1536 | 459 | FN_COMPARE_2, | 459 | FN_COMPARE_2, |
1537 | 460 | 460 | ||
1538 | === modified file 'src/runtime/indexing/index_func_impl.cpp' | |||
1539 | --- src/runtime/indexing/index_func_impl.cpp 2012-08-03 10:25:31 +0000 | |||
1540 | +++ src/runtime/indexing/index_func_impl.cpp 2013-09-02 20:59:05 +0000 | |||
1541 | @@ -48,7 +48,7 @@ | |||
1542 | 48 | 48 | ||
1543 | 49 | store::Item_t lKeyNodeName; | 49 | store::Item_t lKeyNodeName; |
1544 | 50 | GENV_ITEMFACTORY->createQName(lKeyNodeName, | 50 | GENV_ITEMFACTORY->createQName(lKeyNodeName, |
1546 | 51 | static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS, | 51 | static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS, |
1547 | 52 | "", "key"); | 52 | "", "key"); |
1548 | 53 | 53 | ||
1549 | 54 | IndexKeysIteratorState* state; | 54 | IndexKeysIteratorState* state; |
1550 | 55 | 55 | ||
1551 | === modified file 'src/runtime/pregenerated/iterator_enum.h' | |||
1552 | --- src/runtime/pregenerated/iterator_enum.h 2013-08-16 13:00:06 +0000 | |||
1553 | +++ src/runtime/pregenerated/iterator_enum.h 2013-09-02 20:59:05 +0000 | |||
1554 | @@ -328,15 +328,14 @@ | |||
1555 | 328 | TYPE_AvailableDocumentsIterator, | 328 | TYPE_AvailableDocumentsIterator, |
1556 | 329 | TYPE_IsAvailableDocumentIterator, | 329 | TYPE_IsAvailableDocumentIterator, |
1557 | 330 | TYPE_MapCreateIterator, | 330 | TYPE_MapCreateIterator, |
1560 | 331 | TYPE_MapCreateTransientIterator, | 331 | TYPE_MapDropIterator, |
1559 | 332 | TYPE_MapDestroyIterator, | ||
1561 | 333 | TYPE_MapGetIterator, | 332 | TYPE_MapGetIterator, |
1562 | 334 | TYPE_MapInsertIterator, | 333 | TYPE_MapInsertIterator, |
1564 | 335 | TYPE_MapRemoveIterator, | 334 | TYPE_MapDeleteIterator, |
1565 | 336 | TYPE_MapKeysIterator, | 335 | TYPE_MapKeysIterator, |
1566 | 337 | TYPE_MapSizeIterator, | 336 | TYPE_MapSizeIterator, |
1567 | 338 | TYPE_AvailableMapsIterator, | 337 | TYPE_AvailableMapsIterator, |
1569 | 339 | TYPE_MapIsTransientIterator, | 338 | TYPE_MapOptionsIterator, |
1570 | 340 | TYPE_CodepointsToStringIterator, | 339 | TYPE_CodepointsToStringIterator, |
1571 | 341 | TYPE_StringToCodepointsIterator, | 340 | TYPE_StringToCodepointsIterator, |
1572 | 342 | TYPE_CompareStrIterator, | 341 | TYPE_CompareStrIterator, |
1573 | 343 | 342 | ||
1574 | === modified file 'src/runtime/spec/mappings.xml' | |||
1575 | --- src/runtime/spec/mappings.xml 2013-08-30 17:45:50 +0000 | |||
1576 | +++ src/runtime/spec/mappings.xml 2013-09-02 20:59:05 +0000 | |||
1577 | @@ -73,8 +73,8 @@ | |||
1578 | 73 | prefix="zorba-store-documents"/> | 73 | prefix="zorba-store-documents"/> |
1579 | 74 | 74 | ||
1580 | 75 | <zorba:namespace | 75 | <zorba:namespace |
1583 | 76 | uri="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map" | 76 | uri="http://zorba.io/modules/unordered-maps" |
1584 | 77 | prefix="zorba-store-data-structure-unordered-map"/> | 77 | prefix="zorba-store-unordered-maps"/> |
1585 | 78 | 78 | ||
1586 | 79 | <zorba:namespace | 79 | <zorba:namespace |
1587 | 80 | uri="http://zorba.io/modules/full-text" | 80 | uri="http://zorba.io/modules/full-text" |
1588 | 81 | 81 | ||
1589 | === modified file 'src/runtime/spec/store/maps.xml' | |||
1590 | --- src/runtime/spec/store/maps.xml 2013-02-07 17:24:36 +0000 | |||
1591 | +++ src/runtime/spec/store/maps.xml 2013-09-02 20:59:05 +0000 | |||
1592 | @@ -33,66 +33,41 @@ | |||
1593 | 33 | 33 | ||
1594 | 34 | <zorba:function> | 34 | <zorba:function> |
1595 | 35 | 35 | ||
1656 | 36 | <zorba:signature | 36 | <zorba:signature localname="create" prefix="zorba-store-unordered-maps"> |
1657 | 37 | variadic="true" | 37 | <zorba:param>xs:string</zorba:param> <!-- name of the hashmap --> |
1658 | 38 | localname="create" | 38 | <zorba:param>item()</zorba:param> <!-- list of key types --> |
1659 | 39 | prefix="zorba-store-data-structure-unordered-map"> | 39 | <zorba:output>empty-sequence()</zorba:output> |
1660 | 40 | <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap --> | 40 | </zorba:signature> |
1661 | 41 | <zorba:param>xs:QName</zorba:param> <!-- list of key types --> | 41 | |
1662 | 42 | <zorba:output>empty-sequence()</zorba:output> | 42 | <zorba:signature localname="create" prefix="zorba-store-unordered-maps"> |
1663 | 43 | </zorba:signature> | 43 | <zorba:param>xs:string</zorba:param> <!-- name of the hashmap --> |
1664 | 44 | 44 | <zorba:param>item()</zorba:param> <!-- list of key types --> | |
1665 | 45 | <zorba:methods> | 45 | <zorba:param>object()</zorba:param> <!-- options object --> |
1666 | 46 | <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/> | 46 | <zorba:output>empty-sequence()</zorba:output> |
1667 | 47 | <zorba:accessesDynCtx returnValue="true"/> | 47 | </zorba:signature> |
1668 | 48 | </zorba:methods> | 48 | |
1669 | 49 | 49 | <zorba:methods> | |
1670 | 50 | </zorba:function> | 50 | <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/> |
1671 | 51 | 51 | <zorba:accessesDynCtx returnValue="true"/> | |
1672 | 52 | </zorba:iterator> | 52 | </zorba:methods> |
1673 | 53 | 53 | ||
1674 | 54 | <!-- | 54 | </zorba:function> |
1675 | 55 | /******************************************************************************* | 55 | |
1676 | 56 | ********************************************************************************/ | 56 | </zorba:iterator> |
1677 | 57 | --> | 57 | |
1678 | 58 | <zorba:iterator name="MapCreateTransientIterator" > | 58 | <!-- |
1679 | 59 | 59 | /******************************************************************************* | |
1680 | 60 | <zorba:description author="Matthias Brantner"> | 60 | ********************************************************************************/ |
1681 | 61 | </zorba:description> | 61 | --> |
1682 | 62 | 62 | <zorba:iterator name="MapDropIterator" > | |
1683 | 63 | <zorba:function> | 63 | |
1684 | 64 | 64 | <zorba:description author="Matthias Brantner"> | |
1685 | 65 | <zorba:signature | 65 | </zorba:description> |
1686 | 66 | variadic="true" | 66 | |
1687 | 67 | localname="create-transient" | 67 | <zorba:function> |
1688 | 68 | prefix="zorba-store-data-structure-unordered-map"> | 68 | |
1689 | 69 | <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap --> | 69 | <zorba:signature localname="drop" prefix="zorba-store-unordered-maps"> |
1690 | 70 | <zorba:param>xs:QName</zorba:param> <!-- list of key types --> | 70 | <zorba:param>xs:string</zorba:param> |
1631 | 71 | <zorba:output>empty-sequence()</zorba:output> | ||
1632 | 72 | </zorba:signature> | ||
1633 | 73 | |||
1634 | 74 | <zorba:methods> | ||
1635 | 75 | <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/> | ||
1636 | 76 | <zorba:accessesDynCtx returnValue="true"/> | ||
1637 | 77 | </zorba:methods> | ||
1638 | 78 | |||
1639 | 79 | </zorba:function> | ||
1640 | 80 | |||
1641 | 81 | </zorba:iterator> | ||
1642 | 82 | |||
1643 | 83 | <!-- | ||
1644 | 84 | /******************************************************************************* | ||
1645 | 85 | ********************************************************************************/ | ||
1646 | 86 | --> | ||
1647 | 87 | <zorba:iterator name="MapDestroyIterator" > | ||
1648 | 88 | |||
1649 | 89 | <zorba:description author="Matthias Brantner"> | ||
1650 | 90 | </zorba:description> | ||
1651 | 91 | |||
1652 | 92 | <zorba:function> | ||
1653 | 93 | |||
1654 | 94 | <zorba:signature localname="delete" prefix="zorba-store-data-structure-unordered-map"> | ||
1655 | 95 | <zorba:param>xs:QName</zorba:param> | ||
1691 | 96 | <zorba:output>empty-sequence()</zorba:output> | 71 | <zorba:output>empty-sequence()</zorba:output> |
1692 | 97 | </zorba:signature> | 72 | </zorba:signature> |
1693 | 98 | 73 | ||
1694 | @@ -116,9 +91,9 @@ | |||
1695 | 116 | 91 | ||
1696 | 117 | <zorba:function> | 92 | <zorba:function> |
1697 | 118 | 93 | ||
1701 | 119 | <zorba:signature variadic="true" localname="get" prefix="zorba-store-data-structure-unordered-map"> | 94 | <zorba:signature localname="get" prefix="zorba-store-unordered-maps"> |
1702 | 120 | <zorba:param>xs:QName</zorba:param> | 95 | <zorba:param>xs:string</zorba:param> |
1703 | 121 | <zorba:param>xs:anyAtomicType?</zorba:param> | 96 | <zorba:param>item()</zorba:param> |
1704 | 122 | <zorba:output>item()*</zorba:output> | 97 | <zorba:output>item()*</zorba:output> |
1705 | 123 | </zorba:signature> | 98 | </zorba:signature> |
1706 | 124 | 99 | ||
1707 | @@ -146,10 +121,10 @@ | |||
1708 | 146 | 121 | ||
1709 | 147 | <zorba:function> | 122 | <zorba:function> |
1710 | 148 | 123 | ||
1715 | 149 | <zorba:signature variadic="true" localname="insert" prefix="zorba-store-data-structure-unordered-map"> | 124 | <zorba:signature localname="insert" prefix="zorba-store-unordered-maps"> |
1716 | 150 | <zorba:param>xs:QName</zorba:param> | 125 | <zorba:param>xs:string</zorba:param> |
1717 | 151 | <zorba:param>item()*</zorba:param> <!-- value --> | 126 | <zorba:param>item()</zorba:param> |
1718 | 152 | <zorba:param>xs:anyAtomicType?</zorba:param> <!-- list of keys --> | 127 | <zorba:param>item()*</zorba:param> |
1719 | 153 | <zorba:output>empty-sequence()</zorba:output> | 128 | <zorba:output>empty-sequence()</zorba:output> |
1720 | 154 | </zorba:signature> | 129 | </zorba:signature> |
1721 | 155 | 130 | ||
1722 | @@ -167,7 +142,7 @@ | |||
1723 | 167 | /******************************************************************************* | 142 | /******************************************************************************* |
1724 | 168 | ********************************************************************************/ | 143 | ********************************************************************************/ |
1725 | 169 | --> | 144 | --> |
1727 | 170 | <zorba:iterator name="MapRemoveIterator" > | 145 | <zorba:iterator name="MapDeleteIterator" > |
1728 | 171 | 146 | ||
1729 | 172 | <zorba:description author="Matthias Brantner"> | 147 | <zorba:description author="Matthias Brantner"> |
1730 | 173 | </zorba:description> | 148 | </zorba:description> |
1731 | @@ -175,12 +150,11 @@ | |||
1732 | 175 | <zorba:function> | 150 | <zorba:function> |
1733 | 176 | 151 | ||
1734 | 177 | <zorba:signature | 152 | <zorba:signature |
1738 | 178 | variadic="true" | 153 | localname="delete" |
1739 | 179 | localname="remove" | 154 | prefix="zorba-store-unordered-maps"> |
1737 | 180 | prefix="zorba-store-data-structure-unordered-map"> | ||
1740 | 181 | 155 | ||
1743 | 182 | <zorba:param>xs:QName</zorba:param> | 156 | <zorba:param>xs:string</zorba:param> |
1744 | 183 | <zorba:param>xs:anyAtomicType?</zorba:param> | 157 | <zorba:param>item()</zorba:param> |
1745 | 184 | <zorba:output>empty-sequence()</zorba:output> | 158 | <zorba:output>empty-sequence()</zorba:output> |
1746 | 185 | </zorba:signature> | 159 | </zorba:signature> |
1747 | 186 | 160 | ||
1748 | @@ -204,9 +178,9 @@ | |||
1749 | 204 | 178 | ||
1750 | 205 | <zorba:function> | 179 | <zorba:function> |
1751 | 206 | 180 | ||
1755 | 207 | <zorba:signature localname="keys" prefix="zorba-store-data-structure-unordered-map"> | 181 | <zorba:signature localname="keys" prefix="zorba-store-unordered-maps"> |
1756 | 208 | <zorba:param>xs:QName</zorba:param> | 182 | <zorba:param>xs:string</zorba:param> |
1757 | 209 | <zorba:output>node()*</zorba:output> | 183 | <zorba:output>array()*</zorba:output> |
1758 | 210 | </zorba:signature> | 184 | </zorba:signature> |
1759 | 211 | 185 | ||
1760 | 212 | <zorba:methods> | 186 | <zorba:methods> |
1761 | @@ -219,8 +193,6 @@ | |||
1762 | 219 | <zorba:member type="store::Index::KeyIterator_t" name="theIter"/> | 193 | <zorba:member type="store::Index::KeyIterator_t" name="theIter"/> |
1763 | 220 | </zorba:state> | 194 | </zorba:state> |
1764 | 221 | 195 | ||
1765 | 222 | <zorba:member type="store::NsBindings" name="theNSBindings" brief=""/> | ||
1766 | 223 | |||
1767 | 224 | </zorba:iterator> | 196 | </zorba:iterator> |
1768 | 225 | 197 | ||
1769 | 226 | <!-- | 198 | <!-- |
1770 | @@ -234,8 +206,8 @@ | |||
1771 | 234 | 206 | ||
1772 | 235 | <zorba:function> | 207 | <zorba:function> |
1773 | 236 | 208 | ||
1776 | 237 | <zorba:signature localname="size" prefix="zorba-store-data-structure-unordered-map"> | 209 | <zorba:signature localname="size" prefix="zorba-store-unordered-maps"> |
1777 | 238 | <zorba:param>xs:QName</zorba:param> | 210 | <zorba:param>xs:string</zorba:param> |
1778 | 239 | <zorba:output>xs:integer</zorba:output> | 211 | <zorba:output>xs:integer</zorba:output> |
1779 | 240 | </zorba:signature> | 212 | </zorba:signature> |
1780 | 241 | 213 | ||
1781 | @@ -258,8 +230,8 @@ | |||
1782 | 258 | 230 | ||
1783 | 259 | <zorba:function> | 231 | <zorba:function> |
1784 | 260 | 232 | ||
1787 | 261 | <zorba:signature localname="available-maps" prefix="zorba-store-data-structure-unordered-map"> | 233 | <zorba:signature localname="available-maps" prefix="zorba-store-unordered-maps"> |
1788 | 262 | <zorba:output>xs:QName*</zorba:output> | 234 | <zorba:output>xs:string*</zorba:output> |
1789 | 263 | </zorba:signature> | 235 | </zorba:signature> |
1790 | 264 | 236 | ||
1791 | 265 | <zorba:methods> | 237 | <zorba:methods> |
1792 | @@ -285,16 +257,16 @@ | |||
1793 | 285 | /******************************************************************************* | 257 | /******************************************************************************* |
1794 | 286 | ********************************************************************************/ | 258 | ********************************************************************************/ |
1795 | 287 | --> | 259 | --> |
1797 | 288 | <zorba:iterator name="MapIsTransientIterator" > | 260 | <zorba:iterator name="MapOptionsIterator" > |
1798 | 289 | 261 | ||
1799 | 290 | <zorba:description author="Matthias Brantner"> | 262 | <zorba:description author="Matthias Brantner"> |
1800 | 291 | </zorba:description> | 263 | </zorba:description> |
1801 | 292 | 264 | ||
1802 | 293 | <zorba:function> | 265 | <zorba:function> |
1803 | 294 | 266 | ||
1807 | 295 | <zorba:signature localname="is-transient" prefix="zorba-store-data-structure-unordered-map"> | 267 | <zorba:signature localname="options" prefix="zorba-store-unordered-maps"> |
1808 | 296 | <zorba:param>xs:QName</zorba:param> | 268 | <zorba:param>xs:string</zorba:param> |
1809 | 297 | <zorba:output>xs:boolean</zorba:output> | 269 | <zorba:output>object()</zorba:output> |
1810 | 298 | </zorba:signature> | 270 | </zorba:signature> |
1811 | 299 | 271 | ||
1812 | 300 | <zorba:methods> | 272 | <zorba:methods> |
1813 | 301 | 273 | ||
1814 | === modified file 'src/runtime/store/maps_impl.cpp' | |||
1815 | --- src/runtime/store/maps_impl.cpp 2013-06-11 05:40:04 +0000 | |||
1816 | +++ src/runtime/store/maps_impl.cpp 2013-09-02 20:59:05 +0000 | |||
1817 | @@ -49,6 +49,29 @@ | |||
1818 | 49 | 49 | ||
1819 | 50 | /******************************************************************************* | 50 | /******************************************************************************* |
1820 | 51 | ********************************************************************************/ | 51 | ********************************************************************************/ |
1821 | 52 | zstring | ||
1822 | 53 | getMapURI( | ||
1823 | 54 | const static_context* sctx, | ||
1824 | 55 | const QueryLoc& aLoc) | ||
1825 | 56 | { | ||
1826 | 57 | return "http://zorba.io/maps"; | ||
1827 | 58 | } | ||
1828 | 59 | |||
1829 | 60 | /******************************************************************************* | ||
1830 | 61 | ********************************************************************************/ | ||
1831 | 62 | void | ||
1832 | 63 | createMapQName( | ||
1833 | 64 | store::Item_t& name, | ||
1834 | 65 | const static_context* sctx, | ||
1835 | 66 | const QueryLoc& loc) | ||
1836 | 67 | { | ||
1837 | 68 | GENV_ITEMFACTORY->createQName(name, getMapURI(sctx, loc), | ||
1838 | 69 | "", name->getStringValue()); | ||
1839 | 70 | } | ||
1840 | 71 | |||
1841 | 72 | |||
1842 | 73 | /******************************************************************************* | ||
1843 | 74 | ********************************************************************************/ | ||
1844 | 52 | void | 75 | void |
1845 | 53 | castOrCheckIndexType( | 76 | castOrCheckIndexType( |
1846 | 54 | store::Item_t& aKeyItem, | 77 | store::Item_t& aKeyItem, |
1847 | @@ -100,6 +123,214 @@ | |||
1848 | 100 | /******************************************************************************* | 123 | /******************************************************************************* |
1849 | 101 | ********************************************************************************/ | 124 | ********************************************************************************/ |
1850 | 102 | void | 125 | void |
1851 | 126 | createKeysArray( | ||
1852 | 127 | store::IndexKey& aKey, | ||
1853 | 128 | store::Item_t& aArray) | ||
1854 | 129 | { | ||
1855 | 130 | std::vector<store::Item_t> lValues; | ||
1856 | 131 | lValues.reserve(aKey.size()); | ||
1857 | 132 | |||
1858 | 133 | size_t i = 1; | ||
1859 | 134 | |||
1860 | 135 | // build [ key1, null, key3 ] | ||
1861 | 136 | for (store::ItemVector::iterator lIter = aKey.begin(); | ||
1862 | 137 | lIter != aKey.end(); | ||
1863 | 138 | ++lIter, ++i) | ||
1864 | 139 | { | ||
1865 | 140 | lValues.resize(i); | ||
1866 | 141 | |||
1867 | 142 | store::Item_t lValue = *lIter; | ||
1868 | 143 | if (lValue) | ||
1869 | 144 | { | ||
1870 | 145 | lValues[i - 1] = (*lIter); | ||
1871 | 146 | } | ||
1872 | 147 | else | ||
1873 | 148 | { | ||
1874 | 149 | GENV_ITEMFACTORY->createJSONNull(lValues[i - 1]); | ||
1875 | 150 | } | ||
1876 | 151 | } | ||
1877 | 152 | |||
1878 | 153 | GENV_ITEMFACTORY->createJSONArray(aArray, lValues); | ||
1879 | 154 | } | ||
1880 | 155 | |||
1881 | 156 | |||
1882 | 157 | /******************************************************************************* | ||
1883 | 158 | ********************************************************************************/ | ||
1884 | 159 | void | ||
1885 | 160 | processTypes( | ||
1886 | 161 | const store::Item_t& aMapName, | ||
1887 | 162 | const QueryLoc& loc, | ||
1888 | 163 | std::vector<store::Item_t>& aTypes) | ||
1889 | 164 | { | ||
1890 | 165 | for (size_t i = 0; i < aTypes.size(); ++i) | ||
1891 | 166 | { | ||
1892 | 167 | store::Item_t& lType = aTypes[i]; | ||
1893 | 168 | |||
1894 | 169 | if (!lType->isAtomic()) | ||
1895 | 170 | { | ||
1896 | 171 | RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc, | ||
1897 | 172 | ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)), | ||
1898 | 173 | "anyAtomicType", | ||
1899 | 174 | aMapName->getStringValue())); | ||
1900 | 175 | } | ||
1901 | 176 | |||
1902 | 177 | if (TypeOps::is_subtype(lType->getTypeCode(), store::XS_STRING)) | ||
1903 | 178 | { | ||
1904 | 179 | zstring t = lType->getStringValue(); | ||
1905 | 180 | std::transform(t.begin(), t.end(), t.begin(), zorba::unicode::to_lower); | ||
1906 | 181 | if (t == "string") | ||
1907 | 182 | lType = GENV_TYPESYSTEM.XS_STRING_QNAME; | ||
1908 | 183 | else if (t == "integer") | ||
1909 | 184 | lType = GENV_TYPESYSTEM.XS_INTEGER_QNAME; | ||
1910 | 185 | else if (t == "boolean") | ||
1911 | 186 | lType = GENV_TYPESYSTEM.XS_BOOLEAN_QNAME; | ||
1912 | 187 | else if (t == "datetime") | ||
1913 | 188 | lType = GENV_TYPESYSTEM.XS_DATETIME_QNAME; | ||
1914 | 189 | else if (t == "date") | ||
1915 | 190 | lType = GENV_TYPESYSTEM.XS_DATE_QNAME; | ||
1916 | 191 | else if (t == "time") | ||
1917 | 192 | lType = GENV_TYPESYSTEM.XS_TIME_QNAME; | ||
1918 | 193 | else if (t == "duration") | ||
1919 | 194 | lType = GENV_TYPESYSTEM.XS_DURATION_QNAME; | ||
1920 | 195 | else if (t == "daytimeduration") | ||
1921 | 196 | lType = GENV_TYPESYSTEM.XS_DT_DURATION_QNAME; | ||
1922 | 197 | else if (t == "yearmonthduration") | ||
1923 | 198 | lType = GENV_TYPESYSTEM.XS_YM_DURATION_QNAME; | ||
1924 | 199 | else if (t == "float") | ||
1925 | 200 | lType = GENV_TYPESYSTEM.XS_FLOAT_QNAME; | ||
1926 | 201 | else if (t == "double") | ||
1927 | 202 | lType = GENV_TYPESYSTEM.XS_DOUBLE_QNAME; | ||
1928 | 203 | else if (t == "decimal") | ||
1929 | 204 | lType = GENV_TYPESYSTEM.XS_DECIMAL_QNAME; | ||
1930 | 205 | else if (t == "long") | ||
1931 | 206 | lType = GENV_TYPESYSTEM.XS_LONG_QNAME; | ||
1932 | 207 | else if (t == "int") | ||
1933 | 208 | lType = GENV_TYPESYSTEM.XS_INT_QNAME; | ||
1934 | 209 | else if (t == "short") | ||
1935 | 210 | lType = GENV_TYPESYSTEM.XS_SHORT_QNAME; | ||
1936 | 211 | else if (t == "byte") | ||
1937 | 212 | lType = GENV_TYPESYSTEM.XS_BYTE_QNAME; | ||
1938 | 213 | else if (t == "base64binary") | ||
1939 | 214 | lType = GENV_TYPESYSTEM.XS_BASE64BINARY_QNAME; | ||
1940 | 215 | else if (t == "hexbinary") | ||
1941 | 216 | lType = GENV_TYPESYSTEM.XS_HEXBINARY_QNAME; | ||
1942 | 217 | else if (t == "null") | ||
1943 | 218 | lType = GENV_TYPESYSTEM.JS_NULL_QNAME; | ||
1944 | 219 | else | ||
1945 | 220 | RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc, | ||
1946 | 221 | ERROR_PARAMS(t, | ||
1947 | 222 | "anyAtomicType", | ||
1948 | 223 | aMapName->getStringValue())); | ||
1949 | 224 | } | ||
1950 | 225 | else if (!TypeOps::is_subtype(lType->getTypeCode(), store::XS_QNAME)) | ||
1951 | 226 | { | ||
1952 | 227 | RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc, | ||
1953 | 228 | ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)), | ||
1954 | 229 | "QName", | ||
1955 | 230 | aMapName->getStringValue())); | ||
1956 | 231 | } | ||
1957 | 232 | } | ||
1958 | 233 | } | ||
1959 | 234 | |||
1960 | 235 | /******************************************************************************* | ||
1961 | 236 | ********************************************************************************/ | ||
1962 | 237 | bool | ||
1963 | 238 | prepareKeyAttributes( | ||
1964 | 239 | const QueryLoc& loc, | ||
1965 | 240 | const static_context* sctx, | ||
1966 | 241 | const store::Item_t& aKey, | ||
1967 | 242 | store::Index* aMap, | ||
1968 | 243 | std::vector<store::Item_t>& aKeyAttrs) | ||
1969 | 244 | { | ||
1970 | 245 | if (aKey->isArray()) | ||
1971 | 246 | { | ||
1972 | 247 | ulong lNumKeys = to_xs_long(aKey->getArraySize()); | ||
1973 | 248 | aKeyAttrs.resize(lNumKeys); | ||
1974 | 249 | for (size_t i = 0; i < lNumKeys; ++i) | ||
1975 | 250 | { | ||
1976 | 251 | aKeyAttrs[i] = aKey->getArrayValue(xs_integer(i+1)); | ||
1977 | 252 | } | ||
1978 | 253 | } | ||
1979 | 254 | else | ||
1980 | 255 | { | ||
1981 | 256 | aKeyAttrs.push_back(aKey); | ||
1982 | 257 | } | ||
1983 | 258 | |||
1984 | 259 | const store::IndexSpecification& lSpec = aMap->getSpecification(); | ||
1985 | 260 | |||
1986 | 261 | store::Item_t lName = aMap->getName(); | ||
1987 | 262 | |||
1988 | 263 | if (lSpec.getNumColumns() != aKeyAttrs.size()) | ||
1989 | 264 | { | ||
1990 | 265 | RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc, | ||
1991 | 266 | ERROR_PARAMS(lName->getLocalName(), | ||
1992 | 267 | "map", | ||
1993 | 268 | aKeyAttrs.size(), | ||
1994 | 269 | lSpec.getNumColumns())); | ||
1995 | 270 | } | ||
1996 | 271 | |||
1997 | 272 | bool lValidProbe = true; | ||
1998 | 273 | |||
1999 | 274 | for (size_t i = 0; i < aKeyAttrs.size(); ++i) | ||
2000 | 275 | { | ||
2001 | 276 | store::Item_t& lTmp = aKeyAttrs[i]; | ||
2002 | 277 | |||
2003 | 278 | if (! lTmp->isAtomic()) | ||
2004 | 279 | { | ||
2005 | 280 | store::Item_t lVal; | ||
2006 | 281 | store::Iterator_t lValIter; | ||
2007 | 282 | lTmp->getTypedValue(lVal, lValIter); | ||
2008 | 283 | if (! lValIter.isNull()) | ||
2009 | 284 | { | ||
2010 | 285 | RAISE_ERROR(err::XPTY0004, loc, | ||
2011 | 286 | ERROR_PARAMS(ZED(XPTY0004_NoMultiSeqTypePromotion_2), | ||
2012 | 287 | lSpec.theKeyTypes.at(i))); | ||
2013 | 288 | } | ||
2014 | 289 | lTmp = lVal; | ||
2015 | 290 | } | ||
2016 | 291 | |||
2017 | 292 | namespace_context tmp_ctx(sctx); | ||
2018 | 293 | castOrCheckIndexType(lTmp, lSpec.theKeyTypes[i], lName, &tmp_ctx, loc); | ||
2019 | 294 | |||
2020 | 295 | if (lTmp == NULL || | ||
2021 | 296 | (lTmp->isAtomic() && lTmp->getTypeCode() == store::JS_NULL)) | ||
2022 | 297 | { | ||
2023 | 298 | lValidProbe = false; | ||
2024 | 299 | } | ||
2025 | 300 | } | ||
2026 | 301 | return lValidProbe; | ||
2027 | 302 | } | ||
2028 | 303 | |||
2029 | 304 | |||
2030 | 305 | /******************************************************************************* | ||
2031 | 306 | ********************************************************************************/ | ||
2032 | 307 | void | ||
2033 | 308 | processOption( | ||
2034 | 309 | const QueryLoc& loc, | ||
2035 | 310 | const store::Item_t& aOption, | ||
2036 | 311 | bool& aIsPersistent) | ||
2037 | 312 | { | ||
2038 | 313 | assert(aOption->isObject()); | ||
2039 | 314 | zstring lTmp("persistent"); | ||
2040 | 315 | |||
2041 | 316 | store::Item_t lPersistentItem; | ||
2042 | 317 | GENV_ITEMFACTORY->createString(lPersistentItem, lTmp); | ||
2043 | 318 | |||
2044 | 319 | lPersistentItem = aOption->getObjectValue(lPersistentItem); | ||
2045 | 320 | if (!lPersistentItem->isAtomic() | ||
2046 | 321 | || lPersistentItem->getTypeCode() != store::XS_BOOLEAN) | ||
2047 | 322 | { | ||
2048 | 323 | RAISE_ERROR(zerr::ZDDY0043_INVALID_OPTION_TYPE, | ||
2049 | 324 | loc, ERROR_PARAMS( | ||
2050 | 325 | lPersistentItem->getType()->getLocalName(), "persistent", "boolean")); | ||
2051 | 326 | } | ||
2052 | 327 | aIsPersistent = lPersistentItem->getBooleanValue(); | ||
2053 | 328 | } | ||
2054 | 329 | |||
2055 | 330 | |||
2056 | 331 | /******************************************************************************* | ||
2057 | 332 | ********************************************************************************/ | ||
2058 | 333 | void | ||
2059 | 103 | checkMapTypes( | 334 | checkMapTypes( |
2060 | 104 | std::vector<store::Item_t>& aTypes, | 335 | std::vector<store::Item_t>& aTypes, |
2061 | 105 | const store::Item_t& aMapName, | 336 | const store::Item_t& aMapName, |
2062 | @@ -135,13 +366,14 @@ | |||
2063 | 135 | const store::Item_t& aName, | 366 | const store::Item_t& aName, |
2064 | 136 | const QueryLoc& aLoc, | 367 | const QueryLoc& aLoc, |
2065 | 137 | dynamic_context* aContext, | 368 | dynamic_context* aContext, |
2067 | 138 | store::Index*& aIndex) | 369 | store::Index*& aIndex, |
2068 | 370 | bool aLookupParent = true) | ||
2069 | 139 | { | 371 | { |
2070 | 140 | aIndex = GENV_STORE.getMap(aName); | 372 | aIndex = GENV_STORE.getMap(aName); |
2071 | 141 | 373 | ||
2072 | 142 | if (aIndex) return true; | 374 | if (aIndex) return true; |
2073 | 143 | 375 | ||
2075 | 144 | aIndex = aContext->getMap(aName.getp()); | 376 | aIndex = aContext->getMap(aName.getp(), aLookupParent); |
2076 | 145 | 377 | ||
2077 | 146 | if (!aIndex) | 378 | if (!aIndex) |
2078 | 147 | { | 379 | { |
2079 | @@ -164,124 +396,105 @@ | |||
2080 | 164 | store::Item_t& result, | 396 | store::Item_t& result, |
2081 | 165 | PlanState& aPlanState) const | 397 | PlanState& aPlanState) const |
2082 | 166 | { | 398 | { |
2084 | 167 | store::Item_t lQName; | 399 | store::Item_t lName; |
2085 | 400 | store::Item_t lTypeParam; | ||
2086 | 168 | std::vector<store::Item_t> lTypes; | 401 | std::vector<store::Item_t> lTypes; |
2192 | 169 | std::vector<zstring> lCollations; | 402 | bool lPersistent = true; |
2193 | 170 | std::auto_ptr<store::PUL> lPul; | 403 | |
2194 | 171 | long lTimezone = 0; | 404 | PlanIteratorState* state; |
2195 | 172 | 405 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | |
2196 | 173 | PlanIteratorState* state; | 406 | |
2197 | 174 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 407 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2198 | 175 | 408 | createMapQName(lName, theSctx, loc); | |
2199 | 176 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 409 | |
2200 | 177 | 410 | if (GENV_STORE.getMap(lName) | |
2201 | 178 | if (GENV_STORE.getMap(lQName) | 411 | || aPlanState.theLocalDynCtx->getMap(lName.getp())) |
2202 | 179 | || aPlanState.theLocalDynCtx->getMap(lQName.getp())) | 412 | { |
2203 | 180 | { | 413 | RAISE_ERROR( |
2204 | 181 | RAISE_ERROR( | 414 | zerr::ZSTR0001_INDEX_ALREADY_EXISTS, |
2205 | 182 | zerr::ZSTR0001_INDEX_ALREADY_EXISTS, | 415 | loc, |
2206 | 183 | loc, | 416 | ERROR_PARAMS( lName->getStringValue() ) |
2207 | 184 | ERROR_PARAMS( lQName->getStringValue() ) | 417 | ); |
2208 | 185 | ); | 418 | } |
2209 | 186 | } | 419 | |
2210 | 187 | 420 | consumeNext(lTypeParam, theChildren[1].getp(), aPlanState); | |
2211 | 188 | lCollations.resize(theChildren.size() - 1); | 421 | |
2212 | 189 | lTypes.resize(theChildren.size() - 1); | 422 | if (lTypeParam->isArray()) |
2213 | 190 | 423 | { | |
2214 | 191 | for (size_t i = 1; i < theChildren.size(); ++i) | 424 | long lSize = to_xs_long(lTypeParam->getArraySize()); |
2215 | 192 | { | 425 | lTypes.resize(lSize); |
2216 | 193 | consumeNext(lTypes[i-1], theChildren[i].getp(), aPlanState); | 426 | for (long i = 1; i <= lSize; ++i) |
2217 | 194 | } | 427 | { |
2218 | 195 | 428 | lTypes[i-1] = lTypeParam->getArrayValue(xs_integer(i)); | |
2219 | 196 | checkMapTypes(lTypes, lQName, loc); | 429 | } |
2220 | 197 | 430 | } | |
2221 | 198 | lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); | 431 | else |
2222 | 199 | lPul->addCreateHashMap(&loc, lQName, lTypes, lCollations, lTimezone); | 432 | { |
2223 | 200 | 433 | lTypes.push_back(lTypeParam); | |
2224 | 201 | apply_updates( | 434 | } |
2225 | 202 | aPlanState.theCompilerCB, | 435 | |
2226 | 203 | aPlanState.theGlobalDynCtx, | 436 | if (theChildren.size() == 3) |
2227 | 204 | theSctx, | 437 | { |
2228 | 205 | lPul.get(), | 438 | store::Item_t lOptions; |
2229 | 206 | loc); | 439 | consumeNext(lOptions, theChildren[2].getp(), aPlanState); |
2230 | 207 | 440 | processOption(loc, lOptions, lPersistent); | |
2231 | 208 | result = NULL; | 441 | } |
2232 | 209 | 442 | ||
2233 | 210 | STACK_END(state); | 443 | processTypes(lName, loc, lTypes); |
2234 | 211 | } | 444 | checkMapTypes(lTypes, lName, loc); |
2235 | 212 | 445 | ||
2236 | 213 | 446 | if (lPersistent) | |
2237 | 214 | /******************************************************************************* | 447 | { |
2238 | 215 | ********************************************************************************/ | 448 | std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2239 | 216 | bool | 449 | std::vector<zstring> lCollations(lTypes.size()); |
2240 | 217 | MapCreateTransientIterator::nextImpl( | 450 | lPul->addCreateHashMap(&loc, lName, lTypes, lCollations, 0); |
2241 | 218 | store::Item_t& result, | 451 | |
2242 | 219 | PlanState& aPlanState) const | 452 | apply_updates( |
2243 | 220 | { | 453 | aPlanState.theCompilerCB, |
2244 | 221 | store::Item_t lQName; | 454 | aPlanState.theGlobalDynCtx, |
2245 | 222 | store::IndexSpecification lSpec; | 455 | theSctx, |
2246 | 223 | store::Index_t lIndex; | 456 | lPul.get(), |
2247 | 224 | std::vector<std::string> lCollations; | 457 | loc); |
2248 | 225 | 458 | } | |
2249 | 226 | PlanIteratorState* state; | 459 | else |
2250 | 227 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 460 | { |
2251 | 228 | 461 | store::IndexSpecification lSpec; | |
2252 | 229 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 462 | lSpec.theKeyTypes.swap(lTypes); |
2253 | 230 | 463 | lSpec.theNumKeyColumns = lSpec.theKeyTypes.size(); | |
2254 | 231 | if (GENV_STORE.getMap(lQName) | 464 | lSpec.theIsTemp = true; |
2255 | 232 | || aPlanState.theLocalDynCtx->getMap(lQName.getp())) | 465 | lSpec.theCollations.resize(lSpec.theKeyTypes.size()); |
2256 | 233 | { | 466 | lSpec.theTimezone = 0; |
2257 | 234 | RAISE_ERROR( | 467 | store::Index_t lMap = GENV_STORE.createMap(lName, lSpec); |
2258 | 235 | zerr::ZSTR0001_INDEX_ALREADY_EXISTS, | 468 | |
2259 | 236 | loc, | 469 | aPlanState.theLocalDynCtx->bindMap(lMap->getName(), lMap); |
2260 | 237 | ERROR_PARAMS( lQName->getStringValue() ) | 470 | } |
2261 | 238 | ); | 471 | |
2262 | 239 | } | 472 | result = NULL; |
2263 | 240 | 473 | ||
2264 | 241 | lCollations.resize(theChildren.size() - 1); | 474 | STACK_END(state); |
2265 | 242 | lSpec.theKeyTypes.resize(theChildren.size() - 1); | 475 | } |
2266 | 243 | 476 | ||
2267 | 244 | for (size_t i = 1; i < theChildren.size(); ++i) | 477 | |
2268 | 245 | { | 478 | /******************************************************************************* |
2269 | 246 | consumeNext(lSpec.theKeyTypes[i-1], theChildren[i].getp(), aPlanState); | 479 | ********************************************************************************/ |
2270 | 247 | } | 480 | bool |
2271 | 248 | 481 | MapDropIterator::nextImpl( | |
2272 | 249 | checkMapTypes(lSpec.theKeyTypes, lQName, loc); | 482 | store::Item_t& result, |
2273 | 250 | 483 | PlanState& aPlanState) const | |
2274 | 251 | lSpec.theNumKeyColumns = lSpec.theKeyTypes.size(); | 484 | { |
2275 | 252 | lSpec.theIsTemp = true; | 485 | store::Item_t lName; |
2171 | 253 | lSpec.theCollations = lCollations; | ||
2172 | 254 | lSpec.theTimezone = 0; | ||
2173 | 255 | |||
2174 | 256 | lIndex = GENV_STORE.createMap(lQName, lSpec); | ||
2175 | 257 | |||
2176 | 258 | aPlanState.theLocalDynCtx->bindMap(lIndex->getName(), lIndex); | ||
2177 | 259 | |||
2178 | 260 | result = NULL; | ||
2179 | 261 | |||
2180 | 262 | STACK_END(state); | ||
2181 | 263 | } | ||
2182 | 264 | |||
2183 | 265 | |||
2184 | 266 | /******************************************************************************* | ||
2185 | 267 | ********************************************************************************/ | ||
2186 | 268 | bool | ||
2187 | 269 | MapDestroyIterator::nextImpl( | ||
2188 | 270 | store::Item_t& result, | ||
2189 | 271 | PlanState& aPlanState) const | ||
2190 | 272 | { | ||
2191 | 273 | store::Item_t lQName; | ||
2276 | 274 | store::Index* lIndex; | 486 | store::Index* lIndex; |
2277 | 275 | 487 | ||
2278 | 276 | PlanIteratorState* state; | 488 | PlanIteratorState* state; |
2279 | 277 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 489 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2280 | 278 | 490 | ||
2282 | 279 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 491 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2283 | 492 | createMapQName(lName, theSctx, loc); | ||
2284 | 280 | 493 | ||
2286 | 281 | if (getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex)) | 494 | if (getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex, false)) |
2287 | 282 | { | 495 | { |
2288 | 283 | std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); | 496 | std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2290 | 284 | lPul->addDestroyHashMap(&loc, lQName); | 497 | lPul->addDestroyHashMap(&loc, lName); |
2291 | 285 | 498 | ||
2292 | 286 | apply_updates( | 499 | apply_updates( |
2293 | 287 | aPlanState.theCompilerCB, | 500 | aPlanState.theCompilerCB, |
2294 | @@ -292,7 +505,7 @@ | |||
2295 | 292 | } | 505 | } |
2296 | 293 | else | 506 | else |
2297 | 294 | { | 507 | { |
2299 | 295 | aPlanState.theLocalDynCtx->unbindMap(lQName.getp()); | 508 | aPlanState.theLocalDynCtx->unbindMap(lName.getp()); |
2300 | 296 | } | 509 | } |
2301 | 297 | 510 | ||
2302 | 298 | result = NULL; | 511 | result = NULL; |
2303 | @@ -300,6 +513,7 @@ | |||
2304 | 300 | STACK_END(state); | 513 | STACK_END(state); |
2305 | 301 | } | 514 | } |
2306 | 302 | 515 | ||
2307 | 516 | |||
2308 | 303 | /******************************************************************************* | 517 | /******************************************************************************* |
2309 | 304 | ********************************************************************************/ | 518 | ********************************************************************************/ |
2310 | 305 | bool | 519 | bool |
2311 | @@ -307,55 +521,35 @@ | |||
2312 | 307 | store::Item_t& result, | 521 | store::Item_t& result, |
2313 | 308 | PlanState& aPlanState) const | 522 | PlanState& aPlanState) const |
2314 | 309 | { | 523 | { |
2320 | 310 | store::Item_t lQName; | 524 | store::Item_t lName; |
2321 | 311 | std::vector<store::Item_t> lKey; | 525 | store::Item_t lKey; |
2322 | 312 | store::Index* lIndex; | 526 | std::vector<store::Item_t> lKeyAttrs; |
2323 | 313 | ulong i; | 527 | store::Index* lMap; |
2319 | 314 | store::Item_t lKeyItem; | ||
2324 | 315 | store::IndexSpecification lSpec; | 528 | store::IndexSpecification lSpec; |
2325 | 529 | bool lValidProbe; | ||
2326 | 316 | 530 | ||
2327 | 317 | MapGetIteratorState* state; | 531 | MapGetIteratorState* state; |
2328 | 318 | DEFAULT_STACK_INIT(MapGetIteratorState, state, aPlanState); | 532 | DEFAULT_STACK_INIT(MapGetIteratorState, state, aPlanState); |
2329 | 319 | 533 | ||
2354 | 320 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 534 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2355 | 321 | 535 | createMapQName(lName, theSctx, loc); | |
2356 | 322 | getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); | 536 | |
2357 | 323 | 537 | getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); | |
2358 | 324 | lSpec = lIndex->getSpecification(); | 538 | |
2359 | 325 | 539 | consumeNext(lKey, theChildren[1].getp(), aPlanState); | |
2360 | 326 | if (lSpec.getNumColumns() != theChildren.size() - 1) | 540 | |
2361 | 327 | { | 541 | state->theCond = lMap->createCondition(store::IndexCondition::POINT_VALUE); |
2362 | 328 | RAISE_ERROR( | 542 | lValidProbe = prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs); |
2363 | 329 | zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, | 543 | |
2364 | 330 | loc, | 544 | if (lValidProbe) |
2365 | 331 | ERROR_PARAMS( | 545 | { |
2366 | 332 | lQName->getStringValue(), | 546 | for (size_t i = 0; i < lKeyAttrs.size(); ++i) |
2343 | 333 | "map", | ||
2344 | 334 | theChildren.size() - 1, | ||
2345 | 335 | lSpec.getNumColumns() ) | ||
2346 | 336 | ); | ||
2347 | 337 | } | ||
2348 | 338 | |||
2349 | 339 | state->theCond = lIndex->createCondition(store::IndexCondition::POINT_VALUE); | ||
2350 | 340 | |||
2351 | 341 | for (i = 1; i < theChildren.size(); ++i) | ||
2352 | 342 | { | ||
2353 | 343 | if (!consumeNext(lKeyItem, theChildren[i], aPlanState)) | ||
2367 | 344 | { | 547 | { |
2370 | 345 | // Return the empty seq if any of the search key items is the empty seq. | 548 | state->theCond->pushItem(lKeyAttrs[i]); |
2369 | 346 | break; | ||
2371 | 347 | } | 549 | } |
2372 | 348 | 550 | ||
2373 | 349 | namespace_context tmp_ctx(theSctx); | ||
2374 | 350 | castOrCheckIndexType(lKeyItem, lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc); | ||
2375 | 351 | |||
2376 | 352 | state->theCond->pushItem(lKeyItem); | ||
2377 | 353 | } | ||
2378 | 354 | |||
2379 | 355 | if (i == theChildren.size()) | ||
2380 | 356 | { | ||
2381 | 357 | state->theIter = GENV_STORE.getIteratorFactory()-> | 551 | state->theIter = GENV_STORE.getIteratorFactory()-> |
2383 | 358 | createIndexProbeIterator(lIndex); | 552 | createIndexProbeIterator(lMap); |
2384 | 359 | 553 | ||
2385 | 360 | state->theIter->init(state->theCond); | 554 | state->theIter->init(state->theCond); |
2386 | 361 | state->theIter->open(); | 555 | state->theIter->open(); |
2387 | @@ -377,53 +571,31 @@ | |||
2388 | 377 | store::Item_t& result, | 571 | store::Item_t& result, |
2389 | 378 | PlanState& aPlanState) const | 572 | PlanState& aPlanState) const |
2390 | 379 | { | 573 | { |
2395 | 380 | store::Item_t lQName; | 574 | store::Item_t lName; |
2396 | 381 | std::vector<store::Item_t> lKey; | 575 | store::Item_t lKey; |
2397 | 382 | store::IndexSpecification lSpec; | 576 | std::vector<store::Item_t> lKeyAttrs; |
2398 | 383 | store::Index* lIndex; | 577 | store::Index* lMap; |
2399 | 384 | bool lPersistent; | 578 | bool lPersistent; |
2400 | 385 | 579 | ||
2401 | 386 | PlanIteratorState* state; | 580 | PlanIteratorState* state; |
2402 | 387 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 581 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2403 | 388 | 582 | ||
2433 | 389 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 583 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2434 | 390 | 584 | createMapQName(lName, theSctx, loc); | |
2435 | 391 | lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); | 585 | |
2436 | 392 | 586 | lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); | |
2437 | 393 | lSpec = lIndex->getSpecification(); | 587 | |
2438 | 394 | 588 | consumeNext(lKey, theChildren[1].getp(), aPlanState); | |
2439 | 395 | if (lSpec.getNumColumns() != theChildren.size() - 2) | 589 | |
2440 | 396 | { | 590 | prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs); |
2412 | 397 | RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc, | ||
2413 | 398 | ERROR_PARAMS(lQName->getStringValue(), | ||
2414 | 399 | "map", | ||
2415 | 400 | theChildren.size() - 2, | ||
2416 | 401 | lSpec.getNumColumns())); | ||
2417 | 402 | } | ||
2418 | 403 | |||
2419 | 404 | lKey.resize(theChildren.size() - 2); | ||
2420 | 405 | for (size_t i = 2; i < theChildren.size(); ++i) | ||
2421 | 406 | { | ||
2422 | 407 | if (consumeNext(lKey[i-2], theChildren[i].getp(), aPlanState)) | ||
2423 | 408 | { | ||
2424 | 409 | namespace_context tmp_ctx(theSctx); | ||
2425 | 410 | castOrCheckIndexType( | ||
2426 | 411 | lKey[i-2], | ||
2427 | 412 | lSpec.theKeyTypes[i-2], | ||
2428 | 413 | lQName, | ||
2429 | 414 | &tmp_ctx, | ||
2430 | 415 | loc); | ||
2431 | 416 | } | ||
2432 | 417 | } | ||
2441 | 418 | 591 | ||
2442 | 419 | if (lPersistent) | 592 | if (lPersistent) |
2443 | 420 | { | 593 | { |
2444 | 421 | std::auto_ptr<store::PUL> lPul; | ||
2445 | 422 | store::Iterator_t lValue | 594 | store::Iterator_t lValue |
2447 | 423 | = new PlanIteratorWrapper(theChildren[1], aPlanState); | 595 | = new PlanIteratorWrapper(theChildren[2], aPlanState); |
2448 | 424 | 596 | ||
2451 | 425 | lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); | 597 | std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2452 | 426 | lPul->addInsertIntoHashMap(&loc, lQName, lKey, lValue); | 598 | lPul->addInsertIntoHashMap(&loc, lName, lKeyAttrs, lValue); |
2453 | 427 | 599 | ||
2454 | 428 | apply_updates( | 600 | apply_updates( |
2455 | 429 | aPlanState.theCompilerCB, | 601 | aPlanState.theCompilerCB, |
2456 | @@ -435,18 +607,27 @@ | |||
2457 | 435 | else | 607 | else |
2458 | 436 | { | 608 | { |
2459 | 437 | store::Item_t lValue; | 609 | store::Item_t lValue; |
2461 | 438 | while (consumeNext(lValue, theChildren[1], aPlanState)) | 610 | while (consumeNext(lValue, theChildren[2], aPlanState)) |
2462 | 439 | { | 611 | { |
2463 | 612 | if ((lValue->isNode() || lValue->isArray() || lValue->isObject()) | ||
2464 | 613 | && lValue->getCollection() == 0) | ||
2465 | 614 | { | ||
2466 | 615 | zstring lType = "node"; | ||
2467 | 616 | if (lValue->isArray()) lType = "array"; | ||
2468 | 617 | else if (lValue->isObject()) lType = "object"; | ||
2469 | 618 | |||
2470 | 619 | RAISE_ERROR(zerr::ZDDY0042_ITEM_NOT_IN_COLLECTION, loc, | ||
2471 | 620 | ERROR_PARAMS(lName->getLocalName(), lType)); | ||
2472 | 621 | } | ||
2473 | 622 | |||
2474 | 440 | std::auto_ptr<store::IndexKey> k(new store::IndexKey()); | 623 | std::auto_ptr<store::IndexKey> k(new store::IndexKey()); |
2478 | 441 | for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin(); | 624 | for (size_t i = 0; i < lKeyAttrs.size(); ++i) |
2476 | 442 | lIter != lKey.end(); | ||
2477 | 443 | ++lIter) | ||
2479 | 444 | { | 625 | { |
2481 | 445 | k->push_back(*lIter); | 626 | k->push_back(lKeyAttrs[i]); |
2482 | 446 | } | 627 | } |
2483 | 447 | 628 | ||
2484 | 448 | store::IndexKey* lKeyPtr = k.get(); | 629 | store::IndexKey* lKeyPtr = k.get(); |
2486 | 449 | if (!lIndex->insert(lKeyPtr, lValue)) | 630 | if (!lMap->insert(lKeyPtr, lValue)) |
2487 | 450 | { | 631 | { |
2488 | 451 | // the index took the ownership over the key if the index | 632 | // the index took the ownership over the key if the index |
2489 | 452 | // did _not_ already contain an entry with the same key | 633 | // did _not_ already contain an entry with the same key |
2490 | @@ -464,51 +645,32 @@ | |||
2491 | 464 | /******************************************************************************* | 645 | /******************************************************************************* |
2492 | 465 | ********************************************************************************/ | 646 | ********************************************************************************/ |
2493 | 466 | bool | 647 | bool |
2495 | 467 | MapRemoveIterator::nextImpl( | 648 | MapDeleteIterator::nextImpl( |
2496 | 468 | store::Item_t& result, | 649 | store::Item_t& result, |
2497 | 469 | PlanState& aPlanState) const | 650 | PlanState& aPlanState) const |
2498 | 470 | { | 651 | { |
2506 | 471 | store::Item_t lQName; | 652 | store::Item_t lName; |
2507 | 472 | std::vector<store::Item_t> lKey; | 653 | store::Item_t lKey; |
2508 | 473 | store::Index* lIndex; | 654 | std::vector<store::Item_t> lKeyAttrs; |
2509 | 474 | ulong i; | 655 | store::Index* lMap; |
2503 | 475 | store::Item_t lKeyItem; | ||
2504 | 476 | std::auto_ptr<store::PUL> lPul; | ||
2505 | 477 | store::IndexSpecification lSpec; | ||
2510 | 478 | bool lPersistent; | 656 | bool lPersistent; |
2511 | 479 | 657 | ||
2512 | 480 | PlanIteratorState* state; | 658 | PlanIteratorState* state; |
2513 | 481 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 659 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2514 | 482 | 660 | ||
2539 | 483 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 661 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2540 | 484 | 662 | createMapQName(lName, theSctx, loc); | |
2541 | 485 | lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); | 663 | |
2542 | 486 | 664 | lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); | |
2543 | 487 | lSpec = lIndex->getSpecification(); | 665 | |
2544 | 488 | 666 | consumeNext(lKey, theChildren[1].getp(), aPlanState); | |
2545 | 489 | if (lSpec.getNumColumns() != theChildren.size() - 1) | 667 | |
2546 | 490 | { | 668 | prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs); |
2523 | 491 | RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc, | ||
2524 | 492 | ERROR_PARAMS(lQName->getStringValue(), | ||
2525 | 493 | "map", | ||
2526 | 494 | theChildren.size() - 1, | ||
2527 | 495 | lSpec.getNumColumns())); | ||
2528 | 496 | } | ||
2529 | 497 | |||
2530 | 498 | lKey.resize(theChildren.size()-1); | ||
2531 | 499 | for (i = 1; i < theChildren.size(); ++i) | ||
2532 | 500 | { | ||
2533 | 501 | if (consumeNext(lKey[i-1], theChildren[i], aPlanState)) | ||
2534 | 502 | { | ||
2535 | 503 | namespace_context tmp_ctx(theSctx); | ||
2536 | 504 | castOrCheckIndexType(lKey[i-1], lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc); | ||
2537 | 505 | } | ||
2538 | 506 | } | ||
2547 | 507 | 669 | ||
2548 | 508 | if (lPersistent) | 670 | if (lPersistent) |
2549 | 509 | { | 671 | { |
2552 | 510 | lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); | 672 | std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2553 | 511 | lPul->addRemoveFromHashMap(&loc, lQName, lKey); | 673 | lPul->addRemoveFromHashMap(&loc, lName, lKeyAttrs); |
2554 | 512 | 674 | ||
2555 | 513 | apply_updates( | 675 | apply_updates( |
2556 | 514 | aPlanState.theCompilerCB, | 676 | aPlanState.theCompilerCB, |
2557 | @@ -520,14 +682,12 @@ | |||
2558 | 520 | else | 682 | else |
2559 | 521 | { | 683 | { |
2560 | 522 | store::IndexKey k; | 684 | store::IndexKey k; |
2564 | 523 | for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin(); | 685 | for (size_t i = 0; i < lKeyAttrs.size(); ++i) |
2562 | 524 | lIter != lKey.end(); | ||
2563 | 525 | ++lIter) | ||
2565 | 526 | { | 686 | { |
2567 | 527 | k.push_back(*lIter); | 687 | k.push_back(lKeyAttrs[i]); |
2568 | 528 | } | 688 | } |
2569 | 529 | store::Item_t lValue; | 689 | store::Item_t lValue; |
2571 | 530 | lIndex->remove(&k, lValue, true); | 690 | lMap->remove(&k, lValue, true); |
2572 | 531 | } | 691 | } |
2573 | 532 | 692 | ||
2574 | 533 | result = NULL; | 693 | result = NULL; |
2575 | @@ -537,78 +697,33 @@ | |||
2576 | 537 | 697 | ||
2577 | 538 | 698 | ||
2578 | 539 | /******************************************************************************* | 699 | /******************************************************************************* |
2579 | 540 | |||
2580 | 541 | ********************************************************************************/ | 700 | ********************************************************************************/ |
2581 | 542 | bool | 701 | bool |
2582 | 543 | MapKeysIterator::nextImpl( | 702 | MapKeysIterator::nextImpl( |
2583 | 544 | store::Item_t& result, | 703 | store::Item_t& result, |
2584 | 545 | PlanState& aPlanState) const | 704 | PlanState& aPlanState) const |
2585 | 546 | { | 705 | { |
2587 | 547 | store::Item_t lQName; | 706 | store::Item_t lName; |
2588 | 548 | store::Index* lIndex; | 707 | store::Index* lIndex; |
2589 | 549 | store::IndexKey lKey; | 708 | store::IndexKey lKey; |
2590 | 550 | store::Item_t lTypeName; | 709 | store::Item_t lTypeName; |
2591 | 551 | zstring lBaseURI = | ||
2592 | 552 | static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS; | ||
2593 | 553 | |||
2594 | 554 | store::Item_t lKeyNodeName; | ||
2595 | 555 | GENV_ITEMFACTORY->createQName(lKeyNodeName, | ||
2596 | 556 | static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS, | ||
2597 | 557 | "", "key"); | ||
2598 | 558 | 710 | ||
2599 | 559 | MapKeysIteratorState* state; | 711 | MapKeysIteratorState* state; |
2600 | 560 | DEFAULT_STACK_INIT(MapKeysIteratorState, state, aPlanState); | 712 | DEFAULT_STACK_INIT(MapKeysIteratorState, state, aPlanState); |
2601 | 561 | 713 | ||
2603 | 562 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 714 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2604 | 715 | createMapQName(lName, theSctx, loc); | ||
2605 | 563 | 716 | ||
2607 | 564 | getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); | 717 | getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex); |
2608 | 565 | 718 | ||
2609 | 566 | state->theIter = lIndex->keys(); | 719 | state->theIter = lIndex->keys(); |
2610 | 567 | 720 | ||
2611 | 568 | state->theIter->open(); | 721 | state->theIter->open(); |
2612 | 569 | 722 | ||
2613 | 570 | // generate result elements of the form | ||
2614 | 571 | // <key> | ||
2615 | 572 | // <attribute value="key1_value"/> | ||
2616 | 573 | // <attribute value="key2_value"/> | ||
2617 | 574 | // <attribute value="key3_value"/> | ||
2618 | 575 | // </key> | ||
2619 | 576 | while (state->theIter->next(lKey)) | 723 | while (state->theIter->next(lKey)) |
2620 | 577 | { | 724 | { |
2655 | 578 | lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME; | 725 | createKeysArray(lKey, result); |
2656 | 579 | 726 | ||
2623 | 580 | GENV_ITEMFACTORY->createElementNode( | ||
2624 | 581 | result, NULL, lKeyNodeName, lTypeName, | ||
2625 | 582 | true, false, theNSBindings, lBaseURI); | ||
2626 | 583 | |||
2627 | 584 | for (store::ItemVector::iterator lIter = lKey.begin(); | ||
2628 | 585 | lIter != lKey.end(); | ||
2629 | 586 | ++lIter) | ||
2630 | 587 | { | ||
2631 | 588 | store::Item_t lAttrElem, lAttrNodeName; | ||
2632 | 589 | store::Item_t lNameAttr, lValueAttr, lValueAttrName; | ||
2633 | 590 | |||
2634 | 591 | GENV_ITEMFACTORY->createQName(lAttrNodeName, | ||
2635 | 592 | static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS, | ||
2636 | 593 | "", "attribute"); | ||
2637 | 594 | |||
2638 | 595 | lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME; | ||
2639 | 596 | |||
2640 | 597 | GENV_ITEMFACTORY->createElementNode( | ||
2641 | 598 | lAttrElem, result, lAttrNodeName, lTypeName, | ||
2642 | 599 | true, false, theNSBindings, lBaseURI); | ||
2643 | 600 | |||
2644 | 601 | store::Item_t& lValue = (*lIter); | ||
2645 | 602 | if (! lValue.isNull()) | ||
2646 | 603 | { | ||
2647 | 604 | GENV_ITEMFACTORY->createQName(lValueAttrName, "", "", "value"); | ||
2648 | 605 | |||
2649 | 606 | lTypeName = lValue->getType(); | ||
2650 | 607 | |||
2651 | 608 | GENV_ITEMFACTORY->createAttributeNode( | ||
2652 | 609 | lValueAttr, lAttrElem.getp(), lValueAttrName, lTypeName, lValue); | ||
2653 | 610 | } | ||
2654 | 611 | } | ||
2657 | 612 | STACK_PUSH(true, state); | 727 | STACK_PUSH(true, state); |
2658 | 613 | } | 728 | } |
2659 | 614 | 729 | ||
2660 | @@ -623,17 +738,18 @@ | |||
2661 | 623 | store::Item_t& result, | 738 | store::Item_t& result, |
2662 | 624 | PlanState& aPlanState) const | 739 | PlanState& aPlanState) const |
2663 | 625 | { | 740 | { |
2666 | 626 | store::Item_t lQName; | 741 | store::Item_t lName; |
2667 | 627 | store::Index* lIndex; | 742 | store::Index* lMap; |
2668 | 628 | 743 | ||
2669 | 629 | PlanIteratorState* state; | 744 | PlanIteratorState* state; |
2670 | 630 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 745 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2671 | 631 | 746 | ||
2677 | 632 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 747 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2678 | 633 | 748 | createMapQName(lName, theSctx, loc); | |
2679 | 634 | getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); | 749 | |
2680 | 635 | 750 | getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); | |
2681 | 636 | GENV_ITEMFACTORY->createInteger(result, xs_integer(lIndex->size())); | 751 | |
2682 | 752 | GENV_ITEMFACTORY->createInteger(result, xs_integer(lMap->size())); | ||
2683 | 637 | 753 | ||
2684 | 638 | STACK_PUSH(true, state); | 754 | STACK_PUSH(true, state); |
2685 | 639 | 755 | ||
2686 | @@ -642,7 +758,6 @@ | |||
2687 | 642 | 758 | ||
2688 | 643 | 759 | ||
2689 | 644 | /******************************************************************************* | 760 | /******************************************************************************* |
2690 | 645 | |||
2691 | 646 | ********************************************************************************/ | 761 | ********************************************************************************/ |
2692 | 647 | AvailableMapsIteratorState::~AvailableMapsIteratorState() | 762 | AvailableMapsIteratorState::~AvailableMapsIteratorState() |
2693 | 648 | { | 763 | { |
2694 | @@ -676,16 +791,22 @@ | |||
2695 | 676 | bool | 791 | bool |
2696 | 677 | AvailableMapsIterator::nextImpl(store::Item_t& result, PlanState& planState) const | 792 | AvailableMapsIterator::nextImpl(store::Item_t& result, PlanState& planState) const |
2697 | 678 | { | 793 | { |
2698 | 794 | store::Item_t lNameItem;; | ||
2699 | 795 | zstring lLocalName; | ||
2700 | 796 | |||
2701 | 679 | AvailableMapsIteratorState * state; | 797 | AvailableMapsIteratorState * state; |
2702 | 680 | store::Item_t nameItem; | ||
2703 | 681 | |||
2704 | 682 | DEFAULT_STACK_INIT(AvailableMapsIteratorState, state, planState); | 798 | DEFAULT_STACK_INIT(AvailableMapsIteratorState, state, planState); |
2705 | 683 | 799 | ||
2706 | 684 | for ((state->persistentMapNamesIter = GENV_STORE.listMapNames())->open (); | 800 | for ((state->persistentMapNamesIter = GENV_STORE.listMapNames())->open (); |
2708 | 685 | state->persistentMapNamesIter->next(nameItem); ) | 801 | state->persistentMapNamesIter->next(lNameItem); ) |
2709 | 686 | { | 802 | { |
2712 | 687 | result = nameItem; | 803 | if (lNameItem->getNamespace() != getMapURI(theSctx, loc)) |
2713 | 688 | STACK_PUSH( true, state); | 804 | { |
2714 | 805 | continue; | ||
2715 | 806 | } | ||
2716 | 807 | lLocalName = lNameItem->getLocalName(); | ||
2717 | 808 | GENV_ITEMFACTORY->createString(result, lLocalName); | ||
2718 | 809 | STACK_PUSH(true, state); | ||
2719 | 689 | } | 810 | } |
2720 | 690 | 811 | ||
2721 | 691 | state->persistentMapNamesIter->close(); | 812 | state->persistentMapNamesIter->close(); |
2722 | @@ -696,7 +817,13 @@ | |||
2723 | 696 | state->transientMapNamesIter != state->transientMapNames.end(); | 817 | state->transientMapNamesIter != state->transientMapNames.end(); |
2724 | 697 | ++state->transientMapNamesIter) | 818 | ++state->transientMapNamesIter) |
2725 | 698 | { | 819 | { |
2727 | 699 | result = *state->transientMapNamesIter; | 820 | lNameItem = *state->transientMapNamesIter; |
2728 | 821 | if (lNameItem->getNamespace() != getMapURI(theSctx, loc)) | ||
2729 | 822 | { | ||
2730 | 823 | continue; | ||
2731 | 824 | } | ||
2732 | 825 | lLocalName = lNameItem->getLocalName(); | ||
2733 | 826 | GENV_ITEMFACTORY->createString(result, lLocalName); | ||
2734 | 700 | STACK_PUSH( true, state); | 827 | STACK_PUSH( true, state); |
2735 | 701 | } | 828 | } |
2736 | 702 | 829 | ||
2737 | @@ -707,22 +834,29 @@ | |||
2738 | 707 | /******************************************************************************* | 834 | /******************************************************************************* |
2739 | 708 | ********************************************************************************/ | 835 | ********************************************************************************/ |
2740 | 709 | bool | 836 | bool |
2742 | 710 | MapIsTransientIterator::nextImpl( | 837 | MapOptionsIterator::nextImpl( |
2743 | 711 | store::Item_t& result, | 838 | store::Item_t& result, |
2744 | 712 | PlanState& aPlanState) const | 839 | PlanState& aPlanState) const |
2745 | 713 | { | 840 | { |
2749 | 714 | store::Item_t lQName; | 841 | store::Item_t lName; |
2750 | 715 | store::Index* lIndex; | 842 | store::Index* lMap; |
2751 | 716 | bool lPersistent; | 843 | bool lPersistent; |
2752 | 844 | std::vector<store::Item_t> lNames(1); | ||
2753 | 845 | std::vector<store::Item_t> lValues(1); | ||
2754 | 846 | zstring lTmp("persistent"); | ||
2755 | 717 | 847 | ||
2756 | 718 | PlanIteratorState* state; | 848 | PlanIteratorState* state; |
2757 | 719 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); | 849 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2758 | 720 | 850 | ||
2764 | 721 | consumeNext(lQName, theChildren[0].getp(), aPlanState); | 851 | consumeNext(lName, theChildren[0].getp(), aPlanState); |
2765 | 722 | 852 | createMapQName(lName, theSctx, loc); | |
2766 | 723 | lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); | 853 | |
2767 | 724 | 854 | lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); | |
2768 | 725 | GENV_ITEMFACTORY->createBoolean(result, !lPersistent); | 855 | |
2769 | 856 | GENV_ITEMFACTORY->createString(lNames[0], lTmp); | ||
2770 | 857 | GENV_ITEMFACTORY->createBoolean(lValues[0], lPersistent); | ||
2771 | 858 | |||
2772 | 859 | GENV_ITEMFACTORY->createJSONObject(result, lNames, lValues); | ||
2773 | 726 | 860 | ||
2774 | 727 | STACK_PUSH(true, state); | 861 | STACK_PUSH(true, state); |
2775 | 728 | 862 | ||
2776 | 729 | 863 | ||
2777 | === modified file 'src/runtime/store/pregenerated/maps.cpp' | |||
2778 | --- src/runtime/store/pregenerated/maps.cpp 2013-03-05 23:11:50 +0000 | |||
2779 | +++ src/runtime/store/pregenerated/maps.cpp 2013-09-02 20:59:05 +0000 | |||
2780 | @@ -62,60 +62,32 @@ | |||
2781 | 62 | // </MapCreateIterator> | 62 | // </MapCreateIterator> |
2782 | 63 | 63 | ||
2783 | 64 | 64 | ||
2838 | 65 | // <MapCreateTransientIterator> | 65 | // <MapDropIterator> |
2839 | 66 | SERIALIZABLE_CLASS_VERSIONS(MapCreateTransientIterator) | 66 | SERIALIZABLE_CLASS_VERSIONS(MapDropIterator) |
2840 | 67 | 67 | ||
2841 | 68 | void MapCreateTransientIterator::serialize(::zorba::serialization::Archiver& ar) | 68 | void MapDropIterator::serialize(::zorba::serialization::Archiver& ar) |
2842 | 69 | { | 69 | { |
2843 | 70 | serialize_baseclass(ar, | 70 | serialize_baseclass(ar, |
2844 | 71 | (NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>*)this); | 71 | (NaryBaseIterator<MapDropIterator, PlanIteratorState>*)this); |
2845 | 72 | } | 72 | } |
2846 | 73 | 73 | ||
2847 | 74 | 74 | ||
2848 | 75 | void MapCreateTransientIterator::accept(PlanIterVisitor& v) const | 75 | void MapDropIterator::accept(PlanIterVisitor& v) const |
2849 | 76 | { | 76 | { |
2850 | 77 | v.beginVisit(*this); | 77 | v.beginVisit(*this); |
2851 | 78 | 78 | ||
2852 | 79 | std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); | 79 | std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); |
2853 | 80 | std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); | 80 | std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); |
2854 | 81 | for ( ; lIter != lEnd; ++lIter ){ | 81 | for ( ; lIter != lEnd; ++lIter ){ |
2855 | 82 | (*lIter)->accept(v); | 82 | (*lIter)->accept(v); |
2856 | 83 | } | 83 | } |
2857 | 84 | 84 | ||
2858 | 85 | v.endVisit(*this); | 85 | v.endVisit(*this); |
2859 | 86 | } | 86 | } |
2860 | 87 | 87 | ||
2861 | 88 | MapCreateTransientIterator::~MapCreateTransientIterator() {} | 88 | MapDropIterator::~MapDropIterator() {} |
2862 | 89 | 89 | ||
2863 | 90 | // </MapCreateTransientIterator> | 90 | // </MapDropIterator> |
2810 | 91 | |||
2811 | 92 | |||
2812 | 93 | // <MapDestroyIterator> | ||
2813 | 94 | SERIALIZABLE_CLASS_VERSIONS(MapDestroyIterator) | ||
2814 | 95 | |||
2815 | 96 | void MapDestroyIterator::serialize(::zorba::serialization::Archiver& ar) | ||
2816 | 97 | { | ||
2817 | 98 | serialize_baseclass(ar, | ||
2818 | 99 | (NaryBaseIterator<MapDestroyIterator, PlanIteratorState>*)this); | ||
2819 | 100 | } | ||
2820 | 101 | |||
2821 | 102 | |||
2822 | 103 | void MapDestroyIterator::accept(PlanIterVisitor& v) const | ||
2823 | 104 | { | ||
2824 | 105 | v.beginVisit(*this); | ||
2825 | 106 | |||
2826 | 107 | std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); | ||
2827 | 108 | std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); | ||
2828 | 109 | for ( ; lIter != lEnd; ++lIter ){ | ||
2829 | 110 | (*lIter)->accept(v); | ||
2830 | 111 | } | ||
2831 | 112 | |||
2832 | 113 | v.endVisit(*this); | ||
2833 | 114 | } | ||
2834 | 115 | |||
2835 | 116 | MapDestroyIterator::~MapDestroyIterator() {} | ||
2836 | 117 | |||
2837 | 118 | // </MapDestroyIterator> | ||
2864 | 119 | 91 | ||
2865 | 120 | 92 | ||
2866 | 121 | // <MapGetIterator> | 93 | // <MapGetIterator> |
2867 | @@ -186,17 +158,17 @@ | |||
2868 | 186 | // </MapInsertIterator> | 158 | // </MapInsertIterator> |
2869 | 187 | 159 | ||
2870 | 188 | 160 | ||
2873 | 189 | // <MapRemoveIterator> | 161 | // <MapDeleteIterator> |
2874 | 190 | SERIALIZABLE_CLASS_VERSIONS(MapRemoveIterator) | 162 | SERIALIZABLE_CLASS_VERSIONS(MapDeleteIterator) |
2875 | 191 | 163 | ||
2877 | 192 | void MapRemoveIterator::serialize(::zorba::serialization::Archiver& ar) | 164 | void MapDeleteIterator::serialize(::zorba::serialization::Archiver& ar) |
2878 | 193 | { | 165 | { |
2879 | 194 | serialize_baseclass(ar, | 166 | serialize_baseclass(ar, |
2881 | 195 | (NaryBaseIterator<MapRemoveIterator, PlanIteratorState>*)this); | 167 | (NaryBaseIterator<MapDeleteIterator, PlanIteratorState>*)this); |
2882 | 196 | } | 168 | } |
2883 | 197 | 169 | ||
2884 | 198 | 170 | ||
2886 | 199 | void MapRemoveIterator::accept(PlanIterVisitor& v) const | 171 | void MapDeleteIterator::accept(PlanIterVisitor& v) const |
2887 | 200 | { | 172 | { |
2888 | 201 | v.beginVisit(*this); | 173 | v.beginVisit(*this); |
2889 | 202 | 174 | ||
2890 | @@ -209,9 +181,9 @@ | |||
2891 | 209 | v.endVisit(*this); | 181 | v.endVisit(*this); |
2892 | 210 | } | 182 | } |
2893 | 211 | 183 | ||
2895 | 212 | MapRemoveIterator::~MapRemoveIterator() {} | 184 | MapDeleteIterator::~MapDeleteIterator() {} |
2896 | 213 | 185 | ||
2898 | 214 | // </MapRemoveIterator> | 186 | // </MapDeleteIterator> |
2899 | 215 | 187 | ||
2900 | 216 | 188 | ||
2901 | 217 | // <MapKeysIterator> | 189 | // <MapKeysIterator> |
2902 | @@ -221,8 +193,6 @@ | |||
2903 | 221 | { | 193 | { |
2904 | 222 | serialize_baseclass(ar, | 194 | serialize_baseclass(ar, |
2905 | 223 | (NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>*)this); | 195 | (NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>*)this); |
2906 | 224 | |||
2907 | 225 | ar & theNSBindings; | ||
2908 | 226 | } | 196 | } |
2909 | 227 | 197 | ||
2910 | 228 | 198 | ||
2911 | @@ -314,17 +284,17 @@ | |||
2912 | 314 | // </AvailableMapsIterator> | 284 | // </AvailableMapsIterator> |
2913 | 315 | 285 | ||
2914 | 316 | 286 | ||
2917 | 317 | // <MapIsTransientIterator> | 287 | // <MapOptionsIterator> |
2918 | 318 | SERIALIZABLE_CLASS_VERSIONS(MapIsTransientIterator) | 288 | SERIALIZABLE_CLASS_VERSIONS(MapOptionsIterator) |
2919 | 319 | 289 | ||
2921 | 320 | void MapIsTransientIterator::serialize(::zorba::serialization::Archiver& ar) | 290 | void MapOptionsIterator::serialize(::zorba::serialization::Archiver& ar) |
2922 | 321 | { | 291 | { |
2923 | 322 | serialize_baseclass(ar, | 292 | serialize_baseclass(ar, |
2925 | 323 | (NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>*)this); | 293 | (NaryBaseIterator<MapOptionsIterator, PlanIteratorState>*)this); |
2926 | 324 | } | 294 | } |
2927 | 325 | 295 | ||
2928 | 326 | 296 | ||
2930 | 327 | void MapIsTransientIterator::accept(PlanIterVisitor& v) const | 297 | void MapOptionsIterator::accept(PlanIterVisitor& v) const |
2931 | 328 | { | 298 | { |
2932 | 329 | v.beginVisit(*this); | 299 | v.beginVisit(*this); |
2933 | 330 | 300 | ||
2934 | @@ -337,9 +307,9 @@ | |||
2935 | 337 | v.endVisit(*this); | 307 | v.endVisit(*this); |
2936 | 338 | } | 308 | } |
2937 | 339 | 309 | ||
2939 | 340 | MapIsTransientIterator::~MapIsTransientIterator() {} | 310 | MapOptionsIterator::~MapOptionsIterator() {} |
2940 | 341 | 311 | ||
2942 | 342 | // </MapIsTransientIterator> | 312 | // </MapOptionsIterator> |
2943 | 343 | 313 | ||
2944 | 344 | 314 | ||
2945 | 345 | 315 | ||
2946 | 346 | 316 | ||
2947 | === modified file 'src/runtime/store/pregenerated/maps.h' | |||
2948 | --- src/runtime/store/pregenerated/maps.h 2013-03-05 23:11:50 +0000 | |||
2949 | +++ src/runtime/store/pregenerated/maps.h 2013-09-02 20:59:05 +0000 | |||
2950 | @@ -71,56 +71,25 @@ | |||
2951 | 71 | * | 71 | * |
2952 | 72 | * Author: Matthias Brantner | 72 | * Author: Matthias Brantner |
2953 | 73 | */ | 73 | */ |
3004 | 74 | class MapCreateTransientIterator : public NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState> | 74 | class MapDropIterator : public NaryBaseIterator<MapDropIterator, PlanIteratorState> |
3005 | 75 | { | 75 | { |
3006 | 76 | public: | 76 | public: |
3007 | 77 | SERIALIZABLE_CLASS(MapCreateTransientIterator); | 77 | SERIALIZABLE_CLASS(MapDropIterator); |
3008 | 78 | 78 | ||
3009 | 79 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapCreateTransientIterator, | 79 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDropIterator, |
3010 | 80 | NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>); | 80 | NaryBaseIterator<MapDropIterator, PlanIteratorState>); |
3011 | 81 | 81 | ||
3012 | 82 | void serialize( ::zorba::serialization::Archiver& ar); | 82 | void serialize( ::zorba::serialization::Archiver& ar); |
3013 | 83 | 83 | ||
3014 | 84 | MapCreateTransientIterator( | 84 | MapDropIterator( |
3015 | 85 | static_context* sctx, | 85 | static_context* sctx, |
3016 | 86 | const QueryLoc& loc, | 86 | const QueryLoc& loc, |
3017 | 87 | std::vector<PlanIter_t>& children) | 87 | std::vector<PlanIter_t>& children) |
3018 | 88 | : | 88 | : |
3019 | 89 | NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>(sctx, loc, children) | 89 | NaryBaseIterator<MapDropIterator, PlanIteratorState>(sctx, loc, children) |
3020 | 90 | {} | 90 | {} |
3021 | 91 | 91 | ||
3022 | 92 | virtual ~MapCreateTransientIterator(); | 92 | virtual ~MapDropIterator(); |
2973 | 93 | |||
2974 | 94 | void accept(PlanIterVisitor& v) const; | ||
2975 | 95 | |||
2976 | 96 | bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; | ||
2977 | 97 | }; | ||
2978 | 98 | |||
2979 | 99 | |||
2980 | 100 | /** | ||
2981 | 101 | * | ||
2982 | 102 | * | ||
2983 | 103 | * Author: Matthias Brantner | ||
2984 | 104 | */ | ||
2985 | 105 | class MapDestroyIterator : public NaryBaseIterator<MapDestroyIterator, PlanIteratorState> | ||
2986 | 106 | { | ||
2987 | 107 | public: | ||
2988 | 108 | SERIALIZABLE_CLASS(MapDestroyIterator); | ||
2989 | 109 | |||
2990 | 110 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDestroyIterator, | ||
2991 | 111 | NaryBaseIterator<MapDestroyIterator, PlanIteratorState>); | ||
2992 | 112 | |||
2993 | 113 | void serialize( ::zorba::serialization::Archiver& ar); | ||
2994 | 114 | |||
2995 | 115 | MapDestroyIterator( | ||
2996 | 116 | static_context* sctx, | ||
2997 | 117 | const QueryLoc& loc, | ||
2998 | 118 | std::vector<PlanIter_t>& children) | ||
2999 | 119 | : | ||
3000 | 120 | NaryBaseIterator<MapDestroyIterator, PlanIteratorState>(sctx, loc, children) | ||
3001 | 121 | {} | ||
3002 | 122 | |||
3003 | 123 | virtual ~MapDestroyIterator(); | ||
3023 | 124 | 93 | ||
3024 | 125 | void accept(PlanIterVisitor& v) const; | 94 | void accept(PlanIterVisitor& v) const; |
3025 | 126 | 95 | ||
3026 | @@ -209,25 +178,25 @@ | |||
3027 | 209 | * | 178 | * |
3028 | 210 | * Author: Matthias Brantner | 179 | * Author: Matthias Brantner |
3029 | 211 | */ | 180 | */ |
3031 | 212 | class MapRemoveIterator : public NaryBaseIterator<MapRemoveIterator, PlanIteratorState> | 181 | class MapDeleteIterator : public NaryBaseIterator<MapDeleteIterator, PlanIteratorState> |
3032 | 213 | { | 182 | { |
3033 | 214 | public: | 183 | public: |
3035 | 215 | SERIALIZABLE_CLASS(MapRemoveIterator); | 184 | SERIALIZABLE_CLASS(MapDeleteIterator); |
3036 | 216 | 185 | ||
3039 | 217 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapRemoveIterator, | 186 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDeleteIterator, |
3040 | 218 | NaryBaseIterator<MapRemoveIterator, PlanIteratorState>); | 187 | NaryBaseIterator<MapDeleteIterator, PlanIteratorState>); |
3041 | 219 | 188 | ||
3042 | 220 | void serialize( ::zorba::serialization::Archiver& ar); | 189 | void serialize( ::zorba::serialization::Archiver& ar); |
3043 | 221 | 190 | ||
3045 | 222 | MapRemoveIterator( | 191 | MapDeleteIterator( |
3046 | 223 | static_context* sctx, | 192 | static_context* sctx, |
3047 | 224 | const QueryLoc& loc, | 193 | const QueryLoc& loc, |
3048 | 225 | std::vector<PlanIter_t>& children) | 194 | std::vector<PlanIter_t>& children) |
3049 | 226 | : | 195 | : |
3051 | 227 | NaryBaseIterator<MapRemoveIterator, PlanIteratorState>(sctx, loc, children) | 196 | NaryBaseIterator<MapDeleteIterator, PlanIteratorState>(sctx, loc, children) |
3052 | 228 | {} | 197 | {} |
3053 | 229 | 198 | ||
3055 | 230 | virtual ~MapRemoveIterator(); | 199 | virtual ~MapDeleteIterator(); |
3056 | 231 | 200 | ||
3057 | 232 | void accept(PlanIterVisitor& v) const; | 201 | void accept(PlanIterVisitor& v) const; |
3058 | 233 | 202 | ||
3059 | @@ -255,8 +224,6 @@ | |||
3060 | 255 | 224 | ||
3061 | 256 | class MapKeysIterator : public NaryBaseIterator<MapKeysIterator, MapKeysIteratorState> | 225 | class MapKeysIterator : public NaryBaseIterator<MapKeysIterator, MapKeysIteratorState> |
3062 | 257 | { | 226 | { |
3063 | 258 | protected: | ||
3064 | 259 | store::NsBindings theNSBindings; // | ||
3065 | 260 | public: | 227 | public: |
3066 | 261 | SERIALIZABLE_CLASS(MapKeysIterator); | 228 | SERIALIZABLE_CLASS(MapKeysIterator); |
3067 | 262 | 229 | ||
3068 | @@ -270,8 +237,7 @@ | |||
3069 | 270 | const QueryLoc& loc, | 237 | const QueryLoc& loc, |
3070 | 271 | std::vector<PlanIter_t>& children) | 238 | std::vector<PlanIter_t>& children) |
3071 | 272 | : | 239 | : |
3074 | 273 | NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children), | 240 | NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children) |
3073 | 274 | theNSBindings() | ||
3075 | 275 | {} | 241 | {} |
3076 | 276 | 242 | ||
3077 | 277 | virtual ~MapKeysIterator(); | 243 | virtual ~MapKeysIterator(); |
3078 | @@ -364,25 +330,25 @@ | |||
3079 | 364 | * | 330 | * |
3080 | 365 | * Author: Matthias Brantner | 331 | * Author: Matthias Brantner |
3081 | 366 | */ | 332 | */ |
3083 | 367 | class MapIsTransientIterator : public NaryBaseIterator<MapIsTransientIterator, PlanIteratorState> | 333 | class MapOptionsIterator : public NaryBaseIterator<MapOptionsIterator, PlanIteratorState> |
3084 | 368 | { | 334 | { |
3085 | 369 | public: | 335 | public: |
3087 | 370 | SERIALIZABLE_CLASS(MapIsTransientIterator); | 336 | SERIALIZABLE_CLASS(MapOptionsIterator); |
3088 | 371 | 337 | ||
3091 | 372 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapIsTransientIterator, | 338 | SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapOptionsIterator, |
3092 | 373 | NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>); | 339 | NaryBaseIterator<MapOptionsIterator, PlanIteratorState>); |
3093 | 374 | 340 | ||
3094 | 375 | void serialize( ::zorba::serialization::Archiver& ar); | 341 | void serialize( ::zorba::serialization::Archiver& ar); |
3095 | 376 | 342 | ||
3097 | 377 | MapIsTransientIterator( | 343 | MapOptionsIterator( |
3098 | 378 | static_context* sctx, | 344 | static_context* sctx, |
3099 | 379 | const QueryLoc& loc, | 345 | const QueryLoc& loc, |
3100 | 380 | std::vector<PlanIter_t>& children) | 346 | std::vector<PlanIter_t>& children) |
3101 | 381 | : | 347 | : |
3103 | 382 | NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>(sctx, loc, children) | 348 | NaryBaseIterator<MapOptionsIterator, PlanIteratorState>(sctx, loc, children) |
3104 | 383 | {} | 349 | {} |
3105 | 384 | 350 | ||
3107 | 385 | virtual ~MapIsTransientIterator(); | 351 | virtual ~MapOptionsIterator(); |
3108 | 386 | 352 | ||
3109 | 387 | void accept(PlanIterVisitor& v) const; | 353 | void accept(PlanIterVisitor& v) const; |
3110 | 388 | 354 | ||
3111 | 389 | 355 | ||
3112 | === modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h' | |||
3113 | --- src/runtime/visitors/pregenerated/planiter_visitor.h 2013-08-16 13:00:06 +0000 | |||
3114 | +++ src/runtime/visitors/pregenerated/planiter_visitor.h 2013-09-02 20:59:05 +0000 | |||
3115 | @@ -663,15 +663,13 @@ | |||
3116 | 663 | 663 | ||
3117 | 664 | class MapCreateIterator; | 664 | class MapCreateIterator; |
3118 | 665 | 665 | ||
3122 | 666 | class MapCreateTransientIterator; | 666 | class MapDropIterator; |
3120 | 667 | |||
3121 | 668 | class MapDestroyIterator; | ||
3123 | 669 | 667 | ||
3124 | 670 | class MapGetIterator; | 668 | class MapGetIterator; |
3125 | 671 | 669 | ||
3126 | 672 | class MapInsertIterator; | 670 | class MapInsertIterator; |
3127 | 673 | 671 | ||
3129 | 674 | class MapRemoveIterator; | 672 | class MapDeleteIterator; |
3130 | 675 | 673 | ||
3131 | 676 | class MapKeysIterator; | 674 | class MapKeysIterator; |
3132 | 677 | 675 | ||
3133 | @@ -679,7 +677,7 @@ | |||
3134 | 679 | 677 | ||
3135 | 680 | class AvailableMapsIterator; | 678 | class AvailableMapsIterator; |
3136 | 681 | 679 | ||
3138 | 682 | class MapIsTransientIterator; | 680 | class MapOptionsIterator; |
3139 | 683 | 681 | ||
3140 | 684 | class CodepointsToStringIterator; | 682 | class CodepointsToStringIterator; |
3141 | 685 | 683 | ||
3142 | @@ -1700,11 +1698,8 @@ | |||
3143 | 1700 | virtual void beginVisit ( const MapCreateIterator& ) = 0; | 1698 | virtual void beginVisit ( const MapCreateIterator& ) = 0; |
3144 | 1701 | virtual void endVisit ( const MapCreateIterator& ) = 0; | 1699 | virtual void endVisit ( const MapCreateIterator& ) = 0; |
3145 | 1702 | 1700 | ||
3151 | 1703 | virtual void beginVisit ( const MapCreateTransientIterator& ) = 0; | 1701 | virtual void beginVisit ( const MapDropIterator& ) = 0; |
3152 | 1704 | virtual void endVisit ( const MapCreateTransientIterator& ) = 0; | 1702 | virtual void endVisit ( const MapDropIterator& ) = 0; |
3148 | 1705 | |||
3149 | 1706 | virtual void beginVisit ( const MapDestroyIterator& ) = 0; | ||
3150 | 1707 | virtual void endVisit ( const MapDestroyIterator& ) = 0; | ||
3153 | 1708 | 1703 | ||
3154 | 1709 | virtual void beginVisit ( const MapGetIterator& ) = 0; | 1704 | virtual void beginVisit ( const MapGetIterator& ) = 0; |
3155 | 1710 | virtual void endVisit ( const MapGetIterator& ) = 0; | 1705 | virtual void endVisit ( const MapGetIterator& ) = 0; |
3156 | @@ -1712,8 +1707,8 @@ | |||
3157 | 1712 | virtual void beginVisit ( const MapInsertIterator& ) = 0; | 1707 | virtual void beginVisit ( const MapInsertIterator& ) = 0; |
3158 | 1713 | virtual void endVisit ( const MapInsertIterator& ) = 0; | 1708 | virtual void endVisit ( const MapInsertIterator& ) = 0; |
3159 | 1714 | 1709 | ||
3162 | 1715 | virtual void beginVisit ( const MapRemoveIterator& ) = 0; | 1710 | virtual void beginVisit ( const MapDeleteIterator& ) = 0; |
3163 | 1716 | virtual void endVisit ( const MapRemoveIterator& ) = 0; | 1711 | virtual void endVisit ( const MapDeleteIterator& ) = 0; |
3164 | 1717 | 1712 | ||
3165 | 1718 | virtual void beginVisit ( const MapKeysIterator& ) = 0; | 1713 | virtual void beginVisit ( const MapKeysIterator& ) = 0; |
3166 | 1719 | virtual void endVisit ( const MapKeysIterator& ) = 0; | 1714 | virtual void endVisit ( const MapKeysIterator& ) = 0; |
3167 | @@ -1724,8 +1719,8 @@ | |||
3168 | 1724 | virtual void beginVisit ( const AvailableMapsIterator& ) = 0; | 1719 | virtual void beginVisit ( const AvailableMapsIterator& ) = 0; |
3169 | 1725 | virtual void endVisit ( const AvailableMapsIterator& ) = 0; | 1720 | virtual void endVisit ( const AvailableMapsIterator& ) = 0; |
3170 | 1726 | 1721 | ||
3173 | 1727 | virtual void beginVisit ( const MapIsTransientIterator& ) = 0; | 1722 | virtual void beginVisit ( const MapOptionsIterator& ) = 0; |
3174 | 1728 | virtual void endVisit ( const MapIsTransientIterator& ) = 0; | 1723 | virtual void endVisit ( const MapOptionsIterator& ) = 0; |
3175 | 1729 | 1724 | ||
3176 | 1730 | virtual void beginVisit ( const CodepointsToStringIterator& ) = 0; | 1725 | virtual void beginVisit ( const CodepointsToStringIterator& ) = 0; |
3177 | 1731 | virtual void endVisit ( const CodepointsToStringIterator& ) = 0; | 1726 | virtual void endVisit ( const CodepointsToStringIterator& ) = 0; |
3178 | 1732 | 1727 | ||
3179 | === modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp' | |||
3180 | --- src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-08-16 13:00:06 +0000 | |||
3181 | +++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2013-09-02 20:59:05 +0000 | |||
3182 | @@ -4307,32 +4307,18 @@ | |||
3183 | 4307 | // </MapCreateIterator> | 4307 | // </MapCreateIterator> |
3184 | 4308 | 4308 | ||
3185 | 4309 | 4309 | ||
3212 | 4310 | // <MapCreateTransientIterator> | 4310 | // <MapDropIterator> |
3213 | 4311 | void PrinterVisitor::beginVisit ( const MapCreateTransientIterator& a) { | 4311 | void PrinterVisitor::beginVisit ( const MapDropIterator& a) { |
3214 | 4312 | thePrinter.startBeginVisit("MapCreateTransientIterator", ++theId); | 4312 | thePrinter.startBeginVisit("MapDropIterator", ++theId); |
3215 | 4313 | printCommons( &a, theId ); | 4313 | printCommons( &a, theId ); |
3216 | 4314 | thePrinter.endBeginVisit( theId ); | 4314 | thePrinter.endBeginVisit( theId ); |
3217 | 4315 | } | 4315 | } |
3218 | 4316 | 4316 | ||
3219 | 4317 | void PrinterVisitor::endVisit ( const MapCreateTransientIterator& ) { | 4317 | void PrinterVisitor::endVisit ( const MapDropIterator& ) { |
3220 | 4318 | thePrinter.startEndVisit(); | 4318 | thePrinter.startEndVisit(); |
3221 | 4319 | thePrinter.endEndVisit(); | 4319 | thePrinter.endEndVisit(); |
3222 | 4320 | } | 4320 | } |
3223 | 4321 | // </MapCreateTransientIterator> | 4321 | // </MapDropIterator> |
3198 | 4322 | |||
3199 | 4323 | |||
3200 | 4324 | // <MapDestroyIterator> | ||
3201 | 4325 | void PrinterVisitor::beginVisit ( const MapDestroyIterator& a) { | ||
3202 | 4326 | thePrinter.startBeginVisit("MapDestroyIterator", ++theId); | ||
3203 | 4327 | printCommons( &a, theId ); | ||
3204 | 4328 | thePrinter.endBeginVisit( theId ); | ||
3205 | 4329 | } | ||
3206 | 4330 | |||
3207 | 4331 | void PrinterVisitor::endVisit ( const MapDestroyIterator& ) { | ||
3208 | 4332 | thePrinter.startEndVisit(); | ||
3209 | 4333 | thePrinter.endEndVisit(); | ||
3210 | 4334 | } | ||
3211 | 4335 | // </MapDestroyIterator> | ||
3224 | 4336 | 4322 | ||
3225 | 4337 | 4323 | ||
3226 | 4338 | // <MapGetIterator> | 4324 | // <MapGetIterator> |
3227 | @@ -4363,18 +4349,18 @@ | |||
3228 | 4363 | // </MapInsertIterator> | 4349 | // </MapInsertIterator> |
3229 | 4364 | 4350 | ||
3230 | 4365 | 4351 | ||
3234 | 4366 | // <MapRemoveIterator> | 4352 | // <MapDeleteIterator> |
3235 | 4367 | void PrinterVisitor::beginVisit ( const MapRemoveIterator& a) { | 4353 | void PrinterVisitor::beginVisit ( const MapDeleteIterator& a) { |
3236 | 4368 | thePrinter.startBeginVisit("MapRemoveIterator", ++theId); | 4354 | thePrinter.startBeginVisit("MapDeleteIterator", ++theId); |
3237 | 4369 | printCommons( &a, theId ); | 4355 | printCommons( &a, theId ); |
3238 | 4370 | thePrinter.endBeginVisit( theId ); | 4356 | thePrinter.endBeginVisit( theId ); |
3239 | 4371 | } | 4357 | } |
3240 | 4372 | 4358 | ||
3242 | 4373 | void PrinterVisitor::endVisit ( const MapRemoveIterator& ) { | 4359 | void PrinterVisitor::endVisit ( const MapDeleteIterator& ) { |
3243 | 4374 | thePrinter.startEndVisit(); | 4360 | thePrinter.startEndVisit(); |
3244 | 4375 | thePrinter.endEndVisit(); | 4361 | thePrinter.endEndVisit(); |
3245 | 4376 | } | 4362 | } |
3247 | 4377 | // </MapRemoveIterator> | 4363 | // </MapDeleteIterator> |
3248 | 4378 | 4364 | ||
3249 | 4379 | 4365 | ||
3250 | 4380 | // <MapKeysIterator> | 4366 | // <MapKeysIterator> |
3251 | @@ -4419,18 +4405,18 @@ | |||
3252 | 4419 | // </AvailableMapsIterator> | 4405 | // </AvailableMapsIterator> |
3253 | 4420 | 4406 | ||
3254 | 4421 | 4407 | ||
3258 | 4422 | // <MapIsTransientIterator> | 4408 | // <MapOptionsIterator> |
3259 | 4423 | void PrinterVisitor::beginVisit ( const MapIsTransientIterator& a) { | 4409 | void PrinterVisitor::beginVisit ( const MapOptionsIterator& a) { |
3260 | 4424 | thePrinter.startBeginVisit("MapIsTransientIterator", ++theId); | 4410 | thePrinter.startBeginVisit("MapOptionsIterator", ++theId); |
3261 | 4425 | printCommons( &a, theId ); | 4411 | printCommons( &a, theId ); |
3262 | 4426 | thePrinter.endBeginVisit( theId ); | 4412 | thePrinter.endBeginVisit( theId ); |
3263 | 4427 | } | 4413 | } |
3264 | 4428 | 4414 | ||
3266 | 4429 | void PrinterVisitor::endVisit ( const MapIsTransientIterator& ) { | 4415 | void PrinterVisitor::endVisit ( const MapOptionsIterator& ) { |
3267 | 4430 | thePrinter.startEndVisit(); | 4416 | thePrinter.startEndVisit(); |
3268 | 4431 | thePrinter.endEndVisit(); | 4417 | thePrinter.endEndVisit(); |
3269 | 4432 | } | 4418 | } |
3271 | 4433 | // </MapIsTransientIterator> | 4419 | // </MapOptionsIterator> |
3272 | 4434 | 4420 | ||
3273 | 4435 | 4421 | ||
3274 | 4436 | // <CodepointsToStringIterator> | 4422 | // <CodepointsToStringIterator> |
3275 | 4437 | 4423 | ||
3276 | === modified file 'src/runtime/visitors/pregenerated/printer_visitor.h' | |||
3277 | --- src/runtime/visitors/pregenerated/printer_visitor.h 2013-08-16 13:00:06 +0000 | |||
3278 | +++ src/runtime/visitors/pregenerated/printer_visitor.h 2013-09-02 20:59:05 +0000 | |||
3279 | @@ -1005,11 +1005,8 @@ | |||
3280 | 1005 | void beginVisit( const MapCreateIterator& ); | 1005 | void beginVisit( const MapCreateIterator& ); |
3281 | 1006 | void endVisit ( const MapCreateIterator& ); | 1006 | void endVisit ( const MapCreateIterator& ); |
3282 | 1007 | 1007 | ||
3288 | 1008 | void beginVisit( const MapCreateTransientIterator& ); | 1008 | void beginVisit( const MapDropIterator& ); |
3289 | 1009 | void endVisit ( const MapCreateTransientIterator& ); | 1009 | void endVisit ( const MapDropIterator& ); |
3285 | 1010 | |||
3286 | 1011 | void beginVisit( const MapDestroyIterator& ); | ||
3287 | 1012 | void endVisit ( const MapDestroyIterator& ); | ||
3290 | 1013 | 1010 | ||
3291 | 1014 | void beginVisit( const MapGetIterator& ); | 1011 | void beginVisit( const MapGetIterator& ); |
3292 | 1015 | void endVisit ( const MapGetIterator& ); | 1012 | void endVisit ( const MapGetIterator& ); |
3293 | @@ -1017,8 +1014,8 @@ | |||
3294 | 1017 | void beginVisit( const MapInsertIterator& ); | 1014 | void beginVisit( const MapInsertIterator& ); |
3295 | 1018 | void endVisit ( const MapInsertIterator& ); | 1015 | void endVisit ( const MapInsertIterator& ); |
3296 | 1019 | 1016 | ||
3299 | 1020 | void beginVisit( const MapRemoveIterator& ); | 1017 | void beginVisit( const MapDeleteIterator& ); |
3300 | 1021 | void endVisit ( const MapRemoveIterator& ); | 1018 | void endVisit ( const MapDeleteIterator& ); |
3301 | 1022 | 1019 | ||
3302 | 1023 | void beginVisit( const MapKeysIterator& ); | 1020 | void beginVisit( const MapKeysIterator& ); |
3303 | 1024 | void endVisit ( const MapKeysIterator& ); | 1021 | void endVisit ( const MapKeysIterator& ); |
3304 | @@ -1029,8 +1026,8 @@ | |||
3305 | 1029 | void beginVisit( const AvailableMapsIterator& ); | 1026 | void beginVisit( const AvailableMapsIterator& ); |
3306 | 1030 | void endVisit ( const AvailableMapsIterator& ); | 1027 | void endVisit ( const AvailableMapsIterator& ); |
3307 | 1031 | 1028 | ||
3310 | 1032 | void beginVisit( const MapIsTransientIterator& ); | 1029 | void beginVisit( const MapOptionsIterator& ); |
3311 | 1033 | void endVisit ( const MapIsTransientIterator& ); | 1030 | void endVisit ( const MapOptionsIterator& ); |
3312 | 1034 | 1031 | ||
3313 | 1035 | void beginVisit( const CodepointsToStringIterator& ); | 1032 | void beginVisit( const CodepointsToStringIterator& ); |
3314 | 1036 | void endVisit ( const CodepointsToStringIterator& ); | 1033 | void endVisit ( const CodepointsToStringIterator& ); |
3315 | 1037 | 1034 | ||
3316 | === modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter' | |||
3317 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter 2013-03-04 21:00:58 +0000 | |||
3318 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-c.iter 2013-09-02 20:59:05 +0000 | |||
3319 | @@ -25,16 +25,19 @@ | |||
3320 | 25 | 25 | ||
3321 | 26 | Iterator tree for main query: | 26 | Iterator tree for main query: |
3322 | 27 | <SequentialIterator> | 27 | <SequentialIterator> |
3324 | 28 | <CtxVarDeclareIterator varid="4" varname="co"> | 28 | <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT"> |
3325 | 29 | <SingletonIterator value="xs:string(persistent)"/> | ||
3326 | 30 | </CtxVarDeclareIterator> | ||
3327 | 31 | <CtxVarDeclareIterator varid="5" varname="co"> | ||
3328 | 29 | <SingletonIterator value="xs:integer(0)"/> | 32 | <SingletonIterator value="xs:integer(0)"/> |
3329 | 30 | </CtxVarDeclareIterator> | 33 | </CtxVarDeclareIterator> |
3332 | 31 | <CtxVarDeclareIterator varid="5" varname="map1"> | 34 | <CtxVarDeclareIterator varid="6" varname="map1"> |
3333 | 32 | <SingletonIterator value="xs:QName(,,map-co)"/> | 35 | <SingletonIterator value="xs:string(map-co)"/> |
3334 | 33 | </CtxVarDeclareIterator> | 36 | </CtxVarDeclareIterator> |
3336 | 34 | <CtxVarDeclareIterator varid="6" varname="str"> | 37 | <CtxVarDeclareIterator varid="7" varname="str"> |
3337 | 35 | <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/> | 38 | <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/> |
3338 | 36 | </CtxVarDeclareIterator> | 39 | </CtxVarDeclareIterator> |
3340 | 37 | <CtxVarDeclareIterator varid="7" varname="input"> | 40 | <CtxVarDeclareIterator varid="8" varname="input"> |
3341 | 38 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> | 41 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3342 | 39 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> | 42 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3343 | 40 | <FnDocIterator> | 43 | <FnDocIterator> |
3344 | @@ -46,25 +49,25 @@ | |||
3345 | 46 | <SequentialIterator> | 49 | <SequentialIterator> |
3346 | 47 | <ApplyIterator> | 50 | <ApplyIterator> |
3347 | 48 | <MapCreateIterator> | 51 | <MapCreateIterator> |
3350 | 49 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 52 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3351 | 50 | <CtxVarIterator varid="6" varname="str" varkind="global"/> | 53 | <CtxVarIterator varid="7" varname="str" varkind="global"/> |
3352 | 51 | </MapCreateIterator> | 54 | </MapCreateIterator> |
3353 | 52 | </ApplyIterator> | 55 | </ApplyIterator> |
3355 | 53 | <CtxVarDeclareIterator varid="8" varname="DG"> | 56 | <CtxVarDeclareIterator varid="9" varname="DG"> |
3356 | 54 | <UDFunctionCallIterator function="local:collapseNodesSameName"> | 57 | <UDFunctionCallIterator function="local:collapseNodesSameName"> |
3357 | 55 | <TreatIterator quant="+"> | 58 | <TreatIterator quant="+"> |
3359 | 56 | <CtxVarIterator varid="7" varname="input" varkind="global"/> | 59 | <CtxVarIterator varid="8" varname="input" varkind="global"/> |
3360 | 57 | </TreatIterator> | 60 | </TreatIterator> |
3361 | 58 | <SingletonIterator value="xs:boolean(true)"/> | 61 | <SingletonIterator value="xs:boolean(true)"/> |
3362 | 59 | <SingletonIterator value="xs:string()"/> | 62 | <SingletonIterator value="xs:string()"/> |
3363 | 60 | </UDFunctionCallIterator> | 63 | </UDFunctionCallIterator> |
3364 | 61 | </CtxVarDeclareIterator> | 64 | </CtxVarDeclareIterator> |
3365 | 62 | <ApplyIterator> | 65 | <ApplyIterator> |
3369 | 63 | <MapDestroyIterator> | 66 | <MapDropIterator> |
3370 | 64 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 67 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3371 | 65 | </MapDestroyIterator> | 68 | </MapDropIterator> |
3372 | 66 | </ApplyIterator> | 69 | </ApplyIterator> |
3374 | 67 | <CtxVarIterator varid="8" varname="DG" varkind="local"/> | 70 | <CtxVarIterator varid="9" varname="DG" varkind="local"/> |
3375 | 68 | </SequentialIterator> | 71 | </SequentialIterator> |
3376 | 69 | </SequentialIterator> | 72 | </SequentialIterator> |
3377 | 70 | 73 | ||
3378 | @@ -183,12 +186,10 @@ | |||
3379 | 183 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> | 186 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3380 | 184 | <TreatIterator type="xs:integer" quant="?"> | 187 | <TreatIterator type="xs:integer" quant="?"> |
3381 | 185 | <MapGetIterator> | 188 | <MapGetIterator> |
3388 | 186 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 189 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3389 | 187 | <PromoteIterator type="xs:anyAtomicType"> | 190 | <TreatIterator quant=""> |
3390 | 188 | <FnDataIterator> | 191 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3391 | 189 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> | 192 | </TreatIterator> |
3386 | 190 | </FnDataIterator> | ||
3387 | 191 | </PromoteIterator> | ||
3392 | 192 | </MapGetIterator> | 193 | </MapGetIterator> |
3393 | 193 | </TreatIterator> | 194 | </TreatIterator> |
3394 | 194 | </CtxVarAssignIterator> | 195 | </CtxVarAssignIterator> |
3395 | @@ -197,24 +198,22 @@ | |||
3396 | 197 | <CtxVarIterator varid="1" varname="label" varkind="local"/> | 198 | <CtxVarIterator varid="1" varname="label" varkind="local"/> |
3397 | 198 | </FnEmptyIterator> | 199 | </FnEmptyIterator> |
3398 | 199 | <SequentialIterator> | 200 | <SequentialIterator> |
3400 | 200 | <CtxVarAssignIterator varid="4" varname="co" varkind="global"> | 201 | <CtxVarAssignIterator varid="5" varname="co" varkind="global"> |
3401 | 201 | <SpecificNumArithIterator_AddOperation_INTEGER> | 202 | <SpecificNumArithIterator_AddOperation_INTEGER> |
3403 | 202 | <CtxVarIterator varid="4" varname="co" varkind="global"/> | 203 | <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3404 | 203 | <SingletonIterator value="xs:integer(1)"/> | 204 | <SingletonIterator value="xs:integer(1)"/> |
3405 | 204 | </SpecificNumArithIterator_AddOperation_INTEGER> | 205 | </SpecificNumArithIterator_AddOperation_INTEGER> |
3406 | 205 | </CtxVarAssignIterator> | 206 | </CtxVarAssignIterator> |
3407 | 206 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> | 207 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3409 | 207 | <CtxVarIterator varid="4" varname="co" varkind="global"/> | 208 | <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3410 | 208 | </CtxVarAssignIterator> | 209 | </CtxVarAssignIterator> |
3411 | 209 | <ApplyIterator> | 210 | <ApplyIterator> |
3412 | 210 | <MapInsertIterator> | 211 | <MapInsertIterator> |
3420 | 211 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 212 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3421 | 212 | <CtxVarIterator varid="4" varname="co" varkind="global"/> | 213 | <TreatIterator quant=""> |
3422 | 213 | <PromoteIterator type="xs:anyAtomicType"> | 214 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3423 | 214 | <FnDataIterator> | 215 | </TreatIterator> |
3424 | 215 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> | 216 | <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3418 | 216 | </FnDataIterator> | ||
3419 | 217 | </PromoteIterator> | ||
3425 | 218 | </MapInsertIterator> | 217 | </MapInsertIterator> |
3426 | 219 | </ApplyIterator> | 218 | </ApplyIterator> |
3427 | 220 | </SequentialIterator> | 219 | </SequentialIterator> |
3428 | 221 | 220 | ||
3429 | === modified file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter' | |||
3430 | --- test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter 2013-03-04 21:00:58 +0000 | |||
3431 | +++ test/rbkt/ExpCompilerResults/IterPlan/zorba/no-copy/dataguide-nc.iter 2013-09-02 20:59:05 +0000 | |||
3432 | @@ -25,16 +25,19 @@ | |||
3433 | 25 | 25 | ||
3434 | 26 | Iterator tree for main query: | 26 | Iterator tree for main query: |
3435 | 27 | <SequentialIterator> | 27 | <SequentialIterator> |
3437 | 28 | <CtxVarDeclareIterator varid="4" varname="co"> | 28 | <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT"> |
3438 | 29 | <SingletonIterator value="xs:string(persistent)"/> | ||
3439 | 30 | </CtxVarDeclareIterator> | ||
3440 | 31 | <CtxVarDeclareIterator varid="5" varname="co"> | ||
3441 | 29 | <SingletonIterator value="xs:integer(0)"/> | 32 | <SingletonIterator value="xs:integer(0)"/> |
3442 | 30 | </CtxVarDeclareIterator> | 33 | </CtxVarDeclareIterator> |
3445 | 31 | <CtxVarDeclareIterator varid="5" varname="map1"> | 34 | <CtxVarDeclareIterator varid="6" varname="map1"> |
3446 | 32 | <SingletonIterator value="xs:QName(,,map-co)"/> | 35 | <SingletonIterator value="xs:string(map-co)"/> |
3447 | 33 | </CtxVarDeclareIterator> | 36 | </CtxVarDeclareIterator> |
3449 | 34 | <CtxVarDeclareIterator varid="6" varname="str"> | 37 | <CtxVarDeclareIterator varid="7" varname="str"> |
3450 | 35 | <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/> | 38 | <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/> |
3451 | 36 | </CtxVarDeclareIterator> | 39 | </CtxVarDeclareIterator> |
3453 | 37 | <CtxVarDeclareIterator varid="7" varname="input"> | 40 | <CtxVarDeclareIterator varid="8" varname="input"> |
3454 | 38 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> | 41 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3455 | 39 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> | 42 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3456 | 40 | <FnDocIterator> | 43 | <FnDocIterator> |
3457 | @@ -46,25 +49,25 @@ | |||
3458 | 46 | <SequentialIterator> | 49 | <SequentialIterator> |
3459 | 47 | <ApplyIterator> | 50 | <ApplyIterator> |
3460 | 48 | <MapCreateIterator> | 51 | <MapCreateIterator> |
3463 | 49 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 52 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3464 | 50 | <CtxVarIterator varid="6" varname="str" varkind="global"/> | 53 | <CtxVarIterator varid="7" varname="str" varkind="global"/> |
3465 | 51 | </MapCreateIterator> | 54 | </MapCreateIterator> |
3466 | 52 | </ApplyIterator> | 55 | </ApplyIterator> |
3468 | 53 | <CtxVarDeclareIterator varid="8" varname="DG"> | 56 | <CtxVarDeclareIterator varid="9" varname="DG"> |
3469 | 54 | <UDFunctionCallIterator function="local:collapseNodesSameName"> | 57 | <UDFunctionCallIterator function="local:collapseNodesSameName"> |
3470 | 55 | <TreatIterator quant="+"> | 58 | <TreatIterator quant="+"> |
3472 | 56 | <CtxVarIterator varid="7" varname="input" varkind="global"/> | 59 | <CtxVarIterator varid="8" varname="input" varkind="global"/> |
3473 | 57 | </TreatIterator> | 60 | </TreatIterator> |
3474 | 58 | <SingletonIterator value="xs:boolean(true)"/> | 61 | <SingletonIterator value="xs:boolean(true)"/> |
3475 | 59 | <SingletonIterator value="xs:string()"/> | 62 | <SingletonIterator value="xs:string()"/> |
3476 | 60 | </UDFunctionCallIterator> | 63 | </UDFunctionCallIterator> |
3477 | 61 | </CtxVarDeclareIterator> | 64 | </CtxVarDeclareIterator> |
3478 | 62 | <ApplyIterator> | 65 | <ApplyIterator> |
3482 | 63 | <MapDestroyIterator> | 66 | <MapDropIterator> |
3483 | 64 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 67 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3484 | 65 | </MapDestroyIterator> | 68 | </MapDropIterator> |
3485 | 66 | </ApplyIterator> | 69 | </ApplyIterator> |
3487 | 67 | <CtxVarIterator varid="8" varname="DG" varkind="local"/> | 70 | <CtxVarIterator varid="9" varname="DG" varkind="local"/> |
3488 | 68 | </SequentialIterator> | 71 | </SequentialIterator> |
3489 | 69 | </SequentialIterator> | 72 | </SequentialIterator> |
3490 | 70 | 73 | ||
3491 | @@ -183,12 +186,10 @@ | |||
3492 | 183 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> | 186 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3493 | 184 | <TreatIterator type="xs:integer" quant="?"> | 187 | <TreatIterator type="xs:integer" quant="?"> |
3494 | 185 | <MapGetIterator> | 188 | <MapGetIterator> |
3501 | 186 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 189 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3502 | 187 | <PromoteIterator type="xs:anyAtomicType"> | 190 | <TreatIterator quant=""> |
3503 | 188 | <FnDataIterator> | 191 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3504 | 189 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> | 192 | </TreatIterator> |
3499 | 190 | </FnDataIterator> | ||
3500 | 191 | </PromoteIterator> | ||
3505 | 192 | </MapGetIterator> | 193 | </MapGetIterator> |
3506 | 193 | </TreatIterator> | 194 | </TreatIterator> |
3507 | 194 | </CtxVarAssignIterator> | 195 | </CtxVarAssignIterator> |
3508 | @@ -197,24 +198,22 @@ | |||
3509 | 197 | <CtxVarIterator varid="1" varname="label" varkind="local"/> | 198 | <CtxVarIterator varid="1" varname="label" varkind="local"/> |
3510 | 198 | </FnEmptyIterator> | 199 | </FnEmptyIterator> |
3511 | 199 | <SequentialIterator> | 200 | <SequentialIterator> |
3513 | 200 | <CtxVarAssignIterator varid="4" varname="co" varkind="global"> | 201 | <CtxVarAssignIterator varid="5" varname="co" varkind="global"> |
3514 | 201 | <SpecificNumArithIterator_AddOperation_INTEGER> | 202 | <SpecificNumArithIterator_AddOperation_INTEGER> |
3516 | 202 | <CtxVarIterator varid="4" varname="co" varkind="global"/> | 203 | <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3517 | 203 | <SingletonIterator value="xs:integer(1)"/> | 204 | <SingletonIterator value="xs:integer(1)"/> |
3518 | 204 | </SpecificNumArithIterator_AddOperation_INTEGER> | 205 | </SpecificNumArithIterator_AddOperation_INTEGER> |
3519 | 205 | </CtxVarAssignIterator> | 206 | </CtxVarAssignIterator> |
3520 | 206 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> | 207 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3522 | 207 | <CtxVarIterator varid="4" varname="co" varkind="global"/> | 208 | <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3523 | 208 | </CtxVarAssignIterator> | 209 | </CtxVarAssignIterator> |
3524 | 209 | <ApplyIterator> | 210 | <ApplyIterator> |
3525 | 210 | <MapInsertIterator> | 211 | <MapInsertIterator> |
3533 | 211 | <CtxVarIterator varid="5" varname="map1" varkind="global"/> | 212 | <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3534 | 212 | <CtxVarIterator varid="4" varname="co" varkind="global"/> | 213 | <TreatIterator quant=""> |
3535 | 213 | <PromoteIterator type="xs:anyAtomicType"> | 214 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3536 | 214 | <FnDataIterator> | 215 | </TreatIterator> |
3537 | 215 | <CtxVarIterator varid="4" varname="s2" varkind="local"/> | 216 | <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3531 | 216 | </FnDataIterator> | ||
3532 | 217 | </PromoteIterator> | ||
3538 | 218 | </MapInsertIterator> | 217 | </MapInsertIterator> |
3539 | 219 | </ApplyIterator> | 218 | </ApplyIterator> |
3540 | 220 | </SequentialIterator> | 219 | </SequentialIterator> |
3541 | 221 | 220 | ||
3542 | === added file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res' | |||
3543 | --- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res 1970-01-01 00:00:00 +0000 | |||
3544 | +++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-1.xml.res 2013-09-02 20:59:05 +0000 | |||
3545 | @@ -0,0 +1,1 @@ | |||
3546 | 1 | 1 | ||
3547 | 0 | 2 | ||
3548 | === added file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res' | |||
3549 | --- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res 1970-01-01 00:00:00 +0000 | |||
3550 | +++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map-eval-4.xml.res 2013-09-02 20:59:05 +0000 | |||
3551 | @@ -0,0 +1,1 @@ | |||
3552 | 1 | map | ||
3553 | 0 | 2 | ||
3554 | === modified file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res' | |||
3555 | --- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res 2013-02-07 17:24:36 +0000 | |||
3556 | +++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map3.xml.res 2013-09-02 20:59:05 +0000 | |||
3557 | @@ -1,1 +1,1 @@ | |||
3559 | 1 | <key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"><attribute value="key0"/><attribute value="1"/></key> | 1 | [ "key0", 1 ] |
3560 | 2 | 2 | ||
3561 | === modified file 'test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res' | |||
3562 | --- test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res 2012-06-22 23:36:41 +0000 | |||
3563 | +++ test/rbkt/ExpQueryResults/zorba/store/unordered-map/map7.xml.res 2013-09-02 20:59:05 +0000 | |||
3564 | @@ -1,1 +1,1 @@ | |||
3566 | 1 | true true 1 key1 value1 true false 3 true true 5 key5 value5 false true key2 false true key4 false false | 1 | true true 1 key1 value1 true true 2 key2 value2 true true 3 key3 value3 true true 4 key4 value4 true true 5 key5 value5 true true 6 key6 value6 |
3567 | 2 | 2 | ||
3568 | === modified file 'test/rbkt/Queries/zorba/no-copy/dataguide-c.xq' | |||
3569 | --- test/rbkt/Queries/zorba/no-copy/dataguide-c.xq 2013-08-16 07:00:06 +0000 | |||
3570 | +++ test/rbkt/Queries/zorba/no-copy/dataguide-c.xq 2013-09-02 20:59:05 +0000 | |||
3571 | @@ -1,11 +1,10 @@ | |||
3574 | 1 | import module namespace map = | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3573 | 2 | "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | ||
3575 | 3 | 2 | ||
3576 | 4 | declare namespace ann = "http://zorba.io/annotations"; | 3 | declare namespace ann = "http://zorba.io/annotations"; |
3577 | 5 | 4 | ||
3578 | 6 | declare %ann:assignable variable $co as xs:integer :=0; | 5 | declare %ann:assignable variable $co as xs:integer :=0; |
3579 | 7 | 6 | ||
3581 | 8 | declare variable $map1 :=xs:QName("map-co"); | 7 | declare variable $map1 := "map-co"; |
3582 | 9 | 8 | ||
3583 | 10 | declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string"); | 9 | declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string"); |
3584 | 11 | 10 | ||
3585 | @@ -58,7 +57,7 @@ | |||
3586 | 58 | { | 57 | { |
3587 | 59 | $co := $co +1; | 58 | $co := $co +1; |
3588 | 60 | $label := $co; | 59 | $label := $co; |
3590 | 61 | map:insert($map1, $co, $s2); | 60 | map:insert($map1, $s2, $co); |
3591 | 62 | } | 61 | } |
3592 | 63 | else | 62 | else |
3593 | 64 | { | 63 | { |
3594 | @@ -80,6 +79,6 @@ | |||
3595 | 80 | 79 | ||
3596 | 81 | variable $DG := local:collapseNodesSameName($input, true(), ""); | 80 | variable $DG := local:collapseNodesSameName($input, true(), ""); |
3597 | 82 | 81 | ||
3599 | 83 | map:delete($map1); | 82 | map:drop($map1); |
3600 | 84 | 83 | ||
3601 | 85 | $DG | 84 | $DG |
3602 | 86 | 85 | ||
3603 | === modified file 'test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq' | |||
3604 | --- test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq 2013-08-09 08:27:30 +0000 | |||
3605 | +++ test/rbkt/Queries/zorba/no-copy/dataguide-nc.xq 2013-09-02 20:59:05 +0000 | |||
3606 | @@ -1,5 +1,4 @@ | |||
3609 | 1 | import module namespace map = | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3608 | 2 | "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | ||
3610 | 3 | 2 | ||
3611 | 4 | declare namespace ann = "http://zorba.io/annotations"; | 3 | declare namespace ann = "http://zorba.io/annotations"; |
3612 | 5 | 4 | ||
3613 | @@ -9,7 +8,7 @@ | |||
3614 | 9 | 8 | ||
3615 | 10 | declare %ann:assignable variable $co as xs:integer :=0; | 9 | declare %ann:assignable variable $co as xs:integer :=0; |
3616 | 11 | 10 | ||
3618 | 12 | declare variable $map1 :=xs:QName("map-co"); | 11 | declare variable $map1 := "map-co"; |
3619 | 13 | 12 | ||
3620 | 14 | declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string"); | 13 | declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string"); |
3621 | 15 | 14 | ||
3622 | @@ -62,7 +61,7 @@ | |||
3623 | 62 | { | 61 | { |
3624 | 63 | $co := $co +1; | 62 | $co := $co +1; |
3625 | 64 | $label := $co; | 63 | $label := $co; |
3627 | 65 | map:insert($map1, $co, $s2); | 64 | map:insert($map1, $s2, $co); |
3628 | 66 | } | 65 | } |
3629 | 67 | else | 66 | else |
3630 | 68 | { | 67 | { |
3631 | @@ -82,10 +81,10 @@ | |||
3632 | 82 | }; | 81 | }; |
3633 | 83 | 82 | ||
3634 | 84 | 83 | ||
3636 | 85 | map:create($map1,$str) ; | 84 | map:create($map1, $str); |
3637 | 86 | 85 | ||
3638 | 87 | variable $DG := local:collapseNodesSameName($input, true(), ""); | 86 | variable $DG := local:collapseNodesSameName($input, true(), ""); |
3639 | 88 | 87 | ||
3641 | 89 | map:delete($map1); | 88 | map:drop($map1); |
3642 | 90 | 89 | ||
3643 | 91 | $DG | 90 | $DG |
3644 | 92 | 91 | ||
3645 | === modified file 'test/rbkt/Queries/zorba/reference/reference_3.xq' | |||
3646 | --- test/rbkt/Queries/zorba/reference/reference_3.xq 2013-07-24 08:12:12 +0000 | |||
3647 | +++ test/rbkt/Queries/zorba/reference/reference_3.xq 2013-09-02 20:59:05 +0000 | |||
3648 | @@ -1,14 +1,14 @@ | |||
3649 | 1 | import module namespace idd = "http://zorba.io/reference" at "reference.xqlib"; | 1 | import module namespace idd = "http://zorba.io/reference" at "reference.xqlib"; |
3650 | 2 | import module namespace id = "http://zorba.io/modules/reference"; | 2 | import module namespace id = "http://zorba.io/modules/reference"; |
3651 | 3 | import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents"; | 3 | import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents"; |
3653 | 4 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 4 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3654 | 5 | 5 | ||
3655 | 6 | variable $node:=<root>global</root>; | 6 | variable $node:=<root>global</root>; |
3656 | 7 | variable $x := <a>1</a>; | 7 | variable $x := <a>1</a>; |
3657 | 8 | fn:put(<root>doc</root>,"doc"); | 8 | fn:put(<root>doc</root>,"doc"); |
3658 | 9 | 9 | ||
3661 | 10 | map:create(xs:QName("local:bar"), xs:QName("xs:integer")); | 10 | map:create("bar", xs:QName("xs:integer")); |
3662 | 11 | map:insert(xs:QName("local:bar"), id:reference($x), 1); | 11 | map:insert("bar", 1, id:reference($x)); |
3663 | 12 | 12 | ||
3664 | 13 | 13 | ||
3665 | 14 | 14 | ||
3666 | @@ -28,6 +28,6 @@ | |||
3667 | 28 | }</temporary-variable-in-scope> | 28 | }</temporary-variable-in-scope> |
3668 | 29 | <temporary-variable-in-scope>{variable $temp:=<root>temp</root>; id:dereference(id:reference($temp))}</temporary-variable-in-scope> | 29 | <temporary-variable-in-scope>{variable $temp:=<root>temp</root>; id:dereference(id:reference($temp))}</temporary-variable-in-scope> |
3669 | 30 | <in-map> | 30 | <in-map> |
3671 | 31 | {id:dereference(map:get(xs:QName("local:bar"), 1))} | 31 | {id:dereference(map:get("bar", 1))} |
3672 | 32 | </in-map> | 32 | </in-map> |
3673 | 33 | </result> | ||
3674 | 34 | \ No newline at end of file | 33 | \ No newline at end of file |
3675 | 34 | </result> | ||
3676 | 35 | 35 | ||
3677 | === modified file 'test/rbkt/Queries/zorba/scripting/flwor15.xq' | |||
3678 | --- test/rbkt/Queries/zorba/scripting/flwor15.xq 2013-08-09 08:27:30 +0000 | |||
3679 | +++ test/rbkt/Queries/zorba/scripting/flwor15.xq 2013-09-02 20:59:05 +0000 | |||
3680 | @@ -1,11 +1,8 @@ | |||
3684 | 1 | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; | |
3682 | 2 | |||
3683 | 3 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | ||
3685 | 4 | 2 | ||
3686 | 5 | declare namespace ann = "http://zorba.io/annotations"; | 3 | declare namespace ann = "http://zorba.io/annotations"; |
3687 | 6 | 4 | ||
3690 | 7 | declare variable $local:processed-internal-links as xs:QName := | 5 | declare variable $local:processed-internal-links as xs:string := "processed-internal-links"; |
3689 | 8 | xs:QName("processed-internal-links"); | ||
3691 | 9 | 6 | ||
3692 | 10 | 7 | ||
3693 | 11 | declare variable $result := (); | 8 | declare variable $result := (); |
3694 | 12 | 9 | ||
3695 | === modified file 'test/rbkt/Queries/zorba/scripting/nonsequential3.xq' | |||
3696 | --- test/rbkt/Queries/zorba/scripting/nonsequential3.xq 2013-08-09 08:27:30 +0000 | |||
3697 | +++ test/rbkt/Queries/zorba/scripting/nonsequential3.xq 2013-09-02 20:59:05 +0000 | |||
3698 | @@ -1,10 +1,10 @@ | |||
3700 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3701 | 2 | 2 | ||
3702 | 3 | declare namespace ann = "http://zorba.io/annotations"; | 3 | declare namespace ann = "http://zorba.io/annotations"; |
3703 | 4 | 4 | ||
3704 | 5 | declare %ann:nonsequential function local:foo() | 5 | declare %ann:nonsequential function local:foo() |
3705 | 6 | { | 6 | { |
3707 | 7 | map:create(xs:QName("local:mymap"), xs:QName("xs:integer")); | 7 | map:create("mymap", xs:QName("xs:integer")); |
3708 | 8 | }; | 8 | }; |
3709 | 9 | 9 | ||
3710 | 10 | local:foo() | 10 | local:foo() |
3711 | 11 | 11 | ||
3712 | === modified file 'test/rbkt/Queries/zorba/scripting/udf1.xq' | |||
3713 | --- test/rbkt/Queries/zorba/scripting/udf1.xq 2013-08-09 08:27:30 +0000 | |||
3714 | +++ test/rbkt/Queries/zorba/scripting/udf1.xq 2013-09-02 20:59:05 +0000 | |||
3715 | @@ -1,5 +1,4 @@ | |||
3718 | 1 | import module namespace x = | 1 | import module namespace x = "http://zorba.io/modules/unordered-maps"; |
3717 | 2 | "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | ||
3719 | 3 | 2 | ||
3720 | 4 | declare namespace ann = "http://zorba.io/annotations"; | 3 | declare namespace ann = "http://zorba.io/annotations"; |
3721 | 5 | 4 | ||
3722 | @@ -9,7 +8,7 @@ | |||
3723 | 9 | then | 8 | then |
3724 | 10 | { | 9 | { |
3725 | 11 | variable $req := <a/>; | 10 | variable $req := <a/>; |
3727 | 12 | variable $result := x:create(fn:QName("http://www.zorba-xquery.com/map", "first"), | 11 | variable $result := x:create("first", |
3728 | 13 | fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")); | 12 | fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")); |
3729 | 14 | 13 | ||
3730 | 15 | $result | 14 | $result |
3731 | 16 | 15 | ||
3732 | === added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq' | |||
3733 | --- test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq 1970-01-01 00:00:00 +0000 | |||
3734 | +++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-1.xq 2013-09-02 20:59:05 +0000 | |||
3735 | @@ -0,0 +1,6 @@ | |||
3736 | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; | ||
3737 | 2 | import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; | ||
3738 | 3 | |||
3739 | 4 | map:create("map", xs:QName("xs:string"),{ "persistent": false() }); | ||
3740 | 5 | map:insert("map", "test", 1); | ||
3741 | 6 | reflection:eval('map:get("map", "test")') | ||
3742 | 0 | 7 | ||
3743 | === added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec' | |||
3744 | --- test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec 1970-01-01 00:00:00 +0000 | |||
3745 | +++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.spec 2013-09-02 20:59:05 +0000 | |||
3746 | @@ -0,0 +1,2 @@ | |||
3747 | 1 | Error: http://zorba.io/errors:ZDDY0023 | ||
3748 | 2 | |||
3749 | 0 | 3 | ||
3750 | === added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq' | |||
3751 | --- test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq 1970-01-01 00:00:00 +0000 | |||
3752 | +++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-2.xq 2013-09-02 20:59:05 +0000 | |||
3753 | @@ -0,0 +1,6 @@ | |||
3754 | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; | ||
3755 | 2 | import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; | ||
3756 | 3 | |||
3757 | 4 | map:create("map", xs:QName("xs:string"),{ "persistent": false() }); | ||
3758 | 5 | map:insert("map", "test", 1); | ||
3759 | 6 | reflection:eval-s('map:drop("map")') | ||
3760 | 0 | 7 | ||
3761 | === added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec' | |||
3762 | --- test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec 1970-01-01 00:00:00 +0000 | |||
3763 | +++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.spec 2013-09-02 20:59:05 +0000 | |||
3764 | @@ -0,0 +1,1 @@ | |||
3765 | 1 | Error: http://zorba.io/errors:ZSTR0001 | ||
3766 | 0 | 2 | ||
3767 | === added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq' | |||
3768 | --- test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq 1970-01-01 00:00:00 +0000 | |||
3769 | +++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-3.xq 2013-09-02 20:59:05 +0000 | |||
3770 | @@ -0,0 +1,6 @@ | |||
3771 | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; | ||
3772 | 2 | import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; | ||
3773 | 3 | |||
3774 | 4 | map:create("map", xs:QName("xs:string"),{ "persistent": false() }); | ||
3775 | 5 | map:insert("map", "test", 1); | ||
3776 | 6 | reflection:eval-s('map:create("map", xs:QName("xs:string"))') | ||
3777 | 0 | 7 | ||
3778 | === added file 'test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq' | |||
3779 | --- test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq 1970-01-01 00:00:00 +0000 | |||
3780 | +++ test/rbkt/Queries/zorba/store/unordered-map/map-eval-4.xq 2013-09-02 20:59:05 +0000 | |||
3781 | @@ -0,0 +1,6 @@ | |||
3782 | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; | ||
3783 | 2 | import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; | ||
3784 | 3 | |||
3785 | 4 | map:create("map", xs:QName("xs:string"),{ "persistent": false() }); | ||
3786 | 5 | reflection:eval('map:available-maps()') | ||
3787 | 6 | |||
3788 | 0 | 7 | ||
3789 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map0.xq' | |||
3790 | --- test/rbkt/Queries/zorba/store/unordered-map/map0.xq 2013-02-07 17:24:36 +0000 | |||
3791 | +++ test/rbkt/Queries/zorba/store/unordered-map/map0.xq 2013-09-02 20:59:05 +0000 | |||
3792 | @@ -1,16 +1,13 @@ | |||
3809 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3810 | 2 | 2 | ||
3811 | 3 | 3 | ||
3812 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | { |
3813 | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 5 | map:create("first", "integer"); |
3814 | 6 | return | 6 | |
3815 | 7 | { | 7 | ( |
3816 | 8 | map:create($name, $type); | 8 | for $i in 1 to 1000 |
3817 | 9 | 9 | return map:insert("first", $i, concat("value", $i)) | |
3818 | 10 | ( | 10 | ); |
3819 | 11 | for $i in 1 to 1000 | 11 | |
3820 | 12 | return map:insert($name, concat("value", $i), $i) | 12 | count(map:keys("first")) = map:size("first") |
3821 | 13 | ); | 13 | } |
3806 | 14 | |||
3807 | 15 | count(map:keys($name)) = map:size($name) | ||
3808 | 16 | } | ||
3822 | 17 | 14 | ||
3823 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map1.xq' | |||
3824 | --- test/rbkt/Queries/zorba/store/unordered-map/map1.xq 2013-02-07 17:24:36 +0000 | |||
3825 | +++ test/rbkt/Queries/zorba/store/unordered-map/map1.xq 2013-09-02 20:59:05 +0000 | |||
3826 | @@ -1,15 +1,15 @@ | |||
3832 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3833 | 2 | 2 | ||
3834 | 3 | 3 | ||
3835 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | let $name := "first" |
3836 | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 5 | let $type := "integer" |
3837 | 6 | return | 6 | return |
3838 | 7 | { | 7 | { |
3839 | 8 | map:create($name, $type); | 8 | map:create($name, $type); |
3840 | 9 | 9 | ||
3841 | 10 | ( | 10 | ( |
3842 | 11 | for $i in 1 to 1000 | 11 | for $i in 1 to 1000 |
3844 | 12 | return map:insert($name, concat("value", $i), $i) | 12 | return map:insert($name, $i, concat("value", $i)) |
3845 | 13 | ); | 13 | ); |
3846 | 14 | 14 | ||
3847 | 15 | map:get($name, 423) | 15 | map:get($name, 423) |
3848 | 16 | 16 | ||
3849 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map2.xq' | |||
3850 | --- test/rbkt/Queries/zorba/store/unordered-map/map2.xq 2013-02-07 17:24:36 +0000 | |||
3851 | +++ test/rbkt/Queries/zorba/store/unordered-map/map2.xq 2013-09-02 20:59:05 +0000 | |||
3852 | @@ -1,21 +1,21 @@ | |||
3858 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3859 | 2 | 2 | ||
3860 | 3 | 3 | ||
3861 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | let $name := "first" |
3862 | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 5 | let $type := "integer" |
3863 | 6 | return | 6 | return |
3864 | 7 | { | 7 | { |
3865 | 8 | variable $foo; | 8 | variable $foo; |
3866 | 9 | 9 | ||
3867 | 10 | map:create($name, $type); | 10 | map:create($name, $type); |
3868 | 11 | 11 | ||
3872 | 12 | map:insert($name, "value1", 1); | 12 | map:insert($name, 1, "value1"); |
3873 | 13 | map:insert($name, "value2", 1); | 13 | map:insert($name, 1, "value2"); |
3874 | 14 | map:insert($name, "value3", 2); | 14 | map:insert($name, 2, "value3"); |
3875 | 15 | 15 | ||
3876 | 16 | $foo := map:get($name, 1); | 16 | $foo := map:get($name, 1); |
3877 | 17 | 17 | ||
3879 | 18 | map:remove($name, 1); | 18 | map:delete($name, 1); |
3880 | 19 | 19 | ||
3881 | 20 | $foo := ($foo, map:get($name, 1), map:size($name), map:available-maps()); | 20 | $foo := ($foo, map:get($name, 1), map:size($name), map:available-maps()); |
3882 | 21 | 21 | ||
3883 | 22 | 22 | ||
3884 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map3.xq' | |||
3885 | --- test/rbkt/Queries/zorba/store/unordered-map/map3.xq 2013-02-07 17:24:36 +0000 | |||
3886 | +++ test/rbkt/Queries/zorba/store/unordered-map/map3.xq 2013-09-02 20:59:05 +0000 | |||
3887 | @@ -1,16 +1,16 @@ | |||
3894 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3895 | 2 | 2 | ||
3896 | 3 | 3 | ||
3897 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | let $name := "first" |
3898 | 5 | let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:anyAtomicType") | 5 | let $type1 := "string" |
3899 | 6 | let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 6 | let $type2 := "integer" |
3900 | 7 | return | 7 | return |
3901 | 8 | { | 8 | { |
3907 | 9 | map:create($name, $type1, $type2); | 9 | map:create($name, [ $type1, $type2]); |
3908 | 10 | 10 | ||
3909 | 11 | map:insert($name, "value", "key0", 1); | 11 | map:insert($name, ["key0", 1], "value"); |
3910 | 12 | 12 | ||
3911 | 13 | map:get($name, "key0", 1); | 13 | map:get($name, ["key0", 1]); |
3912 | 14 | 14 | ||
3913 | 15 | map:keys($name) | 15 | map:keys($name) |
3914 | 16 | } | 16 | } |
3915 | 17 | 17 | ||
3916 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map4.xq' | |||
3917 | --- test/rbkt/Queries/zorba/store/unordered-map/map4.xq 2013-02-07 17:24:36 +0000 | |||
3918 | +++ test/rbkt/Queries/zorba/store/unordered-map/map4.xq 2013-09-02 20:59:05 +0000 | |||
3919 | @@ -1,11 +1,11 @@ | |||
3925 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3926 | 2 | 2 | ||
3927 | 3 | 3 | ||
3928 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | let $name := "first" |
3929 | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:anyAtomicType") | 5 | let $type := "decimal" |
3930 | 6 | return | 6 | return |
3931 | 7 | { | 7 | { |
3932 | 8 | map:create($name, $type); | 8 | map:create($name, $type); |
3934 | 9 | map:insert($name, <a>blub</a>, 3.2); | 9 | map:insert($name, 3.2, <a>blub</a>); |
3935 | 10 | map:get($name, 3.2) | 10 | map:get($name, 3.2) |
3936 | 11 | } | 11 | } |
3937 | 12 | 12 | ||
3938 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map5.xq' | |||
3939 | --- test/rbkt/Queries/zorba/store/unordered-map/map5.xq 2013-02-07 17:24:36 +0000 | |||
3940 | +++ test/rbkt/Queries/zorba/store/unordered-map/map5.xq 2013-09-02 20:59:05 +0000 | |||
3941 | @@ -1,10 +1,10 @@ | |||
3947 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3948 | 2 | 2 | ||
3949 | 3 | 3 | ||
3950 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | let $name := "first" |
3951 | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 5 | let $type := "integer" |
3952 | 6 | return | 6 | return |
3953 | 7 | { | 7 | { |
3954 | 8 | map:create($name, $type); | 8 | map:create($name, $type); |
3956 | 9 | map:delete(fn:QName("http://www.zorba-xquery.com/map", "second")); | 9 | map:drop("second"); |
3957 | 10 | } | 10 | } |
3958 | 11 | 11 | ||
3959 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map6.xq' | |||
3960 | --- test/rbkt/Queries/zorba/store/unordered-map/map6.xq 2013-08-07 05:28:39 +0000 | |||
3961 | +++ test/rbkt/Queries/zorba/store/unordered-map/map6.xq 2013-09-02 20:59:05 +0000 | |||
3962 | @@ -1,20 +1,20 @@ | |||
3964 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3965 | 2 | 2 | ||
3966 | 3 | declare namespace zerr = "http://zorba.io/errors"; | 3 | declare namespace zerr = "http://zorba.io/errors"; |
3967 | 4 | declare namespace err = "http://www.w3.org/2005/xqt-errors"; | 4 | declare namespace err = "http://www.w3.org/2005/xqt-errors"; |
3968 | 5 | 5 | ||
3969 | 6 | 6 | ||
3971 | 7 | let $name1 := fn:QName("http://www.zorba-xquery.com/map", "first") | 7 | let $name1 := "first" |
3972 | 8 | let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string") | 8 | let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string") |
3974 | 9 | let $name2 := fn:QName("http://www.zorba-xquery.com/map", "second") | 9 | let $name2 := "second" |
3975 | 10 | let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 10 | let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3976 | 11 | return | 11 | return |
3977 | 12 | { | 12 | { |
3978 | 13 | map:create($name1, $type1); | 13 | map:create($name1, $type1); |
3979 | 14 | map:create($name2, $type2); | 14 | map:create($name2, $type2); |
3983 | 15 | map:insert($name1, <a>blub</a>, xs:anyURI("http://www.zorba-xquery.com/")); | 15 | map:insert($name1, xs:anyURI("http://www.zorba-xquery.com/"), <a>blub</a>); |
3984 | 16 | map:insert($name1, <a>blub42</a>, 42); | 16 | map:insert($name1, 42, <a>blub42</a>); |
3985 | 17 | map:insert($name2, <a>blub23</a>, 2); | 17 | map:insert($name2, 2, <a>blub23</a>); |
3986 | 18 | ( | 18 | ( |
3987 | 19 | map:get($name1, "http://www.zorba-xquery.com/"), | 19 | map:get($name1, "http://www.zorba-xquery.com/"), |
3988 | 20 | map:get($name1, 42), | 20 | map:get($name1, 42), |
3989 | 21 | 21 | ||
3990 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/map7.xq' | |||
3991 | --- test/rbkt/Queries/zorba/store/unordered-map/map7.xq 2012-06-22 23:36:41 +0000 | |||
3992 | +++ test/rbkt/Queries/zorba/store/unordered-map/map7.xq 2013-09-02 20:59:05 +0000 | |||
3993 | @@ -1,22 +1,22 @@ | |||
3995 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3996 | 2 | 2 | ||
3998 | 3 | variable $name := fn:QName("http://www.zorba-xquery.com/map", "first"); | 3 | variable $name := "first"; |
3999 | 4 | variable $xs-integer := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer"); | 4 | variable $xs-integer := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer"); |
4000 | 5 | variable $xs-string := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string"); | 5 | variable $xs-string := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string"); |
4001 | 6 | 6 | ||
4003 | 7 | map:create($name, $xs-integer, $xs-string); | 7 | map:create($name, [$xs-integer, $xs-string]); |
4004 | 8 | 8 | ||
4005 | 9 | for $i in 1 to 6 | 9 | for $i in 1 to 6 |
4009 | 10 | let $value := concat("value", $i), | 10 | let $value := concat("value", $i) |
4010 | 11 | $key1 := if ($i mod 2 ne 0) then $i else (), | 11 | let $key1 := $i |
4011 | 12 | $key2 := if ($i mod 3 ne 0) then concat("key", $i) else () | 12 | let $key2 := concat("key", $i) |
4012 | 13 | return | 13 | return |
4014 | 14 | map:insert($name, $value, $key1, $key2); | 14 | map:insert($name, [$key1, $key2], $value); |
4015 | 15 | 15 | ||
4019 | 16 | for $k in map:keys($name) | 16 | for $k in trace(map:keys($name), "key") |
4020 | 17 | let $key1 := data($k/map:attribute[1]/@value), | 17 | let $key1 := jn:members($k)[1] |
4021 | 18 | $key2 := data($k/map:attribute[2]/@value) | 18 | let $key2 := jn:members($k)[2] |
4022 | 19 | order by $key1, $key2 | 19 | order by $key1, $key2 |
4023 | 20 | return | 20 | return |
4024 | 21 | ($key1 instance of xs:integer, $key2 instance of xs:string, | 21 | ($key1 instance of xs:integer, $key2 instance of xs:string, |
4026 | 22 | $key1, $key2, map:get($name, $key1, $key2)) | 22 | $key1, $key2, map:get($name, [$key1, $key2])) |
4027 | 23 | 23 | ||
4028 | === modified file 'test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq' | |||
4029 | --- test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq 2012-05-19 17:12:33 +0000 | |||
4030 | +++ test/rbkt/Queries/zorba/store/unordered-map/transient-map0.xq 2013-09-02 20:59:05 +0000 | |||
4031 | @@ -1,26 +1,26 @@ | |||
4036 | 1 | import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; | 1 | import module namespace map = "http://zorba.io/modules/unordered-maps"; |
4037 | 2 | 2 | ||
4038 | 3 | 3 | ||
4039 | 4 | let $name := fn:QName("http://www.zorba-xquery.com/map", "first") | 4 | let $name := "first" |
4040 | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") | 5 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
4041 | 6 | return | 6 | return |
4042 | 7 | { | 7 | { |
4044 | 8 | map:create-transient($name, $type); | 8 | map:create($name, $type, { $map:PERSISTENT : false }); |
4045 | 9 | 9 | ||
4046 | 10 | ( | 10 | ( |
4047 | 11 | for $i in 1 to 1000 | 11 | for $i in 1 to 1000 |
4049 | 12 | return map:insert($name, concat("value", $i), $i) | 12 | return map:insert($name, $i, concat("value", $i)) |
4050 | 13 | ); | 13 | ); |
4051 | 14 | 14 | ||
4052 | 15 | variable $res := <avail>{ map:available-maps() }</avail>; | 15 | variable $res := <avail>{ map:available-maps() }</avail>; |
4053 | 16 | 16 | ||
4054 | 17 | $res := ($res, <contains>{ map:get($name, 5) }</contains>); | 17 | $res := ($res, <contains>{ map:get($name, 5) }</contains>); |
4055 | 18 | 18 | ||
4057 | 19 | map:remove($name, 5); | 19 | map:delete($name, 5); |
4058 | 20 | 20 | ||
4059 | 21 | $res := ($res, <contains>{ map:get($name, 5) }</contains>); | 21 | $res := ($res, <contains>{ map:get($name, 5) }</contains>); |
4060 | 22 | 22 | ||
4062 | 23 | map:delete($name); | 23 | map:drop($name); |
4063 | 24 | 24 | ||
4064 | 25 | ($res, <avail>{ map:available-maps() }</avail>) | 25 | ($res, <avail>{ map:available-maps() }</avail>) |
4065 | 26 | } | 26 | } |
Validation queue starting for the following merge proposals: /code.launchpad .net/~zorba- coders/ zorba/bug- 1189804/ +merge/ 181969
https:/
Progress dashboard at http:// jenkins. lambda. nu/view/ ValidationQueue