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 | |
6 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION; |
7 | |
8 | +extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION; |
9 | + |
10 | +extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0043_INVALID_OPTION_TYPE; |
11 | + |
12 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED; |
13 | |
14 | extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDST0002_COLLECTION_ALREADY_IMPORTED; |
15 | |
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 | # limitations under the License. |
21 | |
22 | ADD_SUBDIRECTORY(atomic) |
23 | +ADD_SUBDIRECTORY(store) |
24 | ADD_SUBDIRECTORY(com) |
25 | ADD_SUBDIRECTORY(org) |
26 | ADD_SUBDIRECTORY(functx) |
27 | |
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 | DECLARE_ZORBA_MODULE(FILE introspection/sctx.xq VERSION 2.0 |
33 | URI "http://www.zorba-xquery.com/modules/introspection/sctx") |
34 | |
35 | -DECLARE_ZORBA_MODULE(FILE store/data-structures/unordered-map.xq VERSION 2.0 |
36 | - URI "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map") |
37 | DECLARE_ZORBA_MODULE(FILE store/documents/dynamic.xq VERSION 2.0 |
38 | URI "http://www.zorba-xquery.com/modules/store/dynamic/documents") |
39 | DECLARE_ZORBA_MODULE(FILE store/dynamic/collections/ddl.xq VERSION 2.0 |
40 | |
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 | -xquery version "3.0"; |
46 | -(: |
47 | - : Copyright 2006-2012 The FLWOR Foundation. |
48 | - : |
49 | - : Licensed under the Apache License, Version 2.0 (the "License"); |
50 | - : you may not use this file except in compliance with the License. |
51 | - : You may obtain a copy of the License at |
52 | - : |
53 | - : http://www.apache.org/licenses/LICENSE-2.0 |
54 | - : |
55 | - : Unless required by applicable law or agreed to in writing, software |
56 | - : distributed under the License is distributed on an "AS IS" BASIS, |
57 | - : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
58 | - : See the License for the specific language governing permissions and |
59 | - : limitations under the License. |
60 | -:) |
61 | - |
62 | -(:~ |
63 | - : <p>This module defines a set of functions for working with maps. A map |
64 | - : is identified by a QName and can be created using the map:create or |
65 | - : map:create-transient functions and deleted using the map:delete function, |
66 | - : respectively.</p> |
67 | - : |
68 | - : <p>The lifetime of a transient map is limited by the execution of the |
69 | - : current XQuery program. A non-transient (or persistent) map lives until |
70 | - : it is explicitly deleted. Accordingly, it's also available |
71 | - : to other XQuery programs.</p> |
72 | - : |
73 | - : <p>The key of a particular entry in the map can consist of a tuple of |
74 | - : atomic values (called attributes). The actual type of each attribute |
75 | - : is determined when the map is created. The value of each attribute can |
76 | - : be an arbitrary sequence of items.</p> |
77 | - : |
78 | - : @see <a href="../../html/data_lifecycle.html">Data Lifecycle</a> |
79 | - : @see <a href="modules_http:__zorba.io_modules_zorba-errors.html">http://zorba.io/errors</a> |
80 | - : |
81 | - : @author Matthias Brantner |
82 | - : |
83 | - : @project Zorba/Data Store/Data Structures/Unordered Map |
84 | - :) |
85 | -module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
86 | - |
87 | -declare namespace zerr = "http://zorba.io/errors"; |
88 | -declare namespace err = "http://www.w3.org/2005/xqt-errors"; |
89 | -declare namespace an = "http://zorba.io/annotations"; |
90 | - |
91 | -declare namespace ver = "http://zorba.io/options/versioning"; |
92 | -declare option ver:module-version "2.0"; |
93 | - |
94 | -(:~ |
95 | - : Create a map with a given name and a set of type identifiers for each key |
96 | - : attribute. Note that the function is variadic and might take an arbitrary |
97 | - : number of type identifiers for the key attributes. Also note that the |
98 | - : function is sequential and immediately creates the map in the store. |
99 | - : |
100 | - : @param $name the name of the map |
101 | - : @param $key-type an arbitrary number of types, one |
102 | - : for each key attribute. |
103 | - : |
104 | - : @return the function is sequential and immediately creates |
105 | - : the corresponding map but returns the empty-sequence. |
106 | - : |
107 | - : @error err:XPTY0004 if any of the attribute types is not a subtype of |
108 | - : xs:anyAtomicType. |
109 | - : @error zerr:ZSTR0001 if a map with the given name already exists. |
110 | - :) |
111 | -declare %an:variadic %an:sequential function map:create( |
112 | - $name as xs:QName, |
113 | - $key-type as xs:QName) as empty-sequence() external; |
114 | - |
115 | -(:~ |
116 | - : Create a transient map with a given name and a set of type identifiers |
117 | - : for each key attribute. Note that the function is variadic and might |
118 | - : take an arbitrary number of type identifiers for the key attributes. |
119 | - : |
120 | - : @param $name the name of the map |
121 | - : @param $key-type an arbitrary number of types, one |
122 | - : for each key attribute. |
123 | - : |
124 | - : @return the function is sequential and immediately creates |
125 | - : the corresponding map but returns the empty-sequence. |
126 | - : |
127 | - : @error err:XPTY0004 if any of the attribute types is not a subtype of |
128 | - : xs:anyAtomicType. |
129 | - : @error zerr:ZSTR0001 if a map with the given name already exists. |
130 | - :) |
131 | -declare %an:variadic %an:sequential function map:create-transient( |
132 | - $name as xs:QName, |
133 | - $key-type as xs:QName) as empty-sequence() external; |
134 | - |
135 | -(:~ |
136 | - : Destroys the map with the given name. |
137 | - : |
138 | - : @param $name the name of the map to delete |
139 | - : |
140 | - : @return the function is sequential and immediately deletes |
141 | - : the map but returns the empty-sequence. |
142 | - : |
143 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
144 | - :) |
145 | -declare %an:sequential function map:delete( |
146 | - $name as xs:QName) as empty-sequence() external; |
147 | - |
148 | -(:~ |
149 | - : Inserts a new entry into the map with the given name. Note that the |
150 | - : function is variadic and might take an arbitrary number of key attributes. |
151 | - : If an entry with the given key already exists in the map, the value |
152 | - : sequences of the existing entry and the sequence passed using $value |
153 | - : argument are concatenated. |
154 | - : |
155 | - : Note that it is possible to insert entries with empty key attributes. |
156 | - : However as the getting the entries is based on the "eq" comparison and |
157 | - : as "eq" with an empty sequence always return false, it is not possible |
158 | - : to retrieve these entries. |
159 | - : |
160 | - : @param $name the name of the map |
161 | - : @param $value the value of the entry to insert |
162 | - : @param $key an arbitrary number of key attributes. |
163 | - : |
164 | - : @return the function is sequential and immediately inserts |
165 | - : the entry into the map but returns the |
166 | - : empty-sequence. |
167 | - : |
168 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
169 | - : @error zerr:ZDDY0025 if the given number of key attributes does not match |
170 | - : the number of key attributes specified when creating |
171 | - : the map (see the map:create function). |
172 | - : @error zerr:ZXQD0005 if any of the given key attributes can not |
173 | - : be cast (or is not a subtype) of the corresponding key attribute |
174 | - : specified when creating the map. |
175 | - : |
176 | - : @see map:create |
177 | - : |
178 | - :) |
179 | -declare %an:variadic %an:sequential function map:insert( |
180 | - $name as xs:QName, |
181 | - $value as item()*, |
182 | - $key as xs:anyAtomicType?) as empty-sequence() external; |
183 | - |
184 | -(:~ |
185 | - : Returns the value of the entry with the given key from the map. |
186 | - : |
187 | - : Note that it is possible to insert entries with empty key attributes. |
188 | - : However as the getting the entries is based on the "eq" comparison and |
189 | - : as "eq" with an empty sequence always return false, it is not possible |
190 | - : to retrieve these entries. |
191 | - : |
192 | - : @param $name the name of the map |
193 | - : @param an arbitrary number of search key attributes. |
194 | - : |
195 | - : @return the value of the entry in the map identified |
196 | - : by the given key. The empty-sequence will be returned |
197 | - : if no entry with the given key is contained in the map. |
198 | - : |
199 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
200 | - : @error zerr:ZDDY0025 if the given number of key attributes does not match |
201 | - : the number of key attributes specified when creating |
202 | - : the map (see the map:create function). |
203 | - : @error zerr:ZXQD0005 if any of the given key attributes can not |
204 | - : be cast (or is not a subtype) of the corresponding key attribute |
205 | - : specified when creating the map. |
206 | - : |
207 | - : @see map:create |
208 | - :) |
209 | -declare %an:variadic function map:get( |
210 | - $name as xs:QName, |
211 | - $key as xs:anyAtomicType?) as item()* external; |
212 | - |
213 | -(:~ |
214 | - : Removes an entry identified by the given key from the map. |
215 | - : |
216 | - : Note that it is possible to insert entries with empty key attributes. |
217 | - : However as the removing the entries is based on the "eq" comparison and |
218 | - : as "eq" with an empty sequence always return false, it is not possible |
219 | - : to remove these entries. |
220 | - : |
221 | - : @param $name the name of the map |
222 | - : @param an arbitrary number of search key attributes. |
223 | - : |
224 | - : @return the function is sequential and immediately removes |
225 | - : the entry into the map but returns the |
226 | - : empty-sequence. |
227 | - : |
228 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
229 | - : @error zerr:ZDDY0025 if the given number of key attributes does not match |
230 | - : the number of key attributes specified when creating |
231 | - : the map (see the map:create function). |
232 | - : @error zerr:ZXQD0005 if any of the given key attributes can not |
233 | - : be cast (or is not a subtype) of the corresponding key attribute |
234 | - : specified when creating the map. |
235 | - : |
236 | - : @see map:create |
237 | - :) |
238 | -declare %an:variadic %an:sequential function map:remove( |
239 | - $name as xs:QName, |
240 | - $key as xs:anyAtomicType?) as empty-sequence() external; |
241 | - |
242 | -(:~ |
243 | - : Returns the keys of all entries of a map. The keys |
244 | - : are returned as sequence of nodes of the form: |
245 | - : |
246 | - : <pre> |
247 | - : <key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"> |
248 | - : <attribute value="key1_value"/> |
249 | - : <attribute value="key2_value"/> |
250 | - : <attribute value="key3_value"/> |
251 | - : </key> |
252 | - : </pre> |
253 | - : |
254 | - : The following condition always holds: |
255 | - : <tt>map:size($name) eq fn:count(map:keys($name))</tt> |
256 | - : |
257 | - : @param $name the name of the map |
258 | - : |
259 | - : @return all keys in the map. |
260 | - : |
261 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
262 | - : |
263 | - :) |
264 | -declare function map:keys( |
265 | - $name as xs:QName) as node()* external; |
266 | - |
267 | -(:~ |
268 | - : The number of entries in a map. |
269 | - : |
270 | - : The following condition always holds: |
271 | - : <tt>map:size($name) eq fn:count(map:keys($name))</tt> |
272 | - : |
273 | - : @param $name the name of the map |
274 | - : |
275 | - : @return the number of entries in the map. |
276 | - : |
277 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
278 | - :) |
279 | -declare function map:size($name as xs:QName) as xs:integer external; |
280 | - |
281 | -(:~ |
282 | - : The function returns a sequence of QNames of the maps that are |
283 | - : available. The sequence will be empty if there are no maps. |
284 | - : |
285 | - : @return A sequence of QNames, one for each available map, or an emtpy sequence. |
286 | - : |
287 | - :) |
288 | -declare function map:available-maps() as xs:QName* external; |
289 | - |
290 | -(:~ |
291 | - : The function returns true if the map identified by the given QName |
292 | - : is transient, false otherwise. |
293 | - : |
294 | - : @param $name the name of the map |
295 | - : |
296 | - : @return true if the map is transient, false otherwise. |
297 | - : |
298 | - : @error zerr:ZDDY0023 if a map with the given name does not exist. |
299 | - :) |
300 | -declare function map:is-transient($name as xs:QName) as xs:boolean external; |
301 | |
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 | |
307 | (:~ |
308 | :) |
309 | +declare variable $zerr:ZDDY0042 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0042"); |
310 | + |
311 | +(:~ |
312 | +:) |
313 | +declare variable $zerr:ZDDY0043 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0043"); |
314 | + |
315 | +(:~ |
316 | +:) |
317 | declare variable $zerr:ZDST0001 as xs:QName := fn:QName($zerr:NS, "zerr:ZDST0001"); |
318 | |
319 | (:~ |
320 | |
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 | +# Copyright 2013 The FLWOR Foundation. |
327 | +# |
328 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
329 | +# you may not use this file except in compliance with the License. |
330 | +# You may obtain a copy of the License at |
331 | +# |
332 | +# http://www.apache.org/licenses/LICENSE-2.0 |
333 | +# |
334 | +# Unless required by applicable law or agreed to in writing, software |
335 | +# distributed under the License is distributed on an "AS IS" BASIS, |
336 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
337 | +# See the License for the specific language governing permissions and |
338 | +# limitations under the License. |
339 | + |
340 | +DECLARE_ZORBA_MODULE(FILE unordered-maps.xq VERSION 1.0 |
341 | + URI "http://zorba.io/modules/unordered-maps") |
342 | |
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 | +jsoniq version "1.0"; |
348 | + |
349 | +(: |
350 | + : Copyright 2013 The FLWOR Foundation. |
351 | + : |
352 | + : Licensed under the Apache License, Version 2.0 (the "License"); |
353 | + : you may not use this file except in compliance with the License. |
354 | + : You may obtain a copy of the License at |
355 | + : |
356 | + : http://www.apache.org/licenses/LICENSE-2.0 |
357 | + : |
358 | + : Unless required by applicable law or agreed to in writing, software |
359 | + : distributed under the License is distributed on an "AS IS" BASIS, |
360 | + : WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
361 | + : See the License for the specific language governing permissions and |
362 | + : limitations under the License. |
363 | +:) |
364 | + |
365 | +(:~ |
366 | + : This module defines a set of functions for working with maps. A map |
367 | + : is identified by a string and can be created using the map:create function |
368 | + : and dropped using the map:drop function. |
369 | + : <p/> |
370 | + : It is possible to create persistent and transient maps. The lifetime of a |
371 | + : transient map is limited by the execution of the current query. |
372 | + : A persistent map lives until it is explicitly dropped. |
373 | + : Accordingly, it is also available to other requests. |
374 | + : <p/> |
375 | + : For example, |
376 | + : <pre>map:create("my-map", ["string", "integer"], { "persistent" : false })</pre> |
377 | + : will create a transient map named my-map having two keys. |
378 | + : The types of the keys are string and integer. |
379 | + : <p/> |
380 | + : The key of a particular entry in the map can consist of a tuple of |
381 | + : atomic values (called key attributes). The actual type of each attribute |
382 | + : is determined when the map is created. The value of each entry is a |
383 | + : sequence of items. If an item in this sequence is a object or array, |
384 | + : this item needs to belong to a collection, otherwise, an error is raised. |
385 | + : |
386 | + : @author Matthias Brantner |
387 | + :) |
388 | +module namespace map = "http://zorba.io/modules/unordered-maps"; |
389 | + |
390 | +declare namespace an = "http://zorba.io/annotations"; |
391 | +declare namespace zerr = "http://zorba.io/errors"; |
392 | + |
393 | +declare namespace ver = "http://zorba.io/options/versioning"; |
394 | +declare option ver:module-version "1.0"; |
395 | + |
396 | +(:~ |
397 | + : Constant containing the field name of the options object |
398 | + : indiciating whether a map is persistent or transient. |
399 | + :) |
400 | +declare variable $map:PERSISTENT as string := "persistent"; |
401 | + |
402 | +(:~ |
403 | + : Create a persistent map with a given name and type identifiers for the key |
404 | + : attributes. |
405 | + : <p/> |
406 | + : If the map has only one key attribute, a single type identifier is given, |
407 | + : for more than one key attribute an array of type identifiers is given. |
408 | + : Calling this function is equivalent to calling create with the options |
409 | + : <code>{ "persistent" : true }</code> |
410 | + : Note that the function is sequential and immediately creates the map. |
411 | + : <p/> |
412 | + : Each key-type should be specified as string (e.g. "integer", |
413 | + : "string", "boolean", "double", or "datetime"). |
414 | + : <p/> |
415 | + : For example, |
416 | + : <pre>map:create("my-map", "string")</pre> or |
417 | + : <pre>map:create("my-map", ["string", "integer"])</pre>. |
418 | + : |
419 | + : @param $name the name of the map (the restrictions on collection names apply) |
420 | + : @param $key-type one type identifier or an array of type identifiers for the |
421 | + : key attributes |
422 | + : |
423 | + : @return the function is sequential and immediately creates |
424 | + : the corresponding map. It returns the empty-sequence. |
425 | + : |
426 | + : @error err:XPTY0004 if any of the key attribute types is not a subtype of |
427 | + : anyAtomicType. |
428 | + : @error zerr:ZSTR0001 if a map with the given name already exists. |
429 | + : @error zerr:ZDDY1000 if the given name is not a legal collection name |
430 | + : @error zerr:ZDDY0043 if any of the given options has an invalid type |
431 | + : |
432 | + : @see map:create#3 |
433 | + :) |
434 | +declare %an:sequential function map:create( |
435 | + $name as string, |
436 | + $key-types as item) as () external; |
437 | + |
438 | +(:~ |
439 | + : Create a map with a given name, type identifiers for the key attributes, and |
440 | + : options. |
441 | + : <p/> |
442 | + : If the map has only one key attribute, a single type identifier is given, |
443 | + : for more than one key attribute an array of type identifiers is given. |
444 | + : Currently only one option is supported: To create a transient map the object |
445 | + : <code>{ "persistent" : false }</code> |
446 | + : has to be passed to the $options parameter. |
447 | + : Note that the function is sequential and immediately creates the map in the |
448 | + : store. |
449 | + : <p/> |
450 | + : Note that a map cannot be created if it already exists in a parent context. |
451 | + : For example, a map that was created in an outer query cannot be |
452 | + : created again in an inner query executed using the |
453 | + : <code>reflection:eval-s</code> function. |
454 | + : |
455 | + : @param $name the name of the map (the restrictions on collection names apply) |
456 | + : @param $key-type one type identifier or an array of type identifiers for the |
457 | + : key attributes |
458 | + : @param $options an object describing options for the map |
459 | + : |
460 | + : @return the function is sequential and immediately creates |
461 | + : the corresponding map but returns the empty-sequence. |
462 | + : |
463 | + : @error err:XPTY0004 if any of the attribute types is not a subtype of |
464 | + : anyAtomicType. |
465 | + : @error zerr:ZSTR0001 if a map with the given name already exists. |
466 | + : @error zerr:ZDDY1000 if the given name is not a legal collection name |
467 | + : @error zerr:ZDDY0043 if any of the given options has an invalid type |
468 | + : |
469 | + : @see map:create#2 |
470 | + :) |
471 | +declare %an:sequential function map:create( |
472 | + $name as string, |
473 | + $key-types as item, |
474 | + $options as object) as () external; |
475 | + |
476 | +(:~ |
477 | + : Deletes the map with the given name. |
478 | + : <p/> |
479 | + : Note that a map can only be dropped in the context it was created. |
480 | + : For example, a map that was created in an outer query cannot be |
481 | + : dropped in an inner query executed using the |
482 | + : <code>reflection:eval-s</code> function. |
483 | + : |
484 | + : @param $name the name of the map to drop |
485 | + : |
486 | + : @return the function is sequential and immediately drops |
487 | + : the map. It returns the empty-sequence. |
488 | + : |
489 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
490 | + :) |
491 | +declare %an:sequential function map:drop( |
492 | + $name as string) as () external; |
493 | + |
494 | +(:~ |
495 | + : Inserts a new entry into the map with the given name. |
496 | + : <p/> |
497 | + : If the map has only one key attribute, a single key value is given, for |
498 | + : more than one key attribute an array of key values is given. |
499 | + : If an entry with the given key already exists in the map, the value |
500 | + : sequences of the existing entry and the sequence passed using $value |
501 | + : argument are concatenated. |
502 | + : <p/> |
503 | + : If an item in the value sequence is an object or array, this |
504 | + : item needs to belong to a collection, otherwise, an an error |
505 | + : is raised. |
506 | + : <p/> |
507 | + : Note that it is possible to insert entries with empty key attributes |
508 | + : or key attributes having the value <code>null</code>. However, as |
509 | + : the comparison with an empty sequence or null always returns false, |
510 | + : it is not possible to retrieve these entries. |
511 | + : <p/> |
512 | + : For example, |
513 | + : <pre>map:insert("my-map", "key", "value")</pre> or |
514 | + : <pre>map:insert("my-map", [ "key1", "key2" ] , (42, "value"))</pre>. |
515 | + : |
516 | + : |
517 | + : @param $name the name of the map |
518 | + : @param $key either a single attribute key or an array of keys |
519 | + : @param $value the value of the entry to insert |
520 | + : |
521 | + : @return the function is sequential and immediately inserts |
522 | + : the entry into the map. It returns the empty-sequence. |
523 | + : |
524 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
525 | + : @error zerr:ZDDY0025 if the given number of key attributes does not match |
526 | + : the number of key attributes specified when creating |
527 | + : the map (see the map:create function). |
528 | + : @error zerr:ZXQD0005 if any of the given key attributes can not |
529 | + : be cast (or is not a subtype) of the corresponding key attribute |
530 | + : specified when creating the map. |
531 | + : @error zerr:ZDDY1003 if the value to insert is an object or array |
532 | + : it must belong to a collection. |
533 | + :) |
534 | +declare %an:sequential function map:insert( |
535 | + $name as string, |
536 | + $key as item, |
537 | + $value as item*) as () external; |
538 | + |
539 | +(:~ |
540 | + : Returns the value of the entry with the given key from the map. |
541 | + : <p/> |
542 | + : If the map has only one key attribute, a single key value is given, for |
543 | + : more than one key attribute an array of key values is given. |
544 | + : <p/> |
545 | + : Note that it is possible to insert entries with empty key attributes. |
546 | + : However as the getting the entries is based on the "eq" comparison and |
547 | + : as "eq" with an empty sequence always return false, it is not possible |
548 | + : to retrieve these entries. |
549 | + : <p/> |
550 | + : For example, |
551 | + : <pre>map:get("my-map", "key")</pre> or |
552 | + : <pre>map:get("my-map", [ "key1", "key2" ])</pre>. |
553 | + : |
554 | + : @param $name the name of the map |
555 | + : @param $key either a single attribute key or an array of keys |
556 | + : |
557 | + : @return the value of the entry in the map identified |
558 | + : by the given key. The empty-sequence will be returned |
559 | + : if no entry with the given key is contained in the map. |
560 | + : |
561 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
562 | + : @error zerr:ZDDY0025 if the given number of key attributes does not match |
563 | + : the number of key attributes specified when creating |
564 | + : the map (see the map:create function). |
565 | + : @error zerr:ZXQD0005 if any of the given key attributes can not |
566 | + : be cast (or is not a subtype) of the corresponding key attribute |
567 | + : specified when creating the map. |
568 | + : |
569 | + : @see map:create |
570 | + :) |
571 | +declare function map:get( |
572 | + $name as string, |
573 | + $key as item) as item* external; |
574 | + |
575 | +(:~ |
576 | + : Removes an entry identified by the given key from the map. |
577 | + : <p/> |
578 | + : If the map has only one key attribute, a single key value is given, for |
579 | + : more than one key attribute an array of key values is given. |
580 | + : <p/> |
581 | + : Note that it is possible to insert entries with empty key attributes. |
582 | + : However as the removing the entries is based on the "eq" comparison and |
583 | + : as "eq" with an empty sequence always return false, it is not possible |
584 | + : to delete these entries. |
585 | + : |
586 | + : @param $name the name of the map |
587 | + : @param $key either a single attribute key or an array of keys |
588 | + : |
589 | + : @return the function is sequential and immediately deletes |
590 | + : the entry into the map but returns the |
591 | + : empty-sequence. |
592 | + : |
593 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
594 | + : @error zerr:ZDDY0025 if the given number of key attributes does not match |
595 | + : the number of key attributes specified when creating |
596 | + : the map (see the map:create function). |
597 | + : @error zerr:ZXQD0005 if any of the given key attributes can not |
598 | + : be cast (or is not a subtype) of the corresponding key attribute |
599 | + : specified when creating the map. |
600 | + : |
601 | + : @see map:create |
602 | + :) |
603 | +declare %an:sequential function map:delete( |
604 | + $name as string, |
605 | + $key as item) as () external; |
606 | + |
607 | +(:~ |
608 | + : Returns the keys of all entries of a map. The keys |
609 | + : are returned as sequence of arrays. |
610 | + : <p/> |
611 | + : The following condition always holds: |
612 | + : <tt>map:size($name) eq count(map:keys($name))</tt> |
613 | + : |
614 | + : @param $name the name of the map |
615 | + : |
616 | + : @return an sequence of arrays each array containing the values of all |
617 | + : attributes of one key. |
618 | + : |
619 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
620 | + :) |
621 | +declare function map:keys($name as string) as array* external; |
622 | + |
623 | +(:~ |
624 | + : Returns the number of entries in a map. |
625 | + : <p/> |
626 | + : The following condition always holds: |
627 | + : <tt>map:size($name) eq count(map:keys($name))</tt> |
628 | + : |
629 | + : @param $name the name of the map |
630 | + : |
631 | + : @return the number of entries in the map. |
632 | + : |
633 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
634 | + :) |
635 | +declare function map:size($name as string) as integer external; |
636 | + |
637 | +(:~ |
638 | + : The function returns a sequence of names of the maps that are |
639 | + : available (persistent and non-persistent). The sequence will be |
640 | + : empty if there are no maps. |
641 | + : <p/> |
642 | + : |
643 | + : @return A sequence of string, one for each available map, or |
644 | + : an empty sequence. |
645 | + :) |
646 | +declare function map:available-maps() as string* external; |
647 | + |
648 | +(:~ |
649 | + : The function returns the options that were passed during creation or the |
650 | + : default options if no options were passed. |
651 | + : |
652 | + : @param $name the name of the map |
653 | + : |
654 | + : @return an options object |
655 | + : |
656 | + : @error zerr:ZDDY0023 if a map with the given name does not exist. |
657 | + :) |
658 | +declare function map:options($name as string) as object external; |
659 | |
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 | /******************************************************************************* |
665 | |
666 | ********************************************************************************/ |
667 | -store::Index* dynamic_context::getMap(store::Item* qname) const |
668 | +store::Index* dynamic_context::getMap( |
669 | + store::Item* qname, |
670 | + bool lookupParent) const |
671 | { |
672 | - if (theAvailableMaps == NULL) |
673 | - return NULL; |
674 | - |
675 | store::Index_t map; |
676 | + const dynamic_context* c = this; |
677 | |
678 | - if (theAvailableMaps->get(qname, map)) |
679 | - { |
680 | - return map.getp(); |
681 | - } |
682 | - else |
683 | - { |
684 | - return NULL; |
685 | - } |
686 | + while (c) |
687 | + { |
688 | + if (c->theAvailableMaps && c->theAvailableMaps->get(qname, map)) |
689 | + { |
690 | + return map.getp(); |
691 | + } |
692 | + else |
693 | + { |
694 | + if (lookupParent) |
695 | + c = c->getParent(); |
696 | + else |
697 | + c = NULL; |
698 | + continue; |
699 | + } |
700 | + } |
701 | + return NULL; |
702 | } |
703 | |
704 | |
705 | @@ -783,8 +791,12 @@ |
706 | ********************************************************************************/ |
707 | void dynamic_context::unbindMap(store::Item* qname) |
708 | { |
709 | - if (theAvailableMaps != NULL) |
710 | + store::Index_t map; |
711 | + |
712 | + if (theAvailableMaps && theAvailableMaps->get(qname, map)) |
713 | + { |
714 | theAvailableMaps->erase(qname); |
715 | + } |
716 | } |
717 | |
718 | |
719 | @@ -793,14 +805,20 @@ |
720 | ********************************************************************************/ |
721 | void dynamic_context::getMapNames(std::vector<store::Item_t>& names) const |
722 | { |
723 | - if (theAvailableMaps == NULL) |
724 | - return; |
725 | + const dynamic_context* c = this; |
726 | |
727 | - for (IndexMap::iterator lIter = theAvailableMaps->begin(); |
728 | - lIter != theAvailableMaps->end(); |
729 | - ++lIter) |
730 | + while (c) |
731 | { |
732 | - names.push_back(lIter.getKey()); |
733 | + if (c->theAvailableMaps) |
734 | + { |
735 | + for (IndexMap::iterator lIter = c->theAvailableMaps->begin(); |
736 | + lIter != c->theAvailableMaps->end(); |
737 | + ++lIter) |
738 | + { |
739 | + names.push_back(lIter.getKey()); |
740 | + } |
741 | + } |
742 | + c = c->getParent(); |
743 | } |
744 | } |
745 | |
746 | |
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 | |
752 | dynamic_context* getParent() { return theParent; } |
753 | |
754 | + const dynamic_context* getParent() const { return theParent; } |
755 | + |
756 | store::Item_t get_default_collection() const; |
757 | |
758 | void set_default_collection(const store::Item_t& default_collection_uri); |
759 | @@ -244,7 +246,7 @@ |
760 | |
761 | void unbindIndex(store::Item* qname); |
762 | |
763 | - store::Index* getMap(store::Item* qname) const; |
764 | + store::Index* getMap(store::Item* qname, bool lookupParent = true) const; |
765 | |
766 | void bindMap(store::Item* qname, store::Index_t& index); |
767 | |
768 | |
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 | "http://www.zorba-xquery.com/modules/store/dynamic/documents"; |
774 | |
775 | const char* |
776 | -static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS = |
777 | -"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
778 | +static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS = |
779 | +"http://zorba.io/modules/unordered-maps"; |
780 | |
781 | const char* |
782 | static_context::JSONIQ_DM_NS = |
783 | @@ -536,7 +536,7 @@ |
784 | ns == ZORBA_NODEPOS_FN_NS || |
785 | |
786 | ns == ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS || |
787 | - ns == ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS || |
788 | + ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS || |
789 | ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DDL_FN_NS || |
790 | ns == ZORBA_STORE_DYNAMIC_COLLECTIONS_DML_FN_NS || |
791 | ns == ZORBA_STORE_STATIC_COLLECTIONS_DDL_FN_NS || |
792 | @@ -620,6 +620,7 @@ |
793 | ns == ZORBA_XQDOC_FN_NS || |
794 | ns == ZORBA_URI_FN_NS || |
795 | ns == ZORBA_RANDOM_FN_NS || |
796 | + ns == ZORBA_STORE_UNORDERED_MAPS_FN_NS || |
797 | ns == ZORBA_FETCH_FN_NS || |
798 | #ifndef ZORBA_NO_FULL_TEXT |
799 | ns == ZORBA_FULL_TEXT_FN_NS || |
800 | |
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 | static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DDL_FN_NS; |
806 | static const char* ZORBA_STORE_STATIC_INTEGRITY_CONSTRAINTS_DML_FN_NS; |
807 | static const char* ZORBA_STORE_DYNAMIC_DOCUMENTS_FN_NS; |
808 | - static const char* ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS; |
809 | + static const char* ZORBA_STORE_UNORDERED_MAPS_FN_NS; |
810 | |
811 | static const char* JSONIQ_DM_NS; |
812 | static const char* JSONIQ_FN_NS; |
813 | |
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 | <value>"$1": collection was modified while reading</value> |
819 | </diagnostic> |
820 | |
821 | + <diagnostic code="ZDDY0042" name="ITEM_NOT_IN_COLLECTION"> |
822 | + <value>"$1": map insertion requires $2 to belong to a collection</value> |
823 | + </diagnostic> |
824 | + |
825 | + <diagnostic code="ZDDY0043" name="INVALID_OPTION_TYPE"> |
826 | + <value>"$1": invalid type for option "$2"</value> |
827 | + </diagnostic> |
828 | + |
829 | <diagnostic code="ZDST0001" name="COLLECTION_ALREADY_DECLARED"> |
830 | <value>"$1": collection already declared</value> |
831 | </diagnostic> |
832 | |
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 | ZorbaErrorCode ZDDY0041_CONCURRENT_MODIFICATION( "ZDDY0041" ); |
838 | |
839 | |
840 | +ZorbaErrorCode ZDDY0042_ITEM_NOT_IN_COLLECTION( "ZDDY0042" ); |
841 | + |
842 | + |
843 | +ZorbaErrorCode ZDDY0043_INVALID_OPTION_TYPE( "ZDDY0043" ); |
844 | + |
845 | + |
846 | ZorbaErrorCode ZDST0001_COLLECTION_ALREADY_DECLARED( "ZDST0001" ); |
847 | |
848 | |
849 | |
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 | { "ZDDY0039", "attempt to edit non-root node in collection \"$1\"" }, |
855 | { "ZDDY0040", "attempt to edit an item with a template of a different kind (for example an object with a node)." }, |
856 | { "ZDDY0041", "\"$1\": collection was modified while reading" }, |
857 | + { "ZDDY0042", "\"$1\": map insertion requires $2 to belong to a collection" }, |
858 | + { "ZDDY0043", "\"$1\": invalid type for option \"$2\"" }, |
859 | { "ZDST0001", "\"$1\": collection already declared" }, |
860 | { "ZDST0002", "\"$1\": collection already imported into module \"$2\"" }, |
861 | { "ZDST0003", "\"$1\": collection declaration not allowed in main module" }, |
862 | |
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 | |
868 | |
869 | |
870 | -PlanIter_t zorba_store_data_structure_unordered_map_create::codegen( |
871 | +PlanIter_t zorba_store_unordered_maps_create::codegen( |
872 | CompilerCB*, |
873 | static_context* sctx, |
874 | const QueryLoc& loc, |
875 | @@ -41,27 +41,17 @@ |
876 | return new MapCreateIterator(sctx, loc, argv); |
877 | } |
878 | |
879 | -PlanIter_t zorba_store_data_structure_unordered_map_create_transient::codegen( |
880 | - CompilerCB*, |
881 | - static_context* sctx, |
882 | - const QueryLoc& loc, |
883 | - std::vector<PlanIter_t>& argv, |
884 | - expr& ann) const |
885 | -{ |
886 | - return new MapCreateTransientIterator(sctx, loc, argv); |
887 | -} |
888 | - |
889 | -PlanIter_t zorba_store_data_structure_unordered_map_delete::codegen( |
890 | - CompilerCB*, |
891 | - static_context* sctx, |
892 | - const QueryLoc& loc, |
893 | - std::vector<PlanIter_t>& argv, |
894 | - expr& ann) const |
895 | -{ |
896 | - return new MapDestroyIterator(sctx, loc, argv); |
897 | -} |
898 | - |
899 | -PlanIter_t zorba_store_data_structure_unordered_map_get::codegen( |
900 | +PlanIter_t zorba_store_unordered_maps_drop::codegen( |
901 | + CompilerCB*, |
902 | + static_context* sctx, |
903 | + const QueryLoc& loc, |
904 | + std::vector<PlanIter_t>& argv, |
905 | + expr& ann) const |
906 | +{ |
907 | + return new MapDropIterator(sctx, loc, argv); |
908 | +} |
909 | + |
910 | +PlanIter_t zorba_store_unordered_maps_get::codegen( |
911 | CompilerCB*, |
912 | static_context* sctx, |
913 | const QueryLoc& loc, |
914 | @@ -71,7 +61,7 @@ |
915 | return new MapGetIterator(sctx, loc, argv); |
916 | } |
917 | |
918 | -PlanIter_t zorba_store_data_structure_unordered_map_insert::codegen( |
919 | +PlanIter_t zorba_store_unordered_maps_insert::codegen( |
920 | CompilerCB*, |
921 | static_context* sctx, |
922 | const QueryLoc& loc, |
923 | @@ -81,17 +71,17 @@ |
924 | return new MapInsertIterator(sctx, loc, argv); |
925 | } |
926 | |
927 | -PlanIter_t zorba_store_data_structure_unordered_map_remove::codegen( |
928 | +PlanIter_t zorba_store_unordered_maps_delete::codegen( |
929 | CompilerCB*, |
930 | static_context* sctx, |
931 | const QueryLoc& loc, |
932 | std::vector<PlanIter_t>& argv, |
933 | expr& ann) const |
934 | { |
935 | - return new MapRemoveIterator(sctx, loc, argv); |
936 | + return new MapDeleteIterator(sctx, loc, argv); |
937 | } |
938 | |
939 | -PlanIter_t zorba_store_data_structure_unordered_map_keys::codegen( |
940 | +PlanIter_t zorba_store_unordered_maps_keys::codegen( |
941 | CompilerCB*, |
942 | static_context* sctx, |
943 | const QueryLoc& loc, |
944 | @@ -101,7 +91,7 @@ |
945 | return new MapKeysIterator(sctx, loc, argv); |
946 | } |
947 | |
948 | -PlanIter_t zorba_store_data_structure_unordered_map_size::codegen( |
949 | +PlanIter_t zorba_store_unordered_maps_size::codegen( |
950 | CompilerCB*, |
951 | static_context* sctx, |
952 | const QueryLoc& loc, |
953 | @@ -111,7 +101,7 @@ |
954 | return new MapSizeIterator(sctx, loc, argv); |
955 | } |
956 | |
957 | -PlanIter_t zorba_store_data_structure_unordered_map_available_maps::codegen( |
958 | +PlanIter_t zorba_store_unordered_maps_available_maps::codegen( |
959 | CompilerCB*, |
960 | static_context* sctx, |
961 | const QueryLoc& loc, |
962 | @@ -121,14 +111,14 @@ |
963 | return new AvailableMapsIterator(sctx, loc, argv); |
964 | } |
965 | |
966 | -PlanIter_t zorba_store_data_structure_unordered_map_is_transient::codegen( |
967 | +PlanIter_t zorba_store_unordered_maps_options::codegen( |
968 | CompilerCB*, |
969 | static_context* sctx, |
970 | const QueryLoc& loc, |
971 | std::vector<PlanIter_t>& argv, |
972 | expr& ann) const |
973 | { |
974 | - return new MapIsTransientIterator(sctx, loc, argv); |
975 | + return new MapOptionsIterator(sctx, loc, argv); |
976 | } |
977 | |
978 | void populate_context_maps(static_context* sctx) |
979 | @@ -136,124 +126,125 @@ |
980 | |
981 | |
982 | { |
983 | - std::vector<xqtref_t> lParamTypes; |
984 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); |
985 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create, |
986 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create"), |
987 | - lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), |
988 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N); |
989 | - |
990 | - } |
991 | - |
992 | - |
993 | - |
994 | - |
995 | - { |
996 | - std::vector<xqtref_t> lParamTypes; |
997 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); |
998 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_create_transient, |
999 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","create-transient"), |
1000 | - lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), |
1001 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N); |
1002 | - |
1003 | - } |
1004 | - |
1005 | - |
1006 | - |
1007 | - |
1008 | - { |
1009 | - DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_delete, |
1010 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","delete"), |
1011 | - GENV_TYPESYSTEM.QNAME_TYPE_ONE, |
1012 | - GENV_TYPESYSTEM.EMPTY_TYPE), |
1013 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1); |
1014 | - |
1015 | - } |
1016 | - |
1017 | - |
1018 | - |
1019 | - |
1020 | - { |
1021 | - std::vector<xqtref_t> lParamTypes; |
1022 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); |
1023 | - lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_get, |
1024 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","get"), |
1025 | - lParamTypes, GENV_TYPESYSTEM.ITEM_TYPE_STAR, true), |
1026 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N); |
1027 | - |
1028 | - } |
1029 | - |
1030 | - |
1031 | - |
1032 | - |
1033 | - { |
1034 | - std::vector<xqtref_t> lParamTypes; |
1035 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); |
1036 | - lParamTypes.push_back(GENV_TYPESYSTEM.ITEM_TYPE_STAR); |
1037 | - lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_insert, |
1038 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","insert"), |
1039 | - lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), |
1040 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N); |
1041 | - |
1042 | - } |
1043 | - |
1044 | - |
1045 | - |
1046 | - |
1047 | - { |
1048 | - std::vector<xqtref_t> lParamTypes; |
1049 | - lParamTypes.push_back(GENV_TYPESYSTEM.QNAME_TYPE_ONE); |
1050 | - lParamTypes.push_back(GENV_TYPESYSTEM.ANY_ATOMIC_TYPE_QUESTION);DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_remove, |
1051 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","remove"), |
1052 | - lParamTypes, GENV_TYPESYSTEM.EMPTY_TYPE, true), |
1053 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N); |
1054 | - |
1055 | - } |
1056 | - |
1057 | - |
1058 | - |
1059 | - |
1060 | - { |
1061 | - DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_keys, |
1062 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","keys"), |
1063 | - GENV_TYPESYSTEM.QNAME_TYPE_ONE, |
1064 | - GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR), |
1065 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1); |
1066 | - |
1067 | - } |
1068 | - |
1069 | - |
1070 | - |
1071 | - |
1072 | - { |
1073 | - DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_size, |
1074 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","size"), |
1075 | - GENV_TYPESYSTEM.QNAME_TYPE_ONE, |
1076 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create, |
1077 | + (createQName("http://zorba.io/modules/unordered-maps","","create"), |
1078 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1079 | + GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1080 | + GENV_TYPESYSTEM.EMPTY_TYPE), |
1081 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_2); |
1082 | + |
1083 | + } |
1084 | + |
1085 | + |
1086 | + |
1087 | + |
1088 | + { |
1089 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_create, |
1090 | + (createQName("http://zorba.io/modules/unordered-maps","","create"), |
1091 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1092 | + GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1093 | + GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE, |
1094 | + GENV_TYPESYSTEM.EMPTY_TYPE), |
1095 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_CREATE_3); |
1096 | + |
1097 | + } |
1098 | + |
1099 | + |
1100 | + |
1101 | + |
1102 | + { |
1103 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_drop, |
1104 | + (createQName("http://zorba.io/modules/unordered-maps","","drop"), |
1105 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1106 | + GENV_TYPESYSTEM.EMPTY_TYPE), |
1107 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DROP_1); |
1108 | + |
1109 | + } |
1110 | + |
1111 | + |
1112 | + |
1113 | + |
1114 | + { |
1115 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_get, |
1116 | + (createQName("http://zorba.io/modules/unordered-maps","","get"), |
1117 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1118 | + GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1119 | + GENV_TYPESYSTEM.ITEM_TYPE_STAR), |
1120 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_GET_2); |
1121 | + |
1122 | + } |
1123 | + |
1124 | + |
1125 | + |
1126 | + |
1127 | + { |
1128 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_insert, |
1129 | + (createQName("http://zorba.io/modules/unordered-maps","","insert"), |
1130 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1131 | + GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1132 | + GENV_TYPESYSTEM.ITEM_TYPE_STAR, |
1133 | + GENV_TYPESYSTEM.EMPTY_TYPE), |
1134 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_INSERT_3); |
1135 | + |
1136 | + } |
1137 | + |
1138 | + |
1139 | + |
1140 | + |
1141 | + { |
1142 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_delete, |
1143 | + (createQName("http://zorba.io/modules/unordered-maps","","delete"), |
1144 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1145 | + GENV_TYPESYSTEM.ITEM_TYPE_ONE, |
1146 | + GENV_TYPESYSTEM.EMPTY_TYPE), |
1147 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_DELETE_2); |
1148 | + |
1149 | + } |
1150 | + |
1151 | + |
1152 | + |
1153 | + |
1154 | + { |
1155 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_keys, |
1156 | + (createQName("http://zorba.io/modules/unordered-maps","","keys"), |
1157 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1158 | + GENV_TYPESYSTEM.JSON_ARRAY_TYPE_STAR), |
1159 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_KEYS_1); |
1160 | + |
1161 | + } |
1162 | + |
1163 | + |
1164 | + |
1165 | + |
1166 | + { |
1167 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_size, |
1168 | + (createQName("http://zorba.io/modules/unordered-maps","","size"), |
1169 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1170 | GENV_TYPESYSTEM.INTEGER_TYPE_ONE), |
1171 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1); |
1172 | - |
1173 | - } |
1174 | - |
1175 | - |
1176 | - |
1177 | - |
1178 | - { |
1179 | - DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_available_maps, |
1180 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","available-maps"), |
1181 | - GENV_TYPESYSTEM.QNAME_TYPE_STAR), |
1182 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0); |
1183 | - |
1184 | - } |
1185 | - |
1186 | - |
1187 | - |
1188 | - |
1189 | - { |
1190 | - DECL_WITH_KIND(sctx, zorba_store_data_structure_unordered_map_is_transient, |
1191 | - (createQName("http://www.zorba-xquery.com/modules/store/data-structures/unordered-map","","is-transient"), |
1192 | - GENV_TYPESYSTEM.QNAME_TYPE_ONE, |
1193 | - GENV_TYPESYSTEM.BOOLEAN_TYPE_ONE), |
1194 | - FunctionConsts::ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1); |
1195 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_SIZE_1); |
1196 | + |
1197 | + } |
1198 | + |
1199 | + |
1200 | + |
1201 | + |
1202 | + { |
1203 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_available_maps, |
1204 | + (createQName("http://zorba.io/modules/unordered-maps","","available-maps"), |
1205 | + GENV_TYPESYSTEM.STRING_TYPE_STAR), |
1206 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0); |
1207 | + |
1208 | + } |
1209 | + |
1210 | + |
1211 | + |
1212 | + |
1213 | + { |
1214 | + DECL_WITH_KIND(sctx, zorba_store_unordered_maps_options, |
1215 | + (createQName("http://zorba.io/modules/unordered-maps","","options"), |
1216 | + GENV_TYPESYSTEM.STRING_TYPE_ONE, |
1217 | + GENV_TYPESYSTEM.JSON_OBJECT_TYPE_ONE), |
1218 | + FunctionConsts::ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1); |
1219 | |
1220 | } |
1221 | |
1222 | |
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 | |
1228 | |
1229 | |
1230 | -//zorba-store-data-structure-unordered-map:create |
1231 | -class zorba_store_data_structure_unordered_map_create : public function |
1232 | -{ |
1233 | -public: |
1234 | - zorba_store_data_structure_unordered_map_create(const signature& sig, FunctionConsts::FunctionKind kind) |
1235 | - : |
1236 | - function(sig, kind) |
1237 | - { |
1238 | - |
1239 | - } |
1240 | - |
1241 | - unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1242 | - |
1243 | - bool accessesDynCtx() const { return true; } |
1244 | - |
1245 | - CODEGEN_DECL(); |
1246 | -}; |
1247 | - |
1248 | - |
1249 | -//zorba-store-data-structure-unordered-map:create-transient |
1250 | -class zorba_store_data_structure_unordered_map_create_transient : public function |
1251 | -{ |
1252 | -public: |
1253 | - zorba_store_data_structure_unordered_map_create_transient(const signature& sig, FunctionConsts::FunctionKind kind) |
1254 | - : |
1255 | - function(sig, kind) |
1256 | - { |
1257 | - |
1258 | - } |
1259 | - |
1260 | - unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1261 | - |
1262 | - bool accessesDynCtx() const { return true; } |
1263 | - |
1264 | - CODEGEN_DECL(); |
1265 | -}; |
1266 | - |
1267 | - |
1268 | -//zorba-store-data-structure-unordered-map:delete |
1269 | -class zorba_store_data_structure_unordered_map_delete : public function |
1270 | -{ |
1271 | -public: |
1272 | - zorba_store_data_structure_unordered_map_delete(const signature& sig, FunctionConsts::FunctionKind kind) |
1273 | - : |
1274 | - function(sig, kind) |
1275 | - { |
1276 | - |
1277 | - } |
1278 | - |
1279 | - unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1280 | - |
1281 | - bool accessesDynCtx() const { return true; } |
1282 | - |
1283 | - CODEGEN_DECL(); |
1284 | -}; |
1285 | - |
1286 | - |
1287 | -//zorba-store-data-structure-unordered-map:get |
1288 | -class zorba_store_data_structure_unordered_map_get : public function |
1289 | -{ |
1290 | -public: |
1291 | - zorba_store_data_structure_unordered_map_get(const signature& sig, FunctionConsts::FunctionKind kind) |
1292 | - : |
1293 | - function(sig, kind) |
1294 | - { |
1295 | - |
1296 | - } |
1297 | - |
1298 | - bool accessesDynCtx() const { return true; } |
1299 | - |
1300 | - CODEGEN_DECL(); |
1301 | -}; |
1302 | - |
1303 | - |
1304 | -//zorba-store-data-structure-unordered-map:insert |
1305 | -class zorba_store_data_structure_unordered_map_insert : public function |
1306 | -{ |
1307 | -public: |
1308 | - zorba_store_data_structure_unordered_map_insert(const signature& sig, FunctionConsts::FunctionKind kind) |
1309 | +//zorba-store-unordered-maps:create |
1310 | +class zorba_store_unordered_maps_create : public function |
1311 | +{ |
1312 | +public: |
1313 | + zorba_store_unordered_maps_create(const signature& sig, FunctionConsts::FunctionKind kind) |
1314 | + : |
1315 | + function(sig, kind) |
1316 | + { |
1317 | + |
1318 | + } |
1319 | + |
1320 | + unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1321 | + |
1322 | + bool accessesDynCtx() const { return true; } |
1323 | + |
1324 | + CODEGEN_DECL(); |
1325 | +}; |
1326 | + |
1327 | + |
1328 | +//zorba-store-unordered-maps:drop |
1329 | +class zorba_store_unordered_maps_drop : public function |
1330 | +{ |
1331 | +public: |
1332 | + zorba_store_unordered_maps_drop(const signature& sig, FunctionConsts::FunctionKind kind) |
1333 | + : |
1334 | + function(sig, kind) |
1335 | + { |
1336 | + |
1337 | + } |
1338 | + |
1339 | + unsigned short getScriptingKind() const { return SEQUENTIAL_FUNC_EXPR; } |
1340 | + |
1341 | + bool accessesDynCtx() const { return true; } |
1342 | + |
1343 | + CODEGEN_DECL(); |
1344 | +}; |
1345 | + |
1346 | + |
1347 | +//zorba-store-unordered-maps:get |
1348 | +class zorba_store_unordered_maps_get : public function |
1349 | +{ |
1350 | +public: |
1351 | + zorba_store_unordered_maps_get(const signature& sig, FunctionConsts::FunctionKind kind) |
1352 | + : |
1353 | + function(sig, kind) |
1354 | + { |
1355 | + |
1356 | + } |
1357 | + |
1358 | + bool accessesDynCtx() const { return true; } |
1359 | + |
1360 | + CODEGEN_DECL(); |
1361 | +}; |
1362 | + |
1363 | + |
1364 | +//zorba-store-unordered-maps:insert |
1365 | +class zorba_store_unordered_maps_insert : public function |
1366 | +{ |
1367 | +public: |
1368 | + zorba_store_unordered_maps_insert(const signature& sig, FunctionConsts::FunctionKind kind) |
1369 | : |
1370 | function(sig, kind) |
1371 | { |
1372 | @@ -133,11 +114,11 @@ |
1373 | }; |
1374 | |
1375 | |
1376 | -//zorba-store-data-structure-unordered-map:remove |
1377 | -class zorba_store_data_structure_unordered_map_remove : public function |
1378 | +//zorba-store-unordered-maps:delete |
1379 | +class zorba_store_unordered_maps_delete : public function |
1380 | { |
1381 | public: |
1382 | - zorba_store_data_structure_unordered_map_remove(const signature& sig, FunctionConsts::FunctionKind kind) |
1383 | + zorba_store_unordered_maps_delete(const signature& sig, FunctionConsts::FunctionKind kind) |
1384 | : |
1385 | function(sig, kind) |
1386 | { |
1387 | @@ -152,62 +133,62 @@ |
1388 | }; |
1389 | |
1390 | |
1391 | -//zorba-store-data-structure-unordered-map:keys |
1392 | -class zorba_store_data_structure_unordered_map_keys : public function |
1393 | -{ |
1394 | -public: |
1395 | - zorba_store_data_structure_unordered_map_keys(const signature& sig, FunctionConsts::FunctionKind kind) |
1396 | - : |
1397 | - function(sig, kind) |
1398 | - { |
1399 | - |
1400 | - } |
1401 | - |
1402 | - bool accessesDynCtx() const { return true; } |
1403 | - |
1404 | - CODEGEN_DECL(); |
1405 | -}; |
1406 | - |
1407 | - |
1408 | -//zorba-store-data-structure-unordered-map:size |
1409 | -class zorba_store_data_structure_unordered_map_size : public function |
1410 | -{ |
1411 | -public: |
1412 | - zorba_store_data_structure_unordered_map_size(const signature& sig, FunctionConsts::FunctionKind kind) |
1413 | - : |
1414 | - function(sig, kind) |
1415 | - { |
1416 | - |
1417 | - } |
1418 | - |
1419 | - bool accessesDynCtx() const { return true; } |
1420 | - |
1421 | - CODEGEN_DECL(); |
1422 | -}; |
1423 | - |
1424 | - |
1425 | -//zorba-store-data-structure-unordered-map:available-maps |
1426 | -class zorba_store_data_structure_unordered_map_available_maps : public function |
1427 | -{ |
1428 | -public: |
1429 | - zorba_store_data_structure_unordered_map_available_maps(const signature& sig, FunctionConsts::FunctionKind kind) |
1430 | - : |
1431 | - function(sig, kind) |
1432 | - { |
1433 | - |
1434 | - } |
1435 | - |
1436 | - bool accessesDynCtx() const { return true; } |
1437 | - |
1438 | - CODEGEN_DECL(); |
1439 | -}; |
1440 | - |
1441 | - |
1442 | -//zorba-store-data-structure-unordered-map:is-transient |
1443 | -class zorba_store_data_structure_unordered_map_is_transient : public function |
1444 | -{ |
1445 | -public: |
1446 | - zorba_store_data_structure_unordered_map_is_transient(const signature& sig, FunctionConsts::FunctionKind kind) |
1447 | +//zorba-store-unordered-maps:keys |
1448 | +class zorba_store_unordered_maps_keys : public function |
1449 | +{ |
1450 | +public: |
1451 | + zorba_store_unordered_maps_keys(const signature& sig, FunctionConsts::FunctionKind kind) |
1452 | + : |
1453 | + function(sig, kind) |
1454 | + { |
1455 | + |
1456 | + } |
1457 | + |
1458 | + bool accessesDynCtx() const { return true; } |
1459 | + |
1460 | + CODEGEN_DECL(); |
1461 | +}; |
1462 | + |
1463 | + |
1464 | +//zorba-store-unordered-maps:size |
1465 | +class zorba_store_unordered_maps_size : public function |
1466 | +{ |
1467 | +public: |
1468 | + zorba_store_unordered_maps_size(const signature& sig, FunctionConsts::FunctionKind kind) |
1469 | + : |
1470 | + function(sig, kind) |
1471 | + { |
1472 | + |
1473 | + } |
1474 | + |
1475 | + bool accessesDynCtx() const { return true; } |
1476 | + |
1477 | + CODEGEN_DECL(); |
1478 | +}; |
1479 | + |
1480 | + |
1481 | +//zorba-store-unordered-maps:available-maps |
1482 | +class zorba_store_unordered_maps_available_maps : public function |
1483 | +{ |
1484 | +public: |
1485 | + zorba_store_unordered_maps_available_maps(const signature& sig, FunctionConsts::FunctionKind kind) |
1486 | + : |
1487 | + function(sig, kind) |
1488 | + { |
1489 | + |
1490 | + } |
1491 | + |
1492 | + bool accessesDynCtx() const { return true; } |
1493 | + |
1494 | + CODEGEN_DECL(); |
1495 | +}; |
1496 | + |
1497 | + |
1498 | +//zorba-store-unordered-maps:options |
1499 | +class zorba_store_unordered_maps_options : public function |
1500 | +{ |
1501 | +public: |
1502 | + zorba_store_unordered_maps_options(const signature& sig, FunctionConsts::FunctionKind kind) |
1503 | : |
1504 | function(sig, kind) |
1505 | { |
1506 | |
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 | ZORBA_STORE_DOCUMENTS_DOCUMENT_1, |
1512 | ZORBA_STORE_DOCUMENTS_AVAILABLE_DOCUMENTS_0, |
1513 | ZORBA_STORE_DOCUMENTS_IS_AVAILABLE_DOCUMENT_1, |
1514 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_N, |
1515 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_CREATE_TRANSIENT_N, |
1516 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_DELETE_1, |
1517 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_GET_N, |
1518 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_INSERT_N, |
1519 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_REMOVE_N, |
1520 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_KEYS_1, |
1521 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_SIZE_1, |
1522 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_AVAILABLE_MAPS_0, |
1523 | - ZORBA_STORE_DATA_STRUCTURE_UNORDERED_MAP_IS_TRANSIENT_1, |
1524 | + ZORBA_STORE_UNORDERED_MAPS_CREATE_2, |
1525 | + ZORBA_STORE_UNORDERED_MAPS_CREATE_3, |
1526 | + ZORBA_STORE_UNORDERED_MAPS_DROP_1, |
1527 | + ZORBA_STORE_UNORDERED_MAPS_GET_2, |
1528 | + ZORBA_STORE_UNORDERED_MAPS_INSERT_3, |
1529 | + ZORBA_STORE_UNORDERED_MAPS_DELETE_2, |
1530 | + ZORBA_STORE_UNORDERED_MAPS_KEYS_1, |
1531 | + ZORBA_STORE_UNORDERED_MAPS_SIZE_1, |
1532 | + ZORBA_STORE_UNORDERED_MAPS_AVAILABLE_MAPS_0, |
1533 | + ZORBA_STORE_UNORDERED_MAPS_OPTIONS_1, |
1534 | FN_CODEPOINTS_TO_STRING_1, |
1535 | FN_STRING_TO_CODEPOINTS_1, |
1536 | FN_COMPARE_2, |
1537 | |
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 | |
1543 | store::Item_t lKeyNodeName; |
1544 | GENV_ITEMFACTORY->createQName(lKeyNodeName, |
1545 | - static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS, |
1546 | + static_context::ZORBA_STORE_UNORDERED_MAPS_FN_NS, |
1547 | "", "key"); |
1548 | |
1549 | IndexKeysIteratorState* state; |
1550 | |
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 | TYPE_AvailableDocumentsIterator, |
1556 | TYPE_IsAvailableDocumentIterator, |
1557 | TYPE_MapCreateIterator, |
1558 | - TYPE_MapCreateTransientIterator, |
1559 | - TYPE_MapDestroyIterator, |
1560 | + TYPE_MapDropIterator, |
1561 | TYPE_MapGetIterator, |
1562 | TYPE_MapInsertIterator, |
1563 | - TYPE_MapRemoveIterator, |
1564 | + TYPE_MapDeleteIterator, |
1565 | TYPE_MapKeysIterator, |
1566 | TYPE_MapSizeIterator, |
1567 | TYPE_AvailableMapsIterator, |
1568 | - TYPE_MapIsTransientIterator, |
1569 | + TYPE_MapOptionsIterator, |
1570 | TYPE_CodepointsToStringIterator, |
1571 | TYPE_StringToCodepointsIterator, |
1572 | TYPE_CompareStrIterator, |
1573 | |
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 | prefix="zorba-store-documents"/> |
1579 | |
1580 | <zorba:namespace |
1581 | - uri="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map" |
1582 | - prefix="zorba-store-data-structure-unordered-map"/> |
1583 | + uri="http://zorba.io/modules/unordered-maps" |
1584 | + prefix="zorba-store-unordered-maps"/> |
1585 | |
1586 | <zorba:namespace |
1587 | uri="http://zorba.io/modules/full-text" |
1588 | |
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 | |
1594 | <zorba:function> |
1595 | |
1596 | - <zorba:signature |
1597 | - variadic="true" |
1598 | - localname="create" |
1599 | - prefix="zorba-store-data-structure-unordered-map"> |
1600 | - <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap --> |
1601 | - <zorba:param>xs:QName</zorba:param> <!-- list of key types --> |
1602 | - <zorba:output>empty-sequence()</zorba:output> |
1603 | - </zorba:signature> |
1604 | - |
1605 | - <zorba:methods> |
1606 | - <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/> |
1607 | - <zorba:accessesDynCtx returnValue="true"/> |
1608 | - </zorba:methods> |
1609 | - |
1610 | - </zorba:function> |
1611 | - |
1612 | -</zorba:iterator> |
1613 | - |
1614 | -<!-- |
1615 | -/******************************************************************************* |
1616 | -********************************************************************************/ |
1617 | ---> |
1618 | -<zorba:iterator name="MapCreateTransientIterator" > |
1619 | - |
1620 | - <zorba:description author="Matthias Brantner"> |
1621 | - </zorba:description> |
1622 | - |
1623 | - <zorba:function> |
1624 | - |
1625 | - <zorba:signature |
1626 | - variadic="true" |
1627 | - localname="create-transient" |
1628 | - prefix="zorba-store-data-structure-unordered-map"> |
1629 | - <zorba:param>xs:QName</zorba:param> <!-- name of the hashmap --> |
1630 | - <zorba:param>xs:QName</zorba:param> <!-- list of key types --> |
1631 | - <zorba:output>empty-sequence()</zorba:output> |
1632 | - </zorba:signature> |
1633 | - |
1634 | - <zorba:methods> |
1635 | - <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/> |
1636 | - <zorba:accessesDynCtx returnValue="true"/> |
1637 | - </zorba:methods> |
1638 | - |
1639 | - </zorba:function> |
1640 | - |
1641 | -</zorba:iterator> |
1642 | - |
1643 | -<!-- |
1644 | -/******************************************************************************* |
1645 | -********************************************************************************/ |
1646 | ---> |
1647 | -<zorba:iterator name="MapDestroyIterator" > |
1648 | - |
1649 | - <zorba:description author="Matthias Brantner"> |
1650 | - </zorba:description> |
1651 | - |
1652 | - <zorba:function> |
1653 | - |
1654 | - <zorba:signature localname="delete" prefix="zorba-store-data-structure-unordered-map"> |
1655 | - <zorba:param>xs:QName</zorba:param> |
1656 | + <zorba:signature localname="create" prefix="zorba-store-unordered-maps"> |
1657 | + <zorba:param>xs:string</zorba:param> <!-- name of the hashmap --> |
1658 | + <zorba:param>item()</zorba:param> <!-- list of key types --> |
1659 | + <zorba:output>empty-sequence()</zorba:output> |
1660 | + </zorba:signature> |
1661 | + |
1662 | + <zorba:signature localname="create" prefix="zorba-store-unordered-maps"> |
1663 | + <zorba:param>xs:string</zorba:param> <!-- name of the hashmap --> |
1664 | + <zorba:param>item()</zorba:param> <!-- list of key types --> |
1665 | + <zorba:param>object()</zorba:param> <!-- options object --> |
1666 | + <zorba:output>empty-sequence()</zorba:output> |
1667 | + </zorba:signature> |
1668 | + |
1669 | + <zorba:methods> |
1670 | + <zorba:getScriptingKind returnValue="SEQUENTIAL_FUNC_EXPR"/> |
1671 | + <zorba:accessesDynCtx returnValue="true"/> |
1672 | + </zorba:methods> |
1673 | + |
1674 | + </zorba:function> |
1675 | + |
1676 | +</zorba:iterator> |
1677 | + |
1678 | +<!-- |
1679 | +/******************************************************************************* |
1680 | +********************************************************************************/ |
1681 | +--> |
1682 | +<zorba:iterator name="MapDropIterator" > |
1683 | + |
1684 | + <zorba:description author="Matthias Brantner"> |
1685 | + </zorba:description> |
1686 | + |
1687 | + <zorba:function> |
1688 | + |
1689 | + <zorba:signature localname="drop" prefix="zorba-store-unordered-maps"> |
1690 | + <zorba:param>xs:string</zorba:param> |
1691 | <zorba:output>empty-sequence()</zorba:output> |
1692 | </zorba:signature> |
1693 | |
1694 | @@ -116,9 +91,9 @@ |
1695 | |
1696 | <zorba:function> |
1697 | |
1698 | - <zorba:signature variadic="true" localname="get" prefix="zorba-store-data-structure-unordered-map"> |
1699 | - <zorba:param>xs:QName</zorba:param> |
1700 | - <zorba:param>xs:anyAtomicType?</zorba:param> |
1701 | + <zorba:signature localname="get" prefix="zorba-store-unordered-maps"> |
1702 | + <zorba:param>xs:string</zorba:param> |
1703 | + <zorba:param>item()</zorba:param> |
1704 | <zorba:output>item()*</zorba:output> |
1705 | </zorba:signature> |
1706 | |
1707 | @@ -146,10 +121,10 @@ |
1708 | |
1709 | <zorba:function> |
1710 | |
1711 | - <zorba:signature variadic="true" localname="insert" prefix="zorba-store-data-structure-unordered-map"> |
1712 | - <zorba:param>xs:QName</zorba:param> |
1713 | - <zorba:param>item()*</zorba:param> <!-- value --> |
1714 | - <zorba:param>xs:anyAtomicType?</zorba:param> <!-- list of keys --> |
1715 | + <zorba:signature localname="insert" prefix="zorba-store-unordered-maps"> |
1716 | + <zorba:param>xs:string</zorba:param> |
1717 | + <zorba:param>item()</zorba:param> |
1718 | + <zorba:param>item()*</zorba:param> |
1719 | <zorba:output>empty-sequence()</zorba:output> |
1720 | </zorba:signature> |
1721 | |
1722 | @@ -167,7 +142,7 @@ |
1723 | /******************************************************************************* |
1724 | ********************************************************************************/ |
1725 | --> |
1726 | -<zorba:iterator name="MapRemoveIterator" > |
1727 | +<zorba:iterator name="MapDeleteIterator" > |
1728 | |
1729 | <zorba:description author="Matthias Brantner"> |
1730 | </zorba:description> |
1731 | @@ -175,12 +150,11 @@ |
1732 | <zorba:function> |
1733 | |
1734 | <zorba:signature |
1735 | - variadic="true" |
1736 | - localname="remove" |
1737 | - prefix="zorba-store-data-structure-unordered-map"> |
1738 | + localname="delete" |
1739 | + prefix="zorba-store-unordered-maps"> |
1740 | |
1741 | - <zorba:param>xs:QName</zorba:param> |
1742 | - <zorba:param>xs:anyAtomicType?</zorba:param> |
1743 | + <zorba:param>xs:string</zorba:param> |
1744 | + <zorba:param>item()</zorba:param> |
1745 | <zorba:output>empty-sequence()</zorba:output> |
1746 | </zorba:signature> |
1747 | |
1748 | @@ -204,9 +178,9 @@ |
1749 | |
1750 | <zorba:function> |
1751 | |
1752 | - <zorba:signature localname="keys" prefix="zorba-store-data-structure-unordered-map"> |
1753 | - <zorba:param>xs:QName</zorba:param> |
1754 | - <zorba:output>node()*</zorba:output> |
1755 | + <zorba:signature localname="keys" prefix="zorba-store-unordered-maps"> |
1756 | + <zorba:param>xs:string</zorba:param> |
1757 | + <zorba:output>array()*</zorba:output> |
1758 | </zorba:signature> |
1759 | |
1760 | <zorba:methods> |
1761 | @@ -219,8 +193,6 @@ |
1762 | <zorba:member type="store::Index::KeyIterator_t" name="theIter"/> |
1763 | </zorba:state> |
1764 | |
1765 | - <zorba:member type="store::NsBindings" name="theNSBindings" brief=""/> |
1766 | - |
1767 | </zorba:iterator> |
1768 | |
1769 | <!-- |
1770 | @@ -234,8 +206,8 @@ |
1771 | |
1772 | <zorba:function> |
1773 | |
1774 | - <zorba:signature localname="size" prefix="zorba-store-data-structure-unordered-map"> |
1775 | - <zorba:param>xs:QName</zorba:param> |
1776 | + <zorba:signature localname="size" prefix="zorba-store-unordered-maps"> |
1777 | + <zorba:param>xs:string</zorba:param> |
1778 | <zorba:output>xs:integer</zorba:output> |
1779 | </zorba:signature> |
1780 | |
1781 | @@ -258,8 +230,8 @@ |
1782 | |
1783 | <zorba:function> |
1784 | |
1785 | - <zorba:signature localname="available-maps" prefix="zorba-store-data-structure-unordered-map"> |
1786 | - <zorba:output>xs:QName*</zorba:output> |
1787 | + <zorba:signature localname="available-maps" prefix="zorba-store-unordered-maps"> |
1788 | + <zorba:output>xs:string*</zorba:output> |
1789 | </zorba:signature> |
1790 | |
1791 | <zorba:methods> |
1792 | @@ -285,16 +257,16 @@ |
1793 | /******************************************************************************* |
1794 | ********************************************************************************/ |
1795 | --> |
1796 | -<zorba:iterator name="MapIsTransientIterator" > |
1797 | +<zorba:iterator name="MapOptionsIterator" > |
1798 | |
1799 | <zorba:description author="Matthias Brantner"> |
1800 | </zorba:description> |
1801 | |
1802 | <zorba:function> |
1803 | |
1804 | - <zorba:signature localname="is-transient" prefix="zorba-store-data-structure-unordered-map"> |
1805 | - <zorba:param>xs:QName</zorba:param> |
1806 | - <zorba:output>xs:boolean</zorba:output> |
1807 | + <zorba:signature localname="options" prefix="zorba-store-unordered-maps"> |
1808 | + <zorba:param>xs:string</zorba:param> |
1809 | + <zorba:output>object()</zorba:output> |
1810 | </zorba:signature> |
1811 | |
1812 | <zorba:methods> |
1813 | |
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 | |
1819 | /******************************************************************************* |
1820 | ********************************************************************************/ |
1821 | +zstring |
1822 | +getMapURI( |
1823 | + const static_context* sctx, |
1824 | + const QueryLoc& aLoc) |
1825 | +{ |
1826 | + return "http://zorba.io/maps"; |
1827 | +} |
1828 | + |
1829 | +/******************************************************************************* |
1830 | +********************************************************************************/ |
1831 | +void |
1832 | +createMapQName( |
1833 | + store::Item_t& name, |
1834 | + const static_context* sctx, |
1835 | + const QueryLoc& loc) |
1836 | +{ |
1837 | + GENV_ITEMFACTORY->createQName(name, getMapURI(sctx, loc), |
1838 | + "", name->getStringValue()); |
1839 | +} |
1840 | + |
1841 | + |
1842 | +/******************************************************************************* |
1843 | +********************************************************************************/ |
1844 | void |
1845 | castOrCheckIndexType( |
1846 | store::Item_t& aKeyItem, |
1847 | @@ -100,6 +123,214 @@ |
1848 | /******************************************************************************* |
1849 | ********************************************************************************/ |
1850 | void |
1851 | +createKeysArray( |
1852 | + store::IndexKey& aKey, |
1853 | + store::Item_t& aArray) |
1854 | +{ |
1855 | + std::vector<store::Item_t> lValues; |
1856 | + lValues.reserve(aKey.size()); |
1857 | + |
1858 | + size_t i = 1; |
1859 | + |
1860 | + // build [ key1, null, key3 ] |
1861 | + for (store::ItemVector::iterator lIter = aKey.begin(); |
1862 | + lIter != aKey.end(); |
1863 | + ++lIter, ++i) |
1864 | + { |
1865 | + lValues.resize(i); |
1866 | + |
1867 | + store::Item_t lValue = *lIter; |
1868 | + if (lValue) |
1869 | + { |
1870 | + lValues[i - 1] = (*lIter); |
1871 | + } |
1872 | + else |
1873 | + { |
1874 | + GENV_ITEMFACTORY->createJSONNull(lValues[i - 1]); |
1875 | + } |
1876 | + } |
1877 | + |
1878 | + GENV_ITEMFACTORY->createJSONArray(aArray, lValues); |
1879 | +} |
1880 | + |
1881 | + |
1882 | +/******************************************************************************* |
1883 | +********************************************************************************/ |
1884 | +void |
1885 | +processTypes( |
1886 | + const store::Item_t& aMapName, |
1887 | + const QueryLoc& loc, |
1888 | + std::vector<store::Item_t>& aTypes) |
1889 | +{ |
1890 | + for (size_t i = 0; i < aTypes.size(); ++i) |
1891 | + { |
1892 | + store::Item_t& lType = aTypes[i]; |
1893 | + |
1894 | + if (!lType->isAtomic()) |
1895 | + { |
1896 | + RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc, |
1897 | + ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)), |
1898 | + "anyAtomicType", |
1899 | + aMapName->getStringValue())); |
1900 | + } |
1901 | + |
1902 | + if (TypeOps::is_subtype(lType->getTypeCode(), store::XS_STRING)) |
1903 | + { |
1904 | + zstring t = lType->getStringValue(); |
1905 | + std::transform(t.begin(), t.end(), t.begin(), zorba::unicode::to_lower); |
1906 | + if (t == "string") |
1907 | + lType = GENV_TYPESYSTEM.XS_STRING_QNAME; |
1908 | + else if (t == "integer") |
1909 | + lType = GENV_TYPESYSTEM.XS_INTEGER_QNAME; |
1910 | + else if (t == "boolean") |
1911 | + lType = GENV_TYPESYSTEM.XS_BOOLEAN_QNAME; |
1912 | + else if (t == "datetime") |
1913 | + lType = GENV_TYPESYSTEM.XS_DATETIME_QNAME; |
1914 | + else if (t == "date") |
1915 | + lType = GENV_TYPESYSTEM.XS_DATE_QNAME; |
1916 | + else if (t == "time") |
1917 | + lType = GENV_TYPESYSTEM.XS_TIME_QNAME; |
1918 | + else if (t == "duration") |
1919 | + lType = GENV_TYPESYSTEM.XS_DURATION_QNAME; |
1920 | + else if (t == "daytimeduration") |
1921 | + lType = GENV_TYPESYSTEM.XS_DT_DURATION_QNAME; |
1922 | + else if (t == "yearmonthduration") |
1923 | + lType = GENV_TYPESYSTEM.XS_YM_DURATION_QNAME; |
1924 | + else if (t == "float") |
1925 | + lType = GENV_TYPESYSTEM.XS_FLOAT_QNAME; |
1926 | + else if (t == "double") |
1927 | + lType = GENV_TYPESYSTEM.XS_DOUBLE_QNAME; |
1928 | + else if (t == "decimal") |
1929 | + lType = GENV_TYPESYSTEM.XS_DECIMAL_QNAME; |
1930 | + else if (t == "long") |
1931 | + lType = GENV_TYPESYSTEM.XS_LONG_QNAME; |
1932 | + else if (t == "int") |
1933 | + lType = GENV_TYPESYSTEM.XS_INT_QNAME; |
1934 | + else if (t == "short") |
1935 | + lType = GENV_TYPESYSTEM.XS_SHORT_QNAME; |
1936 | + else if (t == "byte") |
1937 | + lType = GENV_TYPESYSTEM.XS_BYTE_QNAME; |
1938 | + else if (t == "base64binary") |
1939 | + lType = GENV_TYPESYSTEM.XS_BASE64BINARY_QNAME; |
1940 | + else if (t == "hexbinary") |
1941 | + lType = GENV_TYPESYSTEM.XS_HEXBINARY_QNAME; |
1942 | + else if (t == "null") |
1943 | + lType = GENV_TYPESYSTEM.JS_NULL_QNAME; |
1944 | + else |
1945 | + RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc, |
1946 | + ERROR_PARAMS(t, |
1947 | + "anyAtomicType", |
1948 | + aMapName->getStringValue())); |
1949 | + } |
1950 | + else if (!TypeOps::is_subtype(lType->getTypeCode(), store::XS_QNAME)) |
1951 | + { |
1952 | + RAISE_ERROR(zerr::ZXQD0005_INVALID_KEY_FOR_MAP, loc, |
1953 | + ERROR_PARAMS(*(GENV_TYPESYSTEM.create_value_type(lType)), |
1954 | + "QName", |
1955 | + aMapName->getStringValue())); |
1956 | + } |
1957 | + } |
1958 | +} |
1959 | + |
1960 | +/******************************************************************************* |
1961 | +********************************************************************************/ |
1962 | +bool |
1963 | +prepareKeyAttributes( |
1964 | + const QueryLoc& loc, |
1965 | + const static_context* sctx, |
1966 | + const store::Item_t& aKey, |
1967 | + store::Index* aMap, |
1968 | + std::vector<store::Item_t>& aKeyAttrs) |
1969 | +{ |
1970 | + if (aKey->isArray()) |
1971 | + { |
1972 | + ulong lNumKeys = to_xs_long(aKey->getArraySize()); |
1973 | + aKeyAttrs.resize(lNumKeys); |
1974 | + for (size_t i = 0; i < lNumKeys; ++i) |
1975 | + { |
1976 | + aKeyAttrs[i] = aKey->getArrayValue(xs_integer(i+1)); |
1977 | + } |
1978 | + } |
1979 | + else |
1980 | + { |
1981 | + aKeyAttrs.push_back(aKey); |
1982 | + } |
1983 | + |
1984 | + const store::IndexSpecification& lSpec = aMap->getSpecification(); |
1985 | + |
1986 | + store::Item_t lName = aMap->getName(); |
1987 | + |
1988 | + if (lSpec.getNumColumns() != aKeyAttrs.size()) |
1989 | + { |
1990 | + RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc, |
1991 | + ERROR_PARAMS(lName->getLocalName(), |
1992 | + "map", |
1993 | + aKeyAttrs.size(), |
1994 | + lSpec.getNumColumns())); |
1995 | + } |
1996 | + |
1997 | + bool lValidProbe = true; |
1998 | + |
1999 | + for (size_t i = 0; i < aKeyAttrs.size(); ++i) |
2000 | + { |
2001 | + store::Item_t& lTmp = aKeyAttrs[i]; |
2002 | + |
2003 | + if (! lTmp->isAtomic()) |
2004 | + { |
2005 | + store::Item_t lVal; |
2006 | + store::Iterator_t lValIter; |
2007 | + lTmp->getTypedValue(lVal, lValIter); |
2008 | + if (! lValIter.isNull()) |
2009 | + { |
2010 | + RAISE_ERROR(err::XPTY0004, loc, |
2011 | + ERROR_PARAMS(ZED(XPTY0004_NoMultiSeqTypePromotion_2), |
2012 | + lSpec.theKeyTypes.at(i))); |
2013 | + } |
2014 | + lTmp = lVal; |
2015 | + } |
2016 | + |
2017 | + namespace_context tmp_ctx(sctx); |
2018 | + castOrCheckIndexType(lTmp, lSpec.theKeyTypes[i], lName, &tmp_ctx, loc); |
2019 | + |
2020 | + if (lTmp == NULL || |
2021 | + (lTmp->isAtomic() && lTmp->getTypeCode() == store::JS_NULL)) |
2022 | + { |
2023 | + lValidProbe = false; |
2024 | + } |
2025 | + } |
2026 | + return lValidProbe; |
2027 | +} |
2028 | + |
2029 | + |
2030 | +/******************************************************************************* |
2031 | +********************************************************************************/ |
2032 | +void |
2033 | +processOption( |
2034 | + const QueryLoc& loc, |
2035 | + const store::Item_t& aOption, |
2036 | + bool& aIsPersistent) |
2037 | +{ |
2038 | + assert(aOption->isObject()); |
2039 | + zstring lTmp("persistent"); |
2040 | + |
2041 | + store::Item_t lPersistentItem; |
2042 | + GENV_ITEMFACTORY->createString(lPersistentItem, lTmp); |
2043 | + |
2044 | + lPersistentItem = aOption->getObjectValue(lPersistentItem); |
2045 | + if (!lPersistentItem->isAtomic() |
2046 | + || lPersistentItem->getTypeCode() != store::XS_BOOLEAN) |
2047 | + { |
2048 | + RAISE_ERROR(zerr::ZDDY0043_INVALID_OPTION_TYPE, |
2049 | + loc, ERROR_PARAMS( |
2050 | + lPersistentItem->getType()->getLocalName(), "persistent", "boolean")); |
2051 | + } |
2052 | + aIsPersistent = lPersistentItem->getBooleanValue(); |
2053 | +} |
2054 | + |
2055 | + |
2056 | +/******************************************************************************* |
2057 | +********************************************************************************/ |
2058 | +void |
2059 | checkMapTypes( |
2060 | std::vector<store::Item_t>& aTypes, |
2061 | const store::Item_t& aMapName, |
2062 | @@ -135,13 +366,14 @@ |
2063 | const store::Item_t& aName, |
2064 | const QueryLoc& aLoc, |
2065 | dynamic_context* aContext, |
2066 | - store::Index*& aIndex) |
2067 | + store::Index*& aIndex, |
2068 | + bool aLookupParent = true) |
2069 | { |
2070 | aIndex = GENV_STORE.getMap(aName); |
2071 | |
2072 | if (aIndex) return true; |
2073 | |
2074 | - aIndex = aContext->getMap(aName.getp()); |
2075 | + aIndex = aContext->getMap(aName.getp(), aLookupParent); |
2076 | |
2077 | if (!aIndex) |
2078 | { |
2079 | @@ -164,124 +396,105 @@ |
2080 | store::Item_t& result, |
2081 | PlanState& aPlanState) const |
2082 | { |
2083 | - store::Item_t lQName; |
2084 | + store::Item_t lName; |
2085 | + store::Item_t lTypeParam; |
2086 | std::vector<store::Item_t> lTypes; |
2087 | - std::vector<zstring> lCollations; |
2088 | - std::auto_ptr<store::PUL> lPul; |
2089 | - long lTimezone = 0; |
2090 | - |
2091 | - PlanIteratorState* state; |
2092 | - DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2093 | - |
2094 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2095 | - |
2096 | - if (GENV_STORE.getMap(lQName) |
2097 | - || aPlanState.theLocalDynCtx->getMap(lQName.getp())) |
2098 | - { |
2099 | - RAISE_ERROR( |
2100 | - zerr::ZSTR0001_INDEX_ALREADY_EXISTS, |
2101 | - loc, |
2102 | - ERROR_PARAMS( lQName->getStringValue() ) |
2103 | - ); |
2104 | - } |
2105 | - |
2106 | - lCollations.resize(theChildren.size() - 1); |
2107 | - lTypes.resize(theChildren.size() - 1); |
2108 | - |
2109 | - for (size_t i = 1; i < theChildren.size(); ++i) |
2110 | - { |
2111 | - consumeNext(lTypes[i-1], theChildren[i].getp(), aPlanState); |
2112 | - } |
2113 | - |
2114 | - checkMapTypes(lTypes, lQName, loc); |
2115 | - |
2116 | - lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); |
2117 | - lPul->addCreateHashMap(&loc, lQName, lTypes, lCollations, lTimezone); |
2118 | - |
2119 | - apply_updates( |
2120 | - aPlanState.theCompilerCB, |
2121 | - aPlanState.theGlobalDynCtx, |
2122 | - theSctx, |
2123 | - lPul.get(), |
2124 | - loc); |
2125 | - |
2126 | - result = NULL; |
2127 | - |
2128 | - STACK_END(state); |
2129 | -} |
2130 | - |
2131 | - |
2132 | -/******************************************************************************* |
2133 | -********************************************************************************/ |
2134 | -bool |
2135 | -MapCreateTransientIterator::nextImpl( |
2136 | - store::Item_t& result, |
2137 | - PlanState& aPlanState) const |
2138 | -{ |
2139 | - store::Item_t lQName; |
2140 | - store::IndexSpecification lSpec; |
2141 | - store::Index_t lIndex; |
2142 | - std::vector<std::string> lCollations; |
2143 | - |
2144 | - PlanIteratorState* state; |
2145 | - DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2146 | - |
2147 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2148 | - |
2149 | - if (GENV_STORE.getMap(lQName) |
2150 | - || aPlanState.theLocalDynCtx->getMap(lQName.getp())) |
2151 | - { |
2152 | - RAISE_ERROR( |
2153 | - zerr::ZSTR0001_INDEX_ALREADY_EXISTS, |
2154 | - loc, |
2155 | - ERROR_PARAMS( lQName->getStringValue() ) |
2156 | - ); |
2157 | - } |
2158 | - |
2159 | - lCollations.resize(theChildren.size() - 1); |
2160 | - lSpec.theKeyTypes.resize(theChildren.size() - 1); |
2161 | - |
2162 | - for (size_t i = 1; i < theChildren.size(); ++i) |
2163 | - { |
2164 | - consumeNext(lSpec.theKeyTypes[i-1], theChildren[i].getp(), aPlanState); |
2165 | - } |
2166 | - |
2167 | - checkMapTypes(lSpec.theKeyTypes, lQName, loc); |
2168 | - |
2169 | - lSpec.theNumKeyColumns = lSpec.theKeyTypes.size(); |
2170 | - lSpec.theIsTemp = true; |
2171 | - lSpec.theCollations = lCollations; |
2172 | - lSpec.theTimezone = 0; |
2173 | - |
2174 | - lIndex = GENV_STORE.createMap(lQName, lSpec); |
2175 | - |
2176 | - aPlanState.theLocalDynCtx->bindMap(lIndex->getName(), lIndex); |
2177 | - |
2178 | - result = NULL; |
2179 | - |
2180 | - STACK_END(state); |
2181 | -} |
2182 | - |
2183 | - |
2184 | -/******************************************************************************* |
2185 | -********************************************************************************/ |
2186 | -bool |
2187 | -MapDestroyIterator::nextImpl( |
2188 | - store::Item_t& result, |
2189 | - PlanState& aPlanState) const |
2190 | -{ |
2191 | - store::Item_t lQName; |
2192 | + bool lPersistent = true; |
2193 | + |
2194 | + PlanIteratorState* state; |
2195 | + DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2196 | + |
2197 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2198 | + createMapQName(lName, theSctx, loc); |
2199 | + |
2200 | + if (GENV_STORE.getMap(lName) |
2201 | + || aPlanState.theLocalDynCtx->getMap(lName.getp())) |
2202 | + { |
2203 | + RAISE_ERROR( |
2204 | + zerr::ZSTR0001_INDEX_ALREADY_EXISTS, |
2205 | + loc, |
2206 | + ERROR_PARAMS( lName->getStringValue() ) |
2207 | + ); |
2208 | + } |
2209 | + |
2210 | + consumeNext(lTypeParam, theChildren[1].getp(), aPlanState); |
2211 | + |
2212 | + if (lTypeParam->isArray()) |
2213 | + { |
2214 | + long lSize = to_xs_long(lTypeParam->getArraySize()); |
2215 | + lTypes.resize(lSize); |
2216 | + for (long i = 1; i <= lSize; ++i) |
2217 | + { |
2218 | + lTypes[i-1] = lTypeParam->getArrayValue(xs_integer(i)); |
2219 | + } |
2220 | + } |
2221 | + else |
2222 | + { |
2223 | + lTypes.push_back(lTypeParam); |
2224 | + } |
2225 | + |
2226 | + if (theChildren.size() == 3) |
2227 | + { |
2228 | + store::Item_t lOptions; |
2229 | + consumeNext(lOptions, theChildren[2].getp(), aPlanState); |
2230 | + processOption(loc, lOptions, lPersistent); |
2231 | + } |
2232 | + |
2233 | + processTypes(lName, loc, lTypes); |
2234 | + checkMapTypes(lTypes, lName, loc); |
2235 | + |
2236 | + if (lPersistent) |
2237 | + { |
2238 | + std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2239 | + std::vector<zstring> lCollations(lTypes.size()); |
2240 | + lPul->addCreateHashMap(&loc, lName, lTypes, lCollations, 0); |
2241 | + |
2242 | + apply_updates( |
2243 | + aPlanState.theCompilerCB, |
2244 | + aPlanState.theGlobalDynCtx, |
2245 | + theSctx, |
2246 | + lPul.get(), |
2247 | + loc); |
2248 | + } |
2249 | + else |
2250 | + { |
2251 | + store::IndexSpecification lSpec; |
2252 | + lSpec.theKeyTypes.swap(lTypes); |
2253 | + lSpec.theNumKeyColumns = lSpec.theKeyTypes.size(); |
2254 | + lSpec.theIsTemp = true; |
2255 | + lSpec.theCollations.resize(lSpec.theKeyTypes.size()); |
2256 | + lSpec.theTimezone = 0; |
2257 | + store::Index_t lMap = GENV_STORE.createMap(lName, lSpec); |
2258 | + |
2259 | + aPlanState.theLocalDynCtx->bindMap(lMap->getName(), lMap); |
2260 | + } |
2261 | + |
2262 | + result = NULL; |
2263 | + |
2264 | + STACK_END(state); |
2265 | +} |
2266 | + |
2267 | + |
2268 | +/******************************************************************************* |
2269 | +********************************************************************************/ |
2270 | +bool |
2271 | +MapDropIterator::nextImpl( |
2272 | + store::Item_t& result, |
2273 | + PlanState& aPlanState) const |
2274 | +{ |
2275 | + store::Item_t lName; |
2276 | store::Index* lIndex; |
2277 | |
2278 | PlanIteratorState* state; |
2279 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2280 | |
2281 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2282 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2283 | + createMapQName(lName, theSctx, loc); |
2284 | |
2285 | - if (getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex)) |
2286 | + if (getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex, false)) |
2287 | { |
2288 | std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2289 | - lPul->addDestroyHashMap(&loc, lQName); |
2290 | + lPul->addDestroyHashMap(&loc, lName); |
2291 | |
2292 | apply_updates( |
2293 | aPlanState.theCompilerCB, |
2294 | @@ -292,7 +505,7 @@ |
2295 | } |
2296 | else |
2297 | { |
2298 | - aPlanState.theLocalDynCtx->unbindMap(lQName.getp()); |
2299 | + aPlanState.theLocalDynCtx->unbindMap(lName.getp()); |
2300 | } |
2301 | |
2302 | result = NULL; |
2303 | @@ -300,6 +513,7 @@ |
2304 | STACK_END(state); |
2305 | } |
2306 | |
2307 | + |
2308 | /******************************************************************************* |
2309 | ********************************************************************************/ |
2310 | bool |
2311 | @@ -307,55 +521,35 @@ |
2312 | store::Item_t& result, |
2313 | PlanState& aPlanState) const |
2314 | { |
2315 | - store::Item_t lQName; |
2316 | - std::vector<store::Item_t> lKey; |
2317 | - store::Index* lIndex; |
2318 | - ulong i; |
2319 | - store::Item_t lKeyItem; |
2320 | + store::Item_t lName; |
2321 | + store::Item_t lKey; |
2322 | + std::vector<store::Item_t> lKeyAttrs; |
2323 | + store::Index* lMap; |
2324 | store::IndexSpecification lSpec; |
2325 | + bool lValidProbe; |
2326 | |
2327 | MapGetIteratorState* state; |
2328 | DEFAULT_STACK_INIT(MapGetIteratorState, state, aPlanState); |
2329 | |
2330 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2331 | - |
2332 | - getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); |
2333 | - |
2334 | - lSpec = lIndex->getSpecification(); |
2335 | - |
2336 | - if (lSpec.getNumColumns() != theChildren.size() - 1) |
2337 | - { |
2338 | - RAISE_ERROR( |
2339 | - zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, |
2340 | - loc, |
2341 | - ERROR_PARAMS( |
2342 | - lQName->getStringValue(), |
2343 | - "map", |
2344 | - theChildren.size() - 1, |
2345 | - lSpec.getNumColumns() ) |
2346 | - ); |
2347 | - } |
2348 | - |
2349 | - state->theCond = lIndex->createCondition(store::IndexCondition::POINT_VALUE); |
2350 | - |
2351 | - for (i = 1; i < theChildren.size(); ++i) |
2352 | - { |
2353 | - if (!consumeNext(lKeyItem, theChildren[i], aPlanState)) |
2354 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2355 | + createMapQName(lName, theSctx, loc); |
2356 | + |
2357 | + getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); |
2358 | + |
2359 | + consumeNext(lKey, theChildren[1].getp(), aPlanState); |
2360 | + |
2361 | + state->theCond = lMap->createCondition(store::IndexCondition::POINT_VALUE); |
2362 | + lValidProbe = prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs); |
2363 | + |
2364 | + if (lValidProbe) |
2365 | + { |
2366 | + for (size_t i = 0; i < lKeyAttrs.size(); ++i) |
2367 | { |
2368 | - // Return the empty seq if any of the search key items is the empty seq. |
2369 | - break; |
2370 | + state->theCond->pushItem(lKeyAttrs[i]); |
2371 | } |
2372 | |
2373 | - namespace_context tmp_ctx(theSctx); |
2374 | - castOrCheckIndexType(lKeyItem, lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc); |
2375 | - |
2376 | - state->theCond->pushItem(lKeyItem); |
2377 | - } |
2378 | - |
2379 | - if (i == theChildren.size()) |
2380 | - { |
2381 | state->theIter = GENV_STORE.getIteratorFactory()-> |
2382 | - createIndexProbeIterator(lIndex); |
2383 | + createIndexProbeIterator(lMap); |
2384 | |
2385 | state->theIter->init(state->theCond); |
2386 | state->theIter->open(); |
2387 | @@ -377,53 +571,31 @@ |
2388 | store::Item_t& result, |
2389 | PlanState& aPlanState) const |
2390 | { |
2391 | - store::Item_t lQName; |
2392 | - std::vector<store::Item_t> lKey; |
2393 | - store::IndexSpecification lSpec; |
2394 | - store::Index* lIndex; |
2395 | + store::Item_t lName; |
2396 | + store::Item_t lKey; |
2397 | + std::vector<store::Item_t> lKeyAttrs; |
2398 | + store::Index* lMap; |
2399 | bool lPersistent; |
2400 | |
2401 | PlanIteratorState* state; |
2402 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2403 | |
2404 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2405 | - |
2406 | - lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); |
2407 | - |
2408 | - lSpec = lIndex->getSpecification(); |
2409 | - |
2410 | - if (lSpec.getNumColumns() != theChildren.size() - 2) |
2411 | - { |
2412 | - RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc, |
2413 | - ERROR_PARAMS(lQName->getStringValue(), |
2414 | - "map", |
2415 | - theChildren.size() - 2, |
2416 | - lSpec.getNumColumns())); |
2417 | - } |
2418 | - |
2419 | - lKey.resize(theChildren.size() - 2); |
2420 | - for (size_t i = 2; i < theChildren.size(); ++i) |
2421 | - { |
2422 | - if (consumeNext(lKey[i-2], theChildren[i].getp(), aPlanState)) |
2423 | - { |
2424 | - namespace_context tmp_ctx(theSctx); |
2425 | - castOrCheckIndexType( |
2426 | - lKey[i-2], |
2427 | - lSpec.theKeyTypes[i-2], |
2428 | - lQName, |
2429 | - &tmp_ctx, |
2430 | - loc); |
2431 | - } |
2432 | - } |
2433 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2434 | + createMapQName(lName, theSctx, loc); |
2435 | + |
2436 | + lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); |
2437 | + |
2438 | + consumeNext(lKey, theChildren[1].getp(), aPlanState); |
2439 | + |
2440 | + prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs); |
2441 | |
2442 | if (lPersistent) |
2443 | { |
2444 | - std::auto_ptr<store::PUL> lPul; |
2445 | store::Iterator_t lValue |
2446 | - = new PlanIteratorWrapper(theChildren[1], aPlanState); |
2447 | + = new PlanIteratorWrapper(theChildren[2], aPlanState); |
2448 | |
2449 | - lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); |
2450 | - lPul->addInsertIntoHashMap(&loc, lQName, lKey, lValue); |
2451 | + std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2452 | + lPul->addInsertIntoHashMap(&loc, lName, lKeyAttrs, lValue); |
2453 | |
2454 | apply_updates( |
2455 | aPlanState.theCompilerCB, |
2456 | @@ -435,18 +607,27 @@ |
2457 | else |
2458 | { |
2459 | store::Item_t lValue; |
2460 | - while (consumeNext(lValue, theChildren[1], aPlanState)) |
2461 | + while (consumeNext(lValue, theChildren[2], aPlanState)) |
2462 | { |
2463 | + if ((lValue->isNode() || lValue->isArray() || lValue->isObject()) |
2464 | + && lValue->getCollection() == 0) |
2465 | + { |
2466 | + zstring lType = "node"; |
2467 | + if (lValue->isArray()) lType = "array"; |
2468 | + else if (lValue->isObject()) lType = "object"; |
2469 | + |
2470 | + RAISE_ERROR(zerr::ZDDY0042_ITEM_NOT_IN_COLLECTION, loc, |
2471 | + ERROR_PARAMS(lName->getLocalName(), lType)); |
2472 | + } |
2473 | + |
2474 | std::auto_ptr<store::IndexKey> k(new store::IndexKey()); |
2475 | - for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin(); |
2476 | - lIter != lKey.end(); |
2477 | - ++lIter) |
2478 | + for (size_t i = 0; i < lKeyAttrs.size(); ++i) |
2479 | { |
2480 | - k->push_back(*lIter); |
2481 | + k->push_back(lKeyAttrs[i]); |
2482 | } |
2483 | |
2484 | store::IndexKey* lKeyPtr = k.get(); |
2485 | - if (!lIndex->insert(lKeyPtr, lValue)) |
2486 | + if (!lMap->insert(lKeyPtr, lValue)) |
2487 | { |
2488 | // the index took the ownership over the key if the index |
2489 | // did _not_ already contain an entry with the same key |
2490 | @@ -464,51 +645,32 @@ |
2491 | /******************************************************************************* |
2492 | ********************************************************************************/ |
2493 | bool |
2494 | -MapRemoveIterator::nextImpl( |
2495 | +MapDeleteIterator::nextImpl( |
2496 | store::Item_t& result, |
2497 | PlanState& aPlanState) const |
2498 | { |
2499 | - store::Item_t lQName; |
2500 | - std::vector<store::Item_t> lKey; |
2501 | - store::Index* lIndex; |
2502 | - ulong i; |
2503 | - store::Item_t lKeyItem; |
2504 | - std::auto_ptr<store::PUL> lPul; |
2505 | - store::IndexSpecification lSpec; |
2506 | + store::Item_t lName; |
2507 | + store::Item_t lKey; |
2508 | + std::vector<store::Item_t> lKeyAttrs; |
2509 | + store::Index* lMap; |
2510 | bool lPersistent; |
2511 | |
2512 | PlanIteratorState* state; |
2513 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2514 | |
2515 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2516 | - |
2517 | - lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); |
2518 | - |
2519 | - lSpec = lIndex->getSpecification(); |
2520 | - |
2521 | - if (lSpec.getNumColumns() != theChildren.size() - 1) |
2522 | - { |
2523 | - RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc, |
2524 | - ERROR_PARAMS(lQName->getStringValue(), |
2525 | - "map", |
2526 | - theChildren.size() - 1, |
2527 | - lSpec.getNumColumns())); |
2528 | - } |
2529 | - |
2530 | - lKey.resize(theChildren.size()-1); |
2531 | - for (i = 1; i < theChildren.size(); ++i) |
2532 | - { |
2533 | - if (consumeNext(lKey[i-1], theChildren[i], aPlanState)) |
2534 | - { |
2535 | - namespace_context tmp_ctx(theSctx); |
2536 | - castOrCheckIndexType(lKey[i-1], lSpec.theKeyTypes[i-1], lQName, &tmp_ctx, loc); |
2537 | - } |
2538 | - } |
2539 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2540 | + createMapQName(lName, theSctx, loc); |
2541 | + |
2542 | + lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); |
2543 | + |
2544 | + consumeNext(lKey, theChildren[1].getp(), aPlanState); |
2545 | + |
2546 | + prepareKeyAttributes(loc, theSctx, lKey, lMap, lKeyAttrs); |
2547 | |
2548 | if (lPersistent) |
2549 | { |
2550 | - lPul.reset(GENV_ITEMFACTORY->createPendingUpdateList()); |
2551 | - lPul->addRemoveFromHashMap(&loc, lQName, lKey); |
2552 | + std::auto_ptr<store::PUL> lPul(GENV_ITEMFACTORY->createPendingUpdateList()); |
2553 | + lPul->addRemoveFromHashMap(&loc, lName, lKeyAttrs); |
2554 | |
2555 | apply_updates( |
2556 | aPlanState.theCompilerCB, |
2557 | @@ -520,14 +682,12 @@ |
2558 | else |
2559 | { |
2560 | store::IndexKey k; |
2561 | - for (std::vector<store::Item_t>::const_iterator lIter = lKey.begin(); |
2562 | - lIter != lKey.end(); |
2563 | - ++lIter) |
2564 | + for (size_t i = 0; i < lKeyAttrs.size(); ++i) |
2565 | { |
2566 | - k.push_back(*lIter); |
2567 | + k.push_back(lKeyAttrs[i]); |
2568 | } |
2569 | store::Item_t lValue; |
2570 | - lIndex->remove(&k, lValue, true); |
2571 | + lMap->remove(&k, lValue, true); |
2572 | } |
2573 | |
2574 | result = NULL; |
2575 | @@ -537,78 +697,33 @@ |
2576 | |
2577 | |
2578 | /******************************************************************************* |
2579 | - |
2580 | ********************************************************************************/ |
2581 | bool |
2582 | MapKeysIterator::nextImpl( |
2583 | store::Item_t& result, |
2584 | PlanState& aPlanState) const |
2585 | { |
2586 | - store::Item_t lQName; |
2587 | + store::Item_t lName; |
2588 | store::Index* lIndex; |
2589 | store::IndexKey lKey; |
2590 | store::Item_t lTypeName; |
2591 | - zstring lBaseURI = |
2592 | - static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS; |
2593 | - |
2594 | - store::Item_t lKeyNodeName; |
2595 | - GENV_ITEMFACTORY->createQName(lKeyNodeName, |
2596 | - static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS, |
2597 | - "", "key"); |
2598 | |
2599 | MapKeysIteratorState* state; |
2600 | DEFAULT_STACK_INIT(MapKeysIteratorState, state, aPlanState); |
2601 | |
2602 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2603 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2604 | + createMapQName(lName, theSctx, loc); |
2605 | |
2606 | - getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); |
2607 | + getMap(lName, loc, aPlanState.theLocalDynCtx, lIndex); |
2608 | |
2609 | state->theIter = lIndex->keys(); |
2610 | |
2611 | state->theIter->open(); |
2612 | |
2613 | - // generate result elements of the form |
2614 | - // <key> |
2615 | - // <attribute value="key1_value"/> |
2616 | - // <attribute value="key2_value"/> |
2617 | - // <attribute value="key3_value"/> |
2618 | - // </key> |
2619 | while (state->theIter->next(lKey)) |
2620 | { |
2621 | - lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME; |
2622 | - |
2623 | - GENV_ITEMFACTORY->createElementNode( |
2624 | - result, NULL, lKeyNodeName, lTypeName, |
2625 | - true, false, theNSBindings, lBaseURI); |
2626 | - |
2627 | - for (store::ItemVector::iterator lIter = lKey.begin(); |
2628 | - lIter != lKey.end(); |
2629 | - ++lIter) |
2630 | - { |
2631 | - store::Item_t lAttrElem, lAttrNodeName; |
2632 | - store::Item_t lNameAttr, lValueAttr, lValueAttrName; |
2633 | - |
2634 | - GENV_ITEMFACTORY->createQName(lAttrNodeName, |
2635 | - static_context::ZORBA_STORE_DYNAMIC_UNORDERED_MAP_FN_NS, |
2636 | - "", "attribute"); |
2637 | - |
2638 | - lTypeName = GENV_TYPESYSTEM.XS_UNTYPED_QNAME; |
2639 | - |
2640 | - GENV_ITEMFACTORY->createElementNode( |
2641 | - lAttrElem, result, lAttrNodeName, lTypeName, |
2642 | - true, false, theNSBindings, lBaseURI); |
2643 | - |
2644 | - store::Item_t& lValue = (*lIter); |
2645 | - if (! lValue.isNull()) |
2646 | - { |
2647 | - GENV_ITEMFACTORY->createQName(lValueAttrName, "", "", "value"); |
2648 | - |
2649 | - lTypeName = lValue->getType(); |
2650 | - |
2651 | - GENV_ITEMFACTORY->createAttributeNode( |
2652 | - lValueAttr, lAttrElem.getp(), lValueAttrName, lTypeName, lValue); |
2653 | - } |
2654 | - } |
2655 | + createKeysArray(lKey, result); |
2656 | + |
2657 | STACK_PUSH(true, state); |
2658 | } |
2659 | |
2660 | @@ -623,17 +738,18 @@ |
2661 | store::Item_t& result, |
2662 | PlanState& aPlanState) const |
2663 | { |
2664 | - store::Item_t lQName; |
2665 | - store::Index* lIndex; |
2666 | + store::Item_t lName; |
2667 | + store::Index* lMap; |
2668 | |
2669 | PlanIteratorState* state; |
2670 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2671 | |
2672 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2673 | - |
2674 | - getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); |
2675 | - |
2676 | - GENV_ITEMFACTORY->createInteger(result, xs_integer(lIndex->size())); |
2677 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2678 | + createMapQName(lName, theSctx, loc); |
2679 | + |
2680 | + getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); |
2681 | + |
2682 | + GENV_ITEMFACTORY->createInteger(result, xs_integer(lMap->size())); |
2683 | |
2684 | STACK_PUSH(true, state); |
2685 | |
2686 | @@ -642,7 +758,6 @@ |
2687 | |
2688 | |
2689 | /******************************************************************************* |
2690 | - |
2691 | ********************************************************************************/ |
2692 | AvailableMapsIteratorState::~AvailableMapsIteratorState() |
2693 | { |
2694 | @@ -676,16 +791,22 @@ |
2695 | bool |
2696 | AvailableMapsIterator::nextImpl(store::Item_t& result, PlanState& planState) const |
2697 | { |
2698 | + store::Item_t lNameItem;; |
2699 | + zstring lLocalName; |
2700 | + |
2701 | AvailableMapsIteratorState * state; |
2702 | - store::Item_t nameItem; |
2703 | - |
2704 | DEFAULT_STACK_INIT(AvailableMapsIteratorState, state, planState); |
2705 | |
2706 | for ((state->persistentMapNamesIter = GENV_STORE.listMapNames())->open (); |
2707 | - state->persistentMapNamesIter->next(nameItem); ) |
2708 | + state->persistentMapNamesIter->next(lNameItem); ) |
2709 | { |
2710 | - result = nameItem; |
2711 | - STACK_PUSH( true, state); |
2712 | + if (lNameItem->getNamespace() != getMapURI(theSctx, loc)) |
2713 | + { |
2714 | + continue; |
2715 | + } |
2716 | + lLocalName = lNameItem->getLocalName(); |
2717 | + GENV_ITEMFACTORY->createString(result, lLocalName); |
2718 | + STACK_PUSH(true, state); |
2719 | } |
2720 | |
2721 | state->persistentMapNamesIter->close(); |
2722 | @@ -696,7 +817,13 @@ |
2723 | state->transientMapNamesIter != state->transientMapNames.end(); |
2724 | ++state->transientMapNamesIter) |
2725 | { |
2726 | - result = *state->transientMapNamesIter; |
2727 | + lNameItem = *state->transientMapNamesIter; |
2728 | + if (lNameItem->getNamespace() != getMapURI(theSctx, loc)) |
2729 | + { |
2730 | + continue; |
2731 | + } |
2732 | + lLocalName = lNameItem->getLocalName(); |
2733 | + GENV_ITEMFACTORY->createString(result, lLocalName); |
2734 | STACK_PUSH( true, state); |
2735 | } |
2736 | |
2737 | @@ -707,22 +834,29 @@ |
2738 | /******************************************************************************* |
2739 | ********************************************************************************/ |
2740 | bool |
2741 | -MapIsTransientIterator::nextImpl( |
2742 | +MapOptionsIterator::nextImpl( |
2743 | store::Item_t& result, |
2744 | PlanState& aPlanState) const |
2745 | { |
2746 | - store::Item_t lQName; |
2747 | - store::Index* lIndex; |
2748 | - bool lPersistent; |
2749 | + store::Item_t lName; |
2750 | + store::Index* lMap; |
2751 | + bool lPersistent; |
2752 | + std::vector<store::Item_t> lNames(1); |
2753 | + std::vector<store::Item_t> lValues(1); |
2754 | + zstring lTmp("persistent"); |
2755 | |
2756 | PlanIteratorState* state; |
2757 | DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState); |
2758 | |
2759 | - consumeNext(lQName, theChildren[0].getp(), aPlanState); |
2760 | - |
2761 | - lPersistent = getMap(lQName, loc, aPlanState.theLocalDynCtx, lIndex); |
2762 | - |
2763 | - GENV_ITEMFACTORY->createBoolean(result, !lPersistent); |
2764 | + consumeNext(lName, theChildren[0].getp(), aPlanState); |
2765 | + createMapQName(lName, theSctx, loc); |
2766 | + |
2767 | + lPersistent = getMap(lName, loc, aPlanState.theLocalDynCtx, lMap); |
2768 | + |
2769 | + GENV_ITEMFACTORY->createString(lNames[0], lTmp); |
2770 | + GENV_ITEMFACTORY->createBoolean(lValues[0], lPersistent); |
2771 | + |
2772 | + GENV_ITEMFACTORY->createJSONObject(result, lNames, lValues); |
2773 | |
2774 | STACK_PUSH(true, state); |
2775 | |
2776 | |
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 | // </MapCreateIterator> |
2782 | |
2783 | |
2784 | -// <MapCreateTransientIterator> |
2785 | -SERIALIZABLE_CLASS_VERSIONS(MapCreateTransientIterator) |
2786 | - |
2787 | -void MapCreateTransientIterator::serialize(::zorba::serialization::Archiver& ar) |
2788 | -{ |
2789 | - serialize_baseclass(ar, |
2790 | - (NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>*)this); |
2791 | -} |
2792 | - |
2793 | - |
2794 | -void MapCreateTransientIterator::accept(PlanIterVisitor& v) const |
2795 | -{ |
2796 | - v.beginVisit(*this); |
2797 | - |
2798 | - std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); |
2799 | - std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); |
2800 | - for ( ; lIter != lEnd; ++lIter ){ |
2801 | - (*lIter)->accept(v); |
2802 | - } |
2803 | - |
2804 | - v.endVisit(*this); |
2805 | -} |
2806 | - |
2807 | -MapCreateTransientIterator::~MapCreateTransientIterator() {} |
2808 | - |
2809 | -// </MapCreateTransientIterator> |
2810 | - |
2811 | - |
2812 | -// <MapDestroyIterator> |
2813 | -SERIALIZABLE_CLASS_VERSIONS(MapDestroyIterator) |
2814 | - |
2815 | -void MapDestroyIterator::serialize(::zorba::serialization::Archiver& ar) |
2816 | -{ |
2817 | - serialize_baseclass(ar, |
2818 | - (NaryBaseIterator<MapDestroyIterator, PlanIteratorState>*)this); |
2819 | -} |
2820 | - |
2821 | - |
2822 | -void MapDestroyIterator::accept(PlanIterVisitor& v) const |
2823 | -{ |
2824 | - v.beginVisit(*this); |
2825 | - |
2826 | - std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); |
2827 | - std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); |
2828 | - for ( ; lIter != lEnd; ++lIter ){ |
2829 | - (*lIter)->accept(v); |
2830 | - } |
2831 | - |
2832 | - v.endVisit(*this); |
2833 | -} |
2834 | - |
2835 | -MapDestroyIterator::~MapDestroyIterator() {} |
2836 | - |
2837 | -// </MapDestroyIterator> |
2838 | +// <MapDropIterator> |
2839 | +SERIALIZABLE_CLASS_VERSIONS(MapDropIterator) |
2840 | + |
2841 | +void MapDropIterator::serialize(::zorba::serialization::Archiver& ar) |
2842 | +{ |
2843 | + serialize_baseclass(ar, |
2844 | + (NaryBaseIterator<MapDropIterator, PlanIteratorState>*)this); |
2845 | +} |
2846 | + |
2847 | + |
2848 | +void MapDropIterator::accept(PlanIterVisitor& v) const |
2849 | +{ |
2850 | + v.beginVisit(*this); |
2851 | + |
2852 | + std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin(); |
2853 | + std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end(); |
2854 | + for ( ; lIter != lEnd; ++lIter ){ |
2855 | + (*lIter)->accept(v); |
2856 | + } |
2857 | + |
2858 | + v.endVisit(*this); |
2859 | +} |
2860 | + |
2861 | +MapDropIterator::~MapDropIterator() {} |
2862 | + |
2863 | +// </MapDropIterator> |
2864 | |
2865 | |
2866 | // <MapGetIterator> |
2867 | @@ -186,17 +158,17 @@ |
2868 | // </MapInsertIterator> |
2869 | |
2870 | |
2871 | -// <MapRemoveIterator> |
2872 | -SERIALIZABLE_CLASS_VERSIONS(MapRemoveIterator) |
2873 | +// <MapDeleteIterator> |
2874 | +SERIALIZABLE_CLASS_VERSIONS(MapDeleteIterator) |
2875 | |
2876 | -void MapRemoveIterator::serialize(::zorba::serialization::Archiver& ar) |
2877 | +void MapDeleteIterator::serialize(::zorba::serialization::Archiver& ar) |
2878 | { |
2879 | serialize_baseclass(ar, |
2880 | - (NaryBaseIterator<MapRemoveIterator, PlanIteratorState>*)this); |
2881 | + (NaryBaseIterator<MapDeleteIterator, PlanIteratorState>*)this); |
2882 | } |
2883 | |
2884 | |
2885 | -void MapRemoveIterator::accept(PlanIterVisitor& v) const |
2886 | +void MapDeleteIterator::accept(PlanIterVisitor& v) const |
2887 | { |
2888 | v.beginVisit(*this); |
2889 | |
2890 | @@ -209,9 +181,9 @@ |
2891 | v.endVisit(*this); |
2892 | } |
2893 | |
2894 | -MapRemoveIterator::~MapRemoveIterator() {} |
2895 | +MapDeleteIterator::~MapDeleteIterator() {} |
2896 | |
2897 | -// </MapRemoveIterator> |
2898 | +// </MapDeleteIterator> |
2899 | |
2900 | |
2901 | // <MapKeysIterator> |
2902 | @@ -221,8 +193,6 @@ |
2903 | { |
2904 | serialize_baseclass(ar, |
2905 | (NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>*)this); |
2906 | - |
2907 | - ar & theNSBindings; |
2908 | } |
2909 | |
2910 | |
2911 | @@ -314,17 +284,17 @@ |
2912 | // </AvailableMapsIterator> |
2913 | |
2914 | |
2915 | -// <MapIsTransientIterator> |
2916 | -SERIALIZABLE_CLASS_VERSIONS(MapIsTransientIterator) |
2917 | +// <MapOptionsIterator> |
2918 | +SERIALIZABLE_CLASS_VERSIONS(MapOptionsIterator) |
2919 | |
2920 | -void MapIsTransientIterator::serialize(::zorba::serialization::Archiver& ar) |
2921 | +void MapOptionsIterator::serialize(::zorba::serialization::Archiver& ar) |
2922 | { |
2923 | serialize_baseclass(ar, |
2924 | - (NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>*)this); |
2925 | + (NaryBaseIterator<MapOptionsIterator, PlanIteratorState>*)this); |
2926 | } |
2927 | |
2928 | |
2929 | -void MapIsTransientIterator::accept(PlanIterVisitor& v) const |
2930 | +void MapOptionsIterator::accept(PlanIterVisitor& v) const |
2931 | { |
2932 | v.beginVisit(*this); |
2933 | |
2934 | @@ -337,9 +307,9 @@ |
2935 | v.endVisit(*this); |
2936 | } |
2937 | |
2938 | -MapIsTransientIterator::~MapIsTransientIterator() {} |
2939 | +MapOptionsIterator::~MapOptionsIterator() {} |
2940 | |
2941 | -// </MapIsTransientIterator> |
2942 | +// </MapOptionsIterator> |
2943 | |
2944 | |
2945 | |
2946 | |
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 | * |
2952 | * Author: Matthias Brantner |
2953 | */ |
2954 | -class MapCreateTransientIterator : public NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState> |
2955 | -{ |
2956 | -public: |
2957 | - SERIALIZABLE_CLASS(MapCreateTransientIterator); |
2958 | - |
2959 | - SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapCreateTransientIterator, |
2960 | - NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>); |
2961 | - |
2962 | - void serialize( ::zorba::serialization::Archiver& ar); |
2963 | - |
2964 | - MapCreateTransientIterator( |
2965 | - static_context* sctx, |
2966 | - const QueryLoc& loc, |
2967 | - std::vector<PlanIter_t>& children) |
2968 | - : |
2969 | - NaryBaseIterator<MapCreateTransientIterator, PlanIteratorState>(sctx, loc, children) |
2970 | - {} |
2971 | - |
2972 | - virtual ~MapCreateTransientIterator(); |
2973 | - |
2974 | - void accept(PlanIterVisitor& v) const; |
2975 | - |
2976 | - bool nextImpl(store::Item_t& result, PlanState& aPlanState) const; |
2977 | -}; |
2978 | - |
2979 | - |
2980 | -/** |
2981 | - * |
2982 | - * |
2983 | - * Author: Matthias Brantner |
2984 | - */ |
2985 | -class MapDestroyIterator : public NaryBaseIterator<MapDestroyIterator, PlanIteratorState> |
2986 | -{ |
2987 | -public: |
2988 | - SERIALIZABLE_CLASS(MapDestroyIterator); |
2989 | - |
2990 | - SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDestroyIterator, |
2991 | - NaryBaseIterator<MapDestroyIterator, PlanIteratorState>); |
2992 | - |
2993 | - void serialize( ::zorba::serialization::Archiver& ar); |
2994 | - |
2995 | - MapDestroyIterator( |
2996 | - static_context* sctx, |
2997 | - const QueryLoc& loc, |
2998 | - std::vector<PlanIter_t>& children) |
2999 | - : |
3000 | - NaryBaseIterator<MapDestroyIterator, PlanIteratorState>(sctx, loc, children) |
3001 | - {} |
3002 | - |
3003 | - virtual ~MapDestroyIterator(); |
3004 | +class MapDropIterator : public NaryBaseIterator<MapDropIterator, PlanIteratorState> |
3005 | +{ |
3006 | +public: |
3007 | + SERIALIZABLE_CLASS(MapDropIterator); |
3008 | + |
3009 | + SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDropIterator, |
3010 | + NaryBaseIterator<MapDropIterator, PlanIteratorState>); |
3011 | + |
3012 | + void serialize( ::zorba::serialization::Archiver& ar); |
3013 | + |
3014 | + MapDropIterator( |
3015 | + static_context* sctx, |
3016 | + const QueryLoc& loc, |
3017 | + std::vector<PlanIter_t>& children) |
3018 | + : |
3019 | + NaryBaseIterator<MapDropIterator, PlanIteratorState>(sctx, loc, children) |
3020 | + {} |
3021 | + |
3022 | + virtual ~MapDropIterator(); |
3023 | |
3024 | void accept(PlanIterVisitor& v) const; |
3025 | |
3026 | @@ -209,25 +178,25 @@ |
3027 | * |
3028 | * Author: Matthias Brantner |
3029 | */ |
3030 | -class MapRemoveIterator : public NaryBaseIterator<MapRemoveIterator, PlanIteratorState> |
3031 | +class MapDeleteIterator : public NaryBaseIterator<MapDeleteIterator, PlanIteratorState> |
3032 | { |
3033 | public: |
3034 | - SERIALIZABLE_CLASS(MapRemoveIterator); |
3035 | + SERIALIZABLE_CLASS(MapDeleteIterator); |
3036 | |
3037 | - SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapRemoveIterator, |
3038 | - NaryBaseIterator<MapRemoveIterator, PlanIteratorState>); |
3039 | + SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapDeleteIterator, |
3040 | + NaryBaseIterator<MapDeleteIterator, PlanIteratorState>); |
3041 | |
3042 | void serialize( ::zorba::serialization::Archiver& ar); |
3043 | |
3044 | - MapRemoveIterator( |
3045 | + MapDeleteIterator( |
3046 | static_context* sctx, |
3047 | const QueryLoc& loc, |
3048 | std::vector<PlanIter_t>& children) |
3049 | : |
3050 | - NaryBaseIterator<MapRemoveIterator, PlanIteratorState>(sctx, loc, children) |
3051 | + NaryBaseIterator<MapDeleteIterator, PlanIteratorState>(sctx, loc, children) |
3052 | {} |
3053 | |
3054 | - virtual ~MapRemoveIterator(); |
3055 | + virtual ~MapDeleteIterator(); |
3056 | |
3057 | void accept(PlanIterVisitor& v) const; |
3058 | |
3059 | @@ -255,8 +224,6 @@ |
3060 | |
3061 | class MapKeysIterator : public NaryBaseIterator<MapKeysIterator, MapKeysIteratorState> |
3062 | { |
3063 | -protected: |
3064 | - store::NsBindings theNSBindings; // |
3065 | public: |
3066 | SERIALIZABLE_CLASS(MapKeysIterator); |
3067 | |
3068 | @@ -270,8 +237,7 @@ |
3069 | const QueryLoc& loc, |
3070 | std::vector<PlanIter_t>& children) |
3071 | : |
3072 | - NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children), |
3073 | - theNSBindings() |
3074 | + NaryBaseIterator<MapKeysIterator, MapKeysIteratorState>(sctx, loc, children) |
3075 | {} |
3076 | |
3077 | virtual ~MapKeysIterator(); |
3078 | @@ -364,25 +330,25 @@ |
3079 | * |
3080 | * Author: Matthias Brantner |
3081 | */ |
3082 | -class MapIsTransientIterator : public NaryBaseIterator<MapIsTransientIterator, PlanIteratorState> |
3083 | +class MapOptionsIterator : public NaryBaseIterator<MapOptionsIterator, PlanIteratorState> |
3084 | { |
3085 | public: |
3086 | - SERIALIZABLE_CLASS(MapIsTransientIterator); |
3087 | + SERIALIZABLE_CLASS(MapOptionsIterator); |
3088 | |
3089 | - SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapIsTransientIterator, |
3090 | - NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>); |
3091 | + SERIALIZABLE_CLASS_CONSTRUCTOR2T(MapOptionsIterator, |
3092 | + NaryBaseIterator<MapOptionsIterator, PlanIteratorState>); |
3093 | |
3094 | void serialize( ::zorba::serialization::Archiver& ar); |
3095 | |
3096 | - MapIsTransientIterator( |
3097 | + MapOptionsIterator( |
3098 | static_context* sctx, |
3099 | const QueryLoc& loc, |
3100 | std::vector<PlanIter_t>& children) |
3101 | : |
3102 | - NaryBaseIterator<MapIsTransientIterator, PlanIteratorState>(sctx, loc, children) |
3103 | + NaryBaseIterator<MapOptionsIterator, PlanIteratorState>(sctx, loc, children) |
3104 | {} |
3105 | |
3106 | - virtual ~MapIsTransientIterator(); |
3107 | + virtual ~MapOptionsIterator(); |
3108 | |
3109 | void accept(PlanIterVisitor& v) const; |
3110 | |
3111 | |
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 | |
3117 | class MapCreateIterator; |
3118 | |
3119 | - class MapCreateTransientIterator; |
3120 | - |
3121 | - class MapDestroyIterator; |
3122 | + class MapDropIterator; |
3123 | |
3124 | class MapGetIterator; |
3125 | |
3126 | class MapInsertIterator; |
3127 | |
3128 | - class MapRemoveIterator; |
3129 | + class MapDeleteIterator; |
3130 | |
3131 | class MapKeysIterator; |
3132 | |
3133 | @@ -679,7 +677,7 @@ |
3134 | |
3135 | class AvailableMapsIterator; |
3136 | |
3137 | - class MapIsTransientIterator; |
3138 | + class MapOptionsIterator; |
3139 | |
3140 | class CodepointsToStringIterator; |
3141 | |
3142 | @@ -1700,11 +1698,8 @@ |
3143 | virtual void beginVisit ( const MapCreateIterator& ) = 0; |
3144 | virtual void endVisit ( const MapCreateIterator& ) = 0; |
3145 | |
3146 | - virtual void beginVisit ( const MapCreateTransientIterator& ) = 0; |
3147 | - virtual void endVisit ( const MapCreateTransientIterator& ) = 0; |
3148 | - |
3149 | - virtual void beginVisit ( const MapDestroyIterator& ) = 0; |
3150 | - virtual void endVisit ( const MapDestroyIterator& ) = 0; |
3151 | + virtual void beginVisit ( const MapDropIterator& ) = 0; |
3152 | + virtual void endVisit ( const MapDropIterator& ) = 0; |
3153 | |
3154 | virtual void beginVisit ( const MapGetIterator& ) = 0; |
3155 | virtual void endVisit ( const MapGetIterator& ) = 0; |
3156 | @@ -1712,8 +1707,8 @@ |
3157 | virtual void beginVisit ( const MapInsertIterator& ) = 0; |
3158 | virtual void endVisit ( const MapInsertIterator& ) = 0; |
3159 | |
3160 | - virtual void beginVisit ( const MapRemoveIterator& ) = 0; |
3161 | - virtual void endVisit ( const MapRemoveIterator& ) = 0; |
3162 | + virtual void beginVisit ( const MapDeleteIterator& ) = 0; |
3163 | + virtual void endVisit ( const MapDeleteIterator& ) = 0; |
3164 | |
3165 | virtual void beginVisit ( const MapKeysIterator& ) = 0; |
3166 | virtual void endVisit ( const MapKeysIterator& ) = 0; |
3167 | @@ -1724,8 +1719,8 @@ |
3168 | virtual void beginVisit ( const AvailableMapsIterator& ) = 0; |
3169 | virtual void endVisit ( const AvailableMapsIterator& ) = 0; |
3170 | |
3171 | - virtual void beginVisit ( const MapIsTransientIterator& ) = 0; |
3172 | - virtual void endVisit ( const MapIsTransientIterator& ) = 0; |
3173 | + virtual void beginVisit ( const MapOptionsIterator& ) = 0; |
3174 | + virtual void endVisit ( const MapOptionsIterator& ) = 0; |
3175 | |
3176 | virtual void beginVisit ( const CodepointsToStringIterator& ) = 0; |
3177 | virtual void endVisit ( const CodepointsToStringIterator& ) = 0; |
3178 | |
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 | // </MapCreateIterator> |
3184 | |
3185 | |
3186 | -// <MapCreateTransientIterator> |
3187 | -void PrinterVisitor::beginVisit ( const MapCreateTransientIterator& a) { |
3188 | - thePrinter.startBeginVisit("MapCreateTransientIterator", ++theId); |
3189 | - printCommons( &a, theId ); |
3190 | - thePrinter.endBeginVisit( theId ); |
3191 | -} |
3192 | - |
3193 | -void PrinterVisitor::endVisit ( const MapCreateTransientIterator& ) { |
3194 | - thePrinter.startEndVisit(); |
3195 | - thePrinter.endEndVisit(); |
3196 | -} |
3197 | -// </MapCreateTransientIterator> |
3198 | - |
3199 | - |
3200 | -// <MapDestroyIterator> |
3201 | -void PrinterVisitor::beginVisit ( const MapDestroyIterator& a) { |
3202 | - thePrinter.startBeginVisit("MapDestroyIterator", ++theId); |
3203 | - printCommons( &a, theId ); |
3204 | - thePrinter.endBeginVisit( theId ); |
3205 | -} |
3206 | - |
3207 | -void PrinterVisitor::endVisit ( const MapDestroyIterator& ) { |
3208 | - thePrinter.startEndVisit(); |
3209 | - thePrinter.endEndVisit(); |
3210 | -} |
3211 | -// </MapDestroyIterator> |
3212 | +// <MapDropIterator> |
3213 | +void PrinterVisitor::beginVisit ( const MapDropIterator& a) { |
3214 | + thePrinter.startBeginVisit("MapDropIterator", ++theId); |
3215 | + printCommons( &a, theId ); |
3216 | + thePrinter.endBeginVisit( theId ); |
3217 | +} |
3218 | + |
3219 | +void PrinterVisitor::endVisit ( const MapDropIterator& ) { |
3220 | + thePrinter.startEndVisit(); |
3221 | + thePrinter.endEndVisit(); |
3222 | +} |
3223 | +// </MapDropIterator> |
3224 | |
3225 | |
3226 | // <MapGetIterator> |
3227 | @@ -4363,18 +4349,18 @@ |
3228 | // </MapInsertIterator> |
3229 | |
3230 | |
3231 | -// <MapRemoveIterator> |
3232 | -void PrinterVisitor::beginVisit ( const MapRemoveIterator& a) { |
3233 | - thePrinter.startBeginVisit("MapRemoveIterator", ++theId); |
3234 | +// <MapDeleteIterator> |
3235 | +void PrinterVisitor::beginVisit ( const MapDeleteIterator& a) { |
3236 | + thePrinter.startBeginVisit("MapDeleteIterator", ++theId); |
3237 | printCommons( &a, theId ); |
3238 | thePrinter.endBeginVisit( theId ); |
3239 | } |
3240 | |
3241 | -void PrinterVisitor::endVisit ( const MapRemoveIterator& ) { |
3242 | +void PrinterVisitor::endVisit ( const MapDeleteIterator& ) { |
3243 | thePrinter.startEndVisit(); |
3244 | thePrinter.endEndVisit(); |
3245 | } |
3246 | -// </MapRemoveIterator> |
3247 | +// </MapDeleteIterator> |
3248 | |
3249 | |
3250 | // <MapKeysIterator> |
3251 | @@ -4419,18 +4405,18 @@ |
3252 | // </AvailableMapsIterator> |
3253 | |
3254 | |
3255 | -// <MapIsTransientIterator> |
3256 | -void PrinterVisitor::beginVisit ( const MapIsTransientIterator& a) { |
3257 | - thePrinter.startBeginVisit("MapIsTransientIterator", ++theId); |
3258 | +// <MapOptionsIterator> |
3259 | +void PrinterVisitor::beginVisit ( const MapOptionsIterator& a) { |
3260 | + thePrinter.startBeginVisit("MapOptionsIterator", ++theId); |
3261 | printCommons( &a, theId ); |
3262 | thePrinter.endBeginVisit( theId ); |
3263 | } |
3264 | |
3265 | -void PrinterVisitor::endVisit ( const MapIsTransientIterator& ) { |
3266 | +void PrinterVisitor::endVisit ( const MapOptionsIterator& ) { |
3267 | thePrinter.startEndVisit(); |
3268 | thePrinter.endEndVisit(); |
3269 | } |
3270 | -// </MapIsTransientIterator> |
3271 | +// </MapOptionsIterator> |
3272 | |
3273 | |
3274 | // <CodepointsToStringIterator> |
3275 | |
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 | void beginVisit( const MapCreateIterator& ); |
3281 | void endVisit ( const MapCreateIterator& ); |
3282 | |
3283 | - void beginVisit( const MapCreateTransientIterator& ); |
3284 | - void endVisit ( const MapCreateTransientIterator& ); |
3285 | - |
3286 | - void beginVisit( const MapDestroyIterator& ); |
3287 | - void endVisit ( const MapDestroyIterator& ); |
3288 | + void beginVisit( const MapDropIterator& ); |
3289 | + void endVisit ( const MapDropIterator& ); |
3290 | |
3291 | void beginVisit( const MapGetIterator& ); |
3292 | void endVisit ( const MapGetIterator& ); |
3293 | @@ -1017,8 +1014,8 @@ |
3294 | void beginVisit( const MapInsertIterator& ); |
3295 | void endVisit ( const MapInsertIterator& ); |
3296 | |
3297 | - void beginVisit( const MapRemoveIterator& ); |
3298 | - void endVisit ( const MapRemoveIterator& ); |
3299 | + void beginVisit( const MapDeleteIterator& ); |
3300 | + void endVisit ( const MapDeleteIterator& ); |
3301 | |
3302 | void beginVisit( const MapKeysIterator& ); |
3303 | void endVisit ( const MapKeysIterator& ); |
3304 | @@ -1029,8 +1026,8 @@ |
3305 | void beginVisit( const AvailableMapsIterator& ); |
3306 | void endVisit ( const AvailableMapsIterator& ); |
3307 | |
3308 | - void beginVisit( const MapIsTransientIterator& ); |
3309 | - void endVisit ( const MapIsTransientIterator& ); |
3310 | + void beginVisit( const MapOptionsIterator& ); |
3311 | + void endVisit ( const MapOptionsIterator& ); |
3312 | |
3313 | void beginVisit( const CodepointsToStringIterator& ); |
3314 | void endVisit ( const CodepointsToStringIterator& ); |
3315 | |
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 | |
3321 | Iterator tree for main query: |
3322 | <SequentialIterator> |
3323 | - <CtxVarDeclareIterator varid="4" varname="co"> |
3324 | + <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT"> |
3325 | + <SingletonIterator value="xs:string(persistent)"/> |
3326 | + </CtxVarDeclareIterator> |
3327 | + <CtxVarDeclareIterator varid="5" varname="co"> |
3328 | <SingletonIterator value="xs:integer(0)"/> |
3329 | </CtxVarDeclareIterator> |
3330 | - <CtxVarDeclareIterator varid="5" varname="map1"> |
3331 | - <SingletonIterator value="xs:QName(,,map-co)"/> |
3332 | + <CtxVarDeclareIterator varid="6" varname="map1"> |
3333 | + <SingletonIterator value="xs:string(map-co)"/> |
3334 | </CtxVarDeclareIterator> |
3335 | - <CtxVarDeclareIterator varid="6" varname="str"> |
3336 | + <CtxVarDeclareIterator varid="7" varname="str"> |
3337 | <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/> |
3338 | </CtxVarDeclareIterator> |
3339 | - <CtxVarDeclareIterator varid="7" varname="input"> |
3340 | + <CtxVarDeclareIterator varid="8" varname="input"> |
3341 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3342 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3343 | <FnDocIterator> |
3344 | @@ -46,25 +49,25 @@ |
3345 | <SequentialIterator> |
3346 | <ApplyIterator> |
3347 | <MapCreateIterator> |
3348 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3349 | - <CtxVarIterator varid="6" varname="str" varkind="global"/> |
3350 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3351 | + <CtxVarIterator varid="7" varname="str" varkind="global"/> |
3352 | </MapCreateIterator> |
3353 | </ApplyIterator> |
3354 | - <CtxVarDeclareIterator varid="8" varname="DG"> |
3355 | + <CtxVarDeclareIterator varid="9" varname="DG"> |
3356 | <UDFunctionCallIterator function="local:collapseNodesSameName"> |
3357 | <TreatIterator quant="+"> |
3358 | - <CtxVarIterator varid="7" varname="input" varkind="global"/> |
3359 | + <CtxVarIterator varid="8" varname="input" varkind="global"/> |
3360 | </TreatIterator> |
3361 | <SingletonIterator value="xs:boolean(true)"/> |
3362 | <SingletonIterator value="xs:string()"/> |
3363 | </UDFunctionCallIterator> |
3364 | </CtxVarDeclareIterator> |
3365 | <ApplyIterator> |
3366 | - <MapDestroyIterator> |
3367 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3368 | - </MapDestroyIterator> |
3369 | + <MapDropIterator> |
3370 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3371 | + </MapDropIterator> |
3372 | </ApplyIterator> |
3373 | - <CtxVarIterator varid="8" varname="DG" varkind="local"/> |
3374 | + <CtxVarIterator varid="9" varname="DG" varkind="local"/> |
3375 | </SequentialIterator> |
3376 | </SequentialIterator> |
3377 | |
3378 | @@ -183,12 +186,10 @@ |
3379 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3380 | <TreatIterator type="xs:integer" quant="?"> |
3381 | <MapGetIterator> |
3382 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3383 | - <PromoteIterator type="xs:anyAtomicType"> |
3384 | - <FnDataIterator> |
3385 | - <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3386 | - </FnDataIterator> |
3387 | - </PromoteIterator> |
3388 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3389 | + <TreatIterator quant=""> |
3390 | + <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3391 | + </TreatIterator> |
3392 | </MapGetIterator> |
3393 | </TreatIterator> |
3394 | </CtxVarAssignIterator> |
3395 | @@ -197,24 +198,22 @@ |
3396 | <CtxVarIterator varid="1" varname="label" varkind="local"/> |
3397 | </FnEmptyIterator> |
3398 | <SequentialIterator> |
3399 | - <CtxVarAssignIterator varid="4" varname="co" varkind="global"> |
3400 | + <CtxVarAssignIterator varid="5" varname="co" varkind="global"> |
3401 | <SpecificNumArithIterator_AddOperation_INTEGER> |
3402 | - <CtxVarIterator varid="4" varname="co" varkind="global"/> |
3403 | + <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3404 | <SingletonIterator value="xs:integer(1)"/> |
3405 | </SpecificNumArithIterator_AddOperation_INTEGER> |
3406 | </CtxVarAssignIterator> |
3407 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3408 | - <CtxVarIterator varid="4" varname="co" varkind="global"/> |
3409 | + <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3410 | </CtxVarAssignIterator> |
3411 | <ApplyIterator> |
3412 | <MapInsertIterator> |
3413 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3414 | - <CtxVarIterator varid="4" varname="co" varkind="global"/> |
3415 | - <PromoteIterator type="xs:anyAtomicType"> |
3416 | - <FnDataIterator> |
3417 | - <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3418 | - </FnDataIterator> |
3419 | - </PromoteIterator> |
3420 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3421 | + <TreatIterator quant=""> |
3422 | + <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3423 | + </TreatIterator> |
3424 | + <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3425 | </MapInsertIterator> |
3426 | </ApplyIterator> |
3427 | </SequentialIterator> |
3428 | |
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 | |
3434 | Iterator tree for main query: |
3435 | <SequentialIterator> |
3436 | - <CtxVarDeclareIterator varid="4" varname="co"> |
3437 | + <CtxVarDeclareIterator varid="4" varname="map:PERSISTENT"> |
3438 | + <SingletonIterator value="xs:string(persistent)"/> |
3439 | + </CtxVarDeclareIterator> |
3440 | + <CtxVarDeclareIterator varid="5" varname="co"> |
3441 | <SingletonIterator value="xs:integer(0)"/> |
3442 | </CtxVarDeclareIterator> |
3443 | - <CtxVarDeclareIterator varid="5" varname="map1"> |
3444 | - <SingletonIterator value="xs:QName(,,map-co)"/> |
3445 | + <CtxVarDeclareIterator varid="6" varname="map1"> |
3446 | + <SingletonIterator value="xs:string(map-co)"/> |
3447 | </CtxVarDeclareIterator> |
3448 | - <CtxVarDeclareIterator varid="6" varname="str"> |
3449 | + <CtxVarDeclareIterator varid="7" varname="str"> |
3450 | <SingletonIterator value="xs:QName(http://www.w3.org/2001/XMLSchema,,string)"/> |
3451 | </CtxVarDeclareIterator> |
3452 | - <CtxVarDeclareIterator varid="7" varname="input"> |
3453 | + <CtxVarDeclareIterator varid="8" varname="input"> |
3454 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3455 | <ChildAxisIterator test kind="match_name_test" qname="*" typename="*" nill allowed="0"> |
3456 | <FnDocIterator> |
3457 | @@ -46,25 +49,25 @@ |
3458 | <SequentialIterator> |
3459 | <ApplyIterator> |
3460 | <MapCreateIterator> |
3461 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3462 | - <CtxVarIterator varid="6" varname="str" varkind="global"/> |
3463 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3464 | + <CtxVarIterator varid="7" varname="str" varkind="global"/> |
3465 | </MapCreateIterator> |
3466 | </ApplyIterator> |
3467 | - <CtxVarDeclareIterator varid="8" varname="DG"> |
3468 | + <CtxVarDeclareIterator varid="9" varname="DG"> |
3469 | <UDFunctionCallIterator function="local:collapseNodesSameName"> |
3470 | <TreatIterator quant="+"> |
3471 | - <CtxVarIterator varid="7" varname="input" varkind="global"/> |
3472 | + <CtxVarIterator varid="8" varname="input" varkind="global"/> |
3473 | </TreatIterator> |
3474 | <SingletonIterator value="xs:boolean(true)"/> |
3475 | <SingletonIterator value="xs:string()"/> |
3476 | </UDFunctionCallIterator> |
3477 | </CtxVarDeclareIterator> |
3478 | <ApplyIterator> |
3479 | - <MapDestroyIterator> |
3480 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3481 | - </MapDestroyIterator> |
3482 | + <MapDropIterator> |
3483 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3484 | + </MapDropIterator> |
3485 | </ApplyIterator> |
3486 | - <CtxVarIterator varid="8" varname="DG" varkind="local"/> |
3487 | + <CtxVarIterator varid="9" varname="DG" varkind="local"/> |
3488 | </SequentialIterator> |
3489 | </SequentialIterator> |
3490 | |
3491 | @@ -183,12 +186,10 @@ |
3492 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3493 | <TreatIterator type="xs:integer" quant="?"> |
3494 | <MapGetIterator> |
3495 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3496 | - <PromoteIterator type="xs:anyAtomicType"> |
3497 | - <FnDataIterator> |
3498 | - <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3499 | - </FnDataIterator> |
3500 | - </PromoteIterator> |
3501 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3502 | + <TreatIterator quant=""> |
3503 | + <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3504 | + </TreatIterator> |
3505 | </MapGetIterator> |
3506 | </TreatIterator> |
3507 | </CtxVarAssignIterator> |
3508 | @@ -197,24 +198,22 @@ |
3509 | <CtxVarIterator varid="1" varname="label" varkind="local"/> |
3510 | </FnEmptyIterator> |
3511 | <SequentialIterator> |
3512 | - <CtxVarAssignIterator varid="4" varname="co" varkind="global"> |
3513 | + <CtxVarAssignIterator varid="5" varname="co" varkind="global"> |
3514 | <SpecificNumArithIterator_AddOperation_INTEGER> |
3515 | - <CtxVarIterator varid="4" varname="co" varkind="global"/> |
3516 | + <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3517 | <SingletonIterator value="xs:integer(1)"/> |
3518 | </SpecificNumArithIterator_AddOperation_INTEGER> |
3519 | </CtxVarAssignIterator> |
3520 | <CtxVarAssignIterator varid="1" varname="label" varkind="local"> |
3521 | - <CtxVarIterator varid="4" varname="co" varkind="global"/> |
3522 | + <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3523 | </CtxVarAssignIterator> |
3524 | <ApplyIterator> |
3525 | <MapInsertIterator> |
3526 | - <CtxVarIterator varid="5" varname="map1" varkind="global"/> |
3527 | - <CtxVarIterator varid="4" varname="co" varkind="global"/> |
3528 | - <PromoteIterator type="xs:anyAtomicType"> |
3529 | - <FnDataIterator> |
3530 | - <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3531 | - </FnDataIterator> |
3532 | - </PromoteIterator> |
3533 | + <CtxVarIterator varid="6" varname="map1" varkind="global"/> |
3534 | + <TreatIterator quant=""> |
3535 | + <CtxVarIterator varid="4" varname="s2" varkind="local"/> |
3536 | + </TreatIterator> |
3537 | + <CtxVarIterator varid="5" varname="co" varkind="global"/> |
3538 | </MapInsertIterator> |
3539 | </ApplyIterator> |
3540 | </SequentialIterator> |
3541 | |
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 |
3547 | |
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 | +map |
3553 | |
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 @@ |
3558 | -<key xmlns="http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"><attribute value="key0"/><attribute value="1"/></key> |
3559 | +[ "key0", 1 ] |
3560 | |
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 @@ |
3565 | -true true 1 key1 value1 true false 3 true true 5 key5 value5 false true key2 false true key4 false false |
3566 | +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 | |
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 @@ |
3572 | -import module namespace map = |
3573 | - "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3574 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3575 | |
3576 | declare namespace ann = "http://zorba.io/annotations"; |
3577 | |
3578 | declare %ann:assignable variable $co as xs:integer :=0; |
3579 | |
3580 | -declare variable $map1 :=xs:QName("map-co"); |
3581 | +declare variable $map1 := "map-co"; |
3582 | |
3583 | declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string"); |
3584 | |
3585 | @@ -58,7 +57,7 @@ |
3586 | { |
3587 | $co := $co +1; |
3588 | $label := $co; |
3589 | - map:insert($map1, $co, $s2); |
3590 | + map:insert($map1, $s2, $co); |
3591 | } |
3592 | else |
3593 | { |
3594 | @@ -80,6 +79,6 @@ |
3595 | |
3596 | variable $DG := local:collapseNodesSameName($input, true(), ""); |
3597 | |
3598 | -map:delete($map1); |
3599 | +map:drop($map1); |
3600 | |
3601 | $DG |
3602 | |
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 @@ |
3607 | -import module namespace map = |
3608 | - "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3609 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3610 | |
3611 | declare namespace ann = "http://zorba.io/annotations"; |
3612 | |
3613 | @@ -9,7 +8,7 @@ |
3614 | |
3615 | declare %ann:assignable variable $co as xs:integer :=0; |
3616 | |
3617 | -declare variable $map1 :=xs:QName("map-co"); |
3618 | +declare variable $map1 := "map-co"; |
3619 | |
3620 | declare variable $str := QName ("http://www.w3.org/2001/XMLSchema", "string"); |
3621 | |
3622 | @@ -62,7 +61,7 @@ |
3623 | { |
3624 | $co := $co +1; |
3625 | $label := $co; |
3626 | - map:insert($map1, $co, $s2); |
3627 | + map:insert($map1, $s2, $co); |
3628 | } |
3629 | else |
3630 | { |
3631 | @@ -82,10 +81,10 @@ |
3632 | }; |
3633 | |
3634 | |
3635 | -map:create($map1,$str) ; |
3636 | +map:create($map1, $str); |
3637 | |
3638 | variable $DG := local:collapseNodesSameName($input, true(), ""); |
3639 | |
3640 | -map:delete($map1); |
3641 | +map:drop($map1); |
3642 | |
3643 | $DG |
3644 | |
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 | import module namespace idd = "http://zorba.io/reference" at "reference.xqlib"; |
3650 | import module namespace id = "http://zorba.io/modules/reference"; |
3651 | import module namespace doc = "http://www.zorba-xquery.com/modules/store/dynamic/documents"; |
3652 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3653 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3654 | |
3655 | variable $node:=<root>global</root>; |
3656 | variable $x := <a>1</a>; |
3657 | fn:put(<root>doc</root>,"doc"); |
3658 | |
3659 | -map:create(xs:QName("local:bar"), xs:QName("xs:integer")); |
3660 | -map:insert(xs:QName("local:bar"), id:reference($x), 1); |
3661 | +map:create("bar", xs:QName("xs:integer")); |
3662 | +map:insert("bar", 1, id:reference($x)); |
3663 | |
3664 | |
3665 | |
3666 | @@ -28,6 +28,6 @@ |
3667 | }</temporary-variable-in-scope> |
3668 | <temporary-variable-in-scope>{variable $temp:=<root>temp</root>; id:dereference(id:reference($temp))}</temporary-variable-in-scope> |
3669 | <in-map> |
3670 | -{id:dereference(map:get(xs:QName("local:bar"), 1))} |
3671 | +{id:dereference(map:get("bar", 1))} |
3672 | </in-map> |
3673 | -</result> |
3674 | \ No newline at end of file |
3675 | +</result> |
3676 | |
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 @@ |
3681 | - |
3682 | - |
3683 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3684 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3685 | |
3686 | declare namespace ann = "http://zorba.io/annotations"; |
3687 | |
3688 | -declare variable $local:processed-internal-links as xs:QName := |
3689 | -xs:QName("processed-internal-links"); |
3690 | +declare variable $local:processed-internal-links as xs:string := "processed-internal-links"; |
3691 | |
3692 | |
3693 | declare variable $result := (); |
3694 | |
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 @@ |
3699 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3700 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3701 | |
3702 | declare namespace ann = "http://zorba.io/annotations"; |
3703 | |
3704 | declare %ann:nonsequential function local:foo() |
3705 | { |
3706 | - map:create(xs:QName("local:mymap"), xs:QName("xs:integer")); |
3707 | + map:create("mymap", xs:QName("xs:integer")); |
3708 | }; |
3709 | |
3710 | local:foo() |
3711 | |
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 @@ |
3716 | -import module namespace x = |
3717 | -"http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3718 | +import module namespace x = "http://zorba.io/modules/unordered-maps"; |
3719 | |
3720 | declare namespace ann = "http://zorba.io/annotations"; |
3721 | |
3722 | @@ -9,7 +8,7 @@ |
3723 | then |
3724 | { |
3725 | variable $req := <a/>; |
3726 | - variable $result := x:create(fn:QName("http://www.zorba-xquery.com/map", "first"), |
3727 | + variable $result := x:create("first", |
3728 | fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer")); |
3729 | |
3730 | $result |
3731 | |
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 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3737 | +import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; |
3738 | + |
3739 | +map:create("map", xs:QName("xs:string"),{ "persistent": false() }); |
3740 | +map:insert("map", "test", 1); |
3741 | +reflection:eval('map:get("map", "test")') |
3742 | |
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 | +Error: http://zorba.io/errors:ZDDY0023 |
3748 | + |
3749 | |
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 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3755 | +import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; |
3756 | + |
3757 | +map:create("map", xs:QName("xs:string"),{ "persistent": false() }); |
3758 | +map:insert("map", "test", 1); |
3759 | +reflection:eval-s('map:drop("map")') |
3760 | |
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 | +Error: http://zorba.io/errors:ZSTR0001 |
3766 | |
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 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3772 | +import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; |
3773 | + |
3774 | +map:create("map", xs:QName("xs:string"),{ "persistent": false() }); |
3775 | +map:insert("map", "test", 1); |
3776 | +reflection:eval-s('map:create("map", xs:QName("xs:string"))') |
3777 | |
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 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3783 | +import module namespace reflection = "http://www.zorba-xquery.com/modules/reflection"; |
3784 | + |
3785 | +map:create("map", xs:QName("xs:string"),{ "persistent": false() }); |
3786 | +reflection:eval('map:available-maps()') |
3787 | + |
3788 | |
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 @@ |
3793 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3794 | - |
3795 | - |
3796 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
3797 | -let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3798 | -return |
3799 | - { |
3800 | - map:create($name, $type); |
3801 | - |
3802 | - ( |
3803 | - for $i in 1 to 1000 |
3804 | - return map:insert($name, concat("value", $i), $i) |
3805 | - ); |
3806 | - |
3807 | - count(map:keys($name)) = map:size($name) |
3808 | - } |
3809 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3810 | + |
3811 | + |
3812 | +{ |
3813 | + map:create("first", "integer"); |
3814 | + |
3815 | + ( |
3816 | + for $i in 1 to 1000 |
3817 | + return map:insert("first", $i, concat("value", $i)) |
3818 | + ); |
3819 | + |
3820 | + count(map:keys("first")) = map:size("first") |
3821 | +} |
3822 | |
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 @@ |
3827 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3828 | - |
3829 | - |
3830 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
3831 | -let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3832 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3833 | + |
3834 | + |
3835 | +let $name := "first" |
3836 | +let $type := "integer" |
3837 | return |
3838 | { |
3839 | map:create($name, $type); |
3840 | |
3841 | ( |
3842 | for $i in 1 to 1000 |
3843 | - return map:insert($name, concat("value", $i), $i) |
3844 | + return map:insert($name, $i, concat("value", $i)) |
3845 | ); |
3846 | |
3847 | map:get($name, 423) |
3848 | |
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 @@ |
3853 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3854 | - |
3855 | - |
3856 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
3857 | -let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3858 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3859 | + |
3860 | + |
3861 | +let $name := "first" |
3862 | +let $type := "integer" |
3863 | return |
3864 | { |
3865 | variable $foo; |
3866 | |
3867 | map:create($name, $type); |
3868 | |
3869 | - map:insert($name, "value1", 1); |
3870 | - map:insert($name, "value2", 1); |
3871 | - map:insert($name, "value3", 2); |
3872 | + map:insert($name, 1, "value1"); |
3873 | + map:insert($name, 1, "value2"); |
3874 | + map:insert($name, 2, "value3"); |
3875 | |
3876 | $foo := map:get($name, 1); |
3877 | |
3878 | - map:remove($name, 1); |
3879 | + map:delete($name, 1); |
3880 | |
3881 | $foo := ($foo, map:get($name, 1), map:size($name), map:available-maps()); |
3882 | |
3883 | |
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 @@ |
3888 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3889 | - |
3890 | - |
3891 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
3892 | -let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:anyAtomicType") |
3893 | -let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3894 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3895 | + |
3896 | + |
3897 | +let $name := "first" |
3898 | +let $type1 := "string" |
3899 | +let $type2 := "integer" |
3900 | return |
3901 | { |
3902 | - map:create($name, $type1, $type2); |
3903 | - |
3904 | - map:insert($name, "value", "key0", 1); |
3905 | - |
3906 | - map:get($name, "key0", 1); |
3907 | + map:create($name, [ $type1, $type2]); |
3908 | + |
3909 | + map:insert($name, ["key0", 1], "value"); |
3910 | + |
3911 | + map:get($name, ["key0", 1]); |
3912 | |
3913 | map:keys($name) |
3914 | } |
3915 | |
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 @@ |
3920 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3921 | - |
3922 | - |
3923 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
3924 | -let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:anyAtomicType") |
3925 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3926 | + |
3927 | + |
3928 | +let $name := "first" |
3929 | +let $type := "decimal" |
3930 | return |
3931 | { |
3932 | map:create($name, $type); |
3933 | - map:insert($name, <a>blub</a>, 3.2); |
3934 | + map:insert($name, 3.2, <a>blub</a>); |
3935 | map:get($name, 3.2) |
3936 | } |
3937 | |
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 @@ |
3942 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3943 | - |
3944 | - |
3945 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
3946 | -let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3947 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3948 | + |
3949 | + |
3950 | +let $name := "first" |
3951 | +let $type := "integer" |
3952 | return |
3953 | { |
3954 | map:create($name, $type); |
3955 | - map:delete(fn:QName("http://www.zorba-xquery.com/map", "second")); |
3956 | + map:drop("second"); |
3957 | } |
3958 | |
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 @@ |
3963 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3964 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3965 | |
3966 | declare namespace zerr = "http://zorba.io/errors"; |
3967 | declare namespace err = "http://www.w3.org/2005/xqt-errors"; |
3968 | |
3969 | |
3970 | -let $name1 := fn:QName("http://www.zorba-xquery.com/map", "first") |
3971 | +let $name1 := "first" |
3972 | let $type1 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string") |
3973 | -let $name2 := fn:QName("http://www.zorba-xquery.com/map", "second") |
3974 | +let $name2 := "second" |
3975 | let $type2 := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
3976 | return |
3977 | { |
3978 | map:create($name1, $type1); |
3979 | map:create($name2, $type2); |
3980 | - map:insert($name1, <a>blub</a>, xs:anyURI("http://www.zorba-xquery.com/")); |
3981 | - map:insert($name1, <a>blub42</a>, 42); |
3982 | - map:insert($name2, <a>blub23</a>, 2); |
3983 | + map:insert($name1, xs:anyURI("http://www.zorba-xquery.com/"), <a>blub</a>); |
3984 | + map:insert($name1, 42, <a>blub42</a>); |
3985 | + map:insert($name2, 2, <a>blub23</a>); |
3986 | ( |
3987 | map:get($name1, "http://www.zorba-xquery.com/"), |
3988 | map:get($name1, 42), |
3989 | |
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 @@ |
3994 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
3995 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
3996 | |
3997 | -variable $name := fn:QName("http://www.zorba-xquery.com/map", "first"); |
3998 | +variable $name := "first"; |
3999 | variable $xs-integer := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer"); |
4000 | variable $xs-string := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:string"); |
4001 | |
4002 | -map:create($name, $xs-integer, $xs-string); |
4003 | +map:create($name, [$xs-integer, $xs-string]); |
4004 | |
4005 | for $i in 1 to 6 |
4006 | -let $value := concat("value", $i), |
4007 | - $key1 := if ($i mod 2 ne 0) then $i else (), |
4008 | - $key2 := if ($i mod 3 ne 0) then concat("key", $i) else () |
4009 | +let $value := concat("value", $i) |
4010 | +let $key1 := $i |
4011 | +let $key2 := concat("key", $i) |
4012 | return |
4013 | - map:insert($name, $value, $key1, $key2); |
4014 | + map:insert($name, [$key1, $key2], $value); |
4015 | |
4016 | -for $k in map:keys($name) |
4017 | -let $key1 := data($k/map:attribute[1]/@value), |
4018 | - $key2 := data($k/map:attribute[2]/@value) |
4019 | +for $k in trace(map:keys($name), "key") |
4020 | +let $key1 := jn:members($k)[1] |
4021 | +let $key2 := jn:members($k)[2] |
4022 | order by $key1, $key2 |
4023 | return |
4024 | ($key1 instance of xs:integer, $key2 instance of xs:string, |
4025 | - $key1, $key2, map:get($name, $key1, $key2)) |
4026 | + $key1, $key2, map:get($name, [$key1, $key2])) |
4027 | |
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 @@ |
4032 | -import module namespace map = "http://www.zorba-xquery.com/modules/store/data-structures/unordered-map"; |
4033 | - |
4034 | - |
4035 | -let $name := fn:QName("http://www.zorba-xquery.com/map", "first") |
4036 | +import module namespace map = "http://zorba.io/modules/unordered-maps"; |
4037 | + |
4038 | + |
4039 | +let $name := "first" |
4040 | let $type := fn:QName("http://www.w3.org/2001/XMLSchema", "xs:integer") |
4041 | return |
4042 | { |
4043 | - map:create-transient($name, $type); |
4044 | + map:create($name, $type, { $map:PERSISTENT : false }); |
4045 | |
4046 | ( |
4047 | for $i in 1 to 1000 |
4048 | - return map:insert($name, concat("value", $i), $i) |
4049 | + return map:insert($name, $i, concat("value", $i)) |
4050 | ); |
4051 | |
4052 | variable $res := <avail>{ map:available-maps() }</avail>; |
4053 | |
4054 | $res := ($res, <contains>{ map:get($name, 5) }</contains>); |
4055 | |
4056 | - map:remove($name, 5); |
4057 | + map:delete($name, 5); |
4058 | |
4059 | $res := ($res, <contains>{ map:get($name, 5) }</contains>); |
4060 | |
4061 | - map:delete($name); |
4062 | + map:drop($name); |
4063 | |
4064 | ($res, <avail>{ map:available-maps() }</avail>) |
4065 | } |
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