Merge lp:~zorba-coders/zorba/feature-fetch_binary into lp:zorba

Proposed by Matthias Brantner
Status: Superseded
Proposed branch: lp:~zorba-coders/zorba/feature-fetch_binary
Merge into: lp:zorba
Diff against target: 1099 lines (+460/-113)
41 files modified
include/zorba/pregenerated/diagnostic_list.h (+1/-1)
include/zorba/uri_resolvers.h (+5/-1)
modules/com/zorba-xquery/www/modules/CMakeLists.txt (+1/-1)
modules/com/zorba-xquery/www/modules/fetch.xq (+93/-46)
src/api/uri_resolver_wrappers.cpp (+3/-1)
src/api/uriresolverimpl.cpp (+7/-4)
src/api/uriresolverimpl.h (+9/-2)
src/capi/error.cpp (+1/-1)
src/context/default_url_resolvers.cpp (+2/-1)
src/context/uri_resolver.cpp (+4/-2)
src/context/uri_resolver.h (+11/-1)
src/diagnostics/diagnostic_en.xml (+6/-2)
src/diagnostics/pregenerated/diagnostic_list.cpp (+1/-1)
src/diagnostics/pregenerated/dict_en.cpp (+2/-1)
src/functions/pregenerated/func_fetch.cpp (+25/-1)
src/functions/pregenerated/func_fetch.h (+17/-0)
src/functions/pregenerated/function_enum.h (+2/-1)
src/runtime/fetch/fetch_impl.cpp (+125/-33)
src/runtime/fetch/pregenerated/fetch.cpp (+22/-0)
src/runtime/fetch/pregenerated/fetch.h (+36/-0)
src/runtime/nodes/nodes_impl.cpp (+4/-2)
src/runtime/spec/fetch/fetch.xml (+29/-3)
src/runtime/visitors/pregenerated/planiter_visitor.h (+5/-0)
src/runtime/visitors/pregenerated/printer_visitor.cpp (+14/-0)
src/runtime/visitors/pregenerated/printer_visitor.h (+3/-0)
src/util/fs_util.cpp (+1/-1)
src/zorbaserialization/archiver.cpp (+1/-1)
test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable_binary.xml.res (+1/-0)
test/rbkt/ExpQueryResults/zorba/fetch/fetch_some_transcode.xml.res (+1/-0)
test/rbkt/Queries/zorba/fetch/fetch_bogus1.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_module1.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_module2.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_random_file.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_schema1.xq (+1/-1)
test/rbkt/Queries/zorba/fetch/fetch_seekable.xml.res (+1/-0)
test/rbkt/Queries/zorba/fetch/fetch_seekable.xq (+8/-0)
test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq (+8/-0)
test/rbkt/Queries/zorba/fetch/fetch_some_transcode.xq (+3/-0)
test/rbkt/Queries/zorba/fetch/iso-8859-1.txt (+1/-0)
To merge this branch: bzr merge lp:~zorba-coders/zorba/feature-fetch_binary
Reviewer Review Type Date Requested Status
Matthias Brantner Approve
Till Westmann Pending
Review via email: mp+105275@code.launchpad.net

This proposal supersedes a proposal from 2012-05-09.

Commit message

- fetch:content-binary
- fetch:content#3 (with encoding parameter)
- StreamResource::isStreamSeekable to make sure the streamable strings returned by fetch are seekable.
- fixed two warnings in nodes_impl.cpp

Description of the change

- fetch:content-binary
- fetch:content#3 (with encoding parameter)
- StreamResource::isStreamSeekable to make sure the streamable strings returned by fetch are seekable.
- fixed two warnings in nodes_impl.cpp

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

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

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job feature-fetch_binary-2012-05-09T01-28-08.563Z is
  finished. The final status was:

  13 tests did not succeed - changes not commited.

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

Revision history for this message
Matthias Brantner (matthias-brantner) :
review: Approve
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :
Revision history for this message
Zorba Build Bot (zorba-buildbot) wrote :

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

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job feature-fetch_binary-2012-05-09T23-08-15.802Z is
  finished. The final status was:

  13 tests did not succeed - changes not commited.

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

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

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

CMake Error at /home/ceej/zo/testing/zorbatest/tester/TarmacLander.cmake:274 (message):
  Validation queue job feature-fetch_binary-2012-05-10T00-17-13.996Z is
  finished. The final status was:

  13 tests did not succeed - changes not commited.

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

10836. By Matthias Brantner

improved error messages + warning fixes

10837. By Matthias Brantner

increase major version number of fetch module

10838. By Matthias Brantner

fetch became non-pure

10839. By Matthias Brantner

expose the SOME_CONTENT entity in the api

10840. By Matthias Brantner

merge + changelog

10841. By Matthias Brantner

change version of the fetch module (3.0 => 2.1)

10842. By Matthias Brantner

improved documentation

10843. By Matthias Brantner

code improvements as suggested by review

10844. By Matthias Brantner

added StaticContext::fetchBinary + StaticContext::fetch with encoding to C++ api

10845. By Matthias Brantner

documentation improvements

10846. By Matthias Brantner

merge

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'ChangeLog'
2=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
3--- include/zorba/pregenerated/diagnostic_list.h 2012-05-03 12:31:51 +0000
4+++ include/zorba/pregenerated/diagnostic_list.h 2012-05-10 02:25:25 +0000
5@@ -420,7 +420,7 @@
6
7 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP0024_XML_DOES_NOT_MATCH_SCHEMA;
8
9-extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP0025_ITEM_CREATION_FAILED;
10+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP0025_COULD_NOT_FETCH_RESOURCE;
11
12 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZXQP0026_INVALID_ENUM_VALUE;
13
14
15=== modified file 'include/zorba/uri_resolvers.h'
16--- include/zorba/uri_resolvers.h 2012-05-03 12:31:51 +0000
17+++ include/zorba/uri_resolvers.h 2012-05-10 02:25:25 +0000
18@@ -84,9 +84,11 @@
19 * @param aStreamReleaser A function pointer which is invoked once
20 * the StreamResource is destroyed. Normally this function will delete
21 * the std::istream object passed to it.
22+ * @param aIsStreamSeekable Determines whether the given stream is seekable.
23 */
24 static StreamResource* create(std::istream* aStream,
25- StreamReleaser aStreamReleaser);
26+ StreamReleaser aStreamReleaser,
27+ bool aIsStreamSeekable = false);
28
29 /**
30 * @brief Retrieve the istream associated with this Resource.
31@@ -99,6 +101,8 @@
32 virtual StreamReleaser getStreamReleaser() = 0;
33
34 virtual ~StreamResource() = 0;
35+
36+ virtual bool isStreamSeekable() const = 0;
37 };
38
39 /**
40
41=== modified file 'modules/com/zorba-xquery/www/modules/CMakeLists.txt'
42--- modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-05-03 12:31:51 +0000
43+++ modules/com/zorba-xquery/www/modules/CMakeLists.txt 2012-05-10 02:25:25 +0000
44@@ -43,7 +43,7 @@
45 DECLARE_ZORBA_SCHEMA(FILE xqdoc.xsd URI "http://www.xqdoc.org/1.0")
46 DECLARE_ZORBA_MODULE(FILE datetime.xq VERSION 2.0
47 URI "http://www.zorba-xquery.com/modules/datetime")
48-DECLARE_ZORBA_MODULE(FILE fetch.xq VERSION 2.0
49+DECLARE_ZORBA_MODULE(FILE fetch.xq VERSION 2.1
50 URI "http://www.zorba-xquery.com/modules/fetch")
51 DECLARE_ZORBA_MODULE(FILE math.xq VERSION 2.0
52 URI "http://www.zorba-xquery.com/modules/math")
53
54=== modified file 'modules/com/zorba-xquery/www/modules/fetch.xq'
55--- modules/com/zorba-xquery/www/modules/fetch.xq 2012-05-03 12:31:51 +0000
56+++ modules/com/zorba-xquery/www/modules/fetch.xq 2012-05-10 02:25:25 +0000
57@@ -17,15 +17,13 @@
58 :)
59
60 (:~
61- : This module provides functions to fetch the contents or the type
62- : of the content for a resource identified by a URI.
63- : For example, it fetches content for file or http resources if Zorba
64- : allows file or http access, respectively.
65- :
66- : <p>The errors raised by functions of this module have the namespace
67- : <tt>http://www.zorba-xquery.com/errors</tt> (associated with prefix zerr).</p>
68- :
69- : @see <a href="www.zorba-xquery.com_errors.html">http://www.zorba-xquery.com/errors</a>
70+ : <p>This module provides functions to fetch the content of a resource identified
71+ : by a URI. For example, it fetches the content of file or http resources.</p>
72+ :
73+ : <p>In order to retrieve such content, the functions use the
74+ : URI resolution and URL resolver process as documented at
75+ : <a href="../../html/uriresolvers.html">
76+ : URI Resolvers</a>.</p>
77 :
78 : @author Matthias Brantner
79 :
80@@ -38,23 +36,15 @@
81 declare namespace zerr = "http://www.zorba-xquery.com/errors";
82
83 declare namespace ver = "http://www.zorba-xquery.com/options/versioning";
84-declare option ver:module-version "2.0";
85+declare option ver:module-version "2.1";
86
87 (:~
88 : <p>Tries to fetch the resource referred to by the given URI.</p>
89 :
90- : <p>In order to retrieve the content, the functions uses the
91- : URI resolution and URL resolver process as documented at
92- : <a href="../../html/uriresolvers.html">
93- : URI Resolvers</a>. Therefore, it queries all URI mappers
94- : and resolvers with kind <tt>EntityData::SOME_CONTENT</tt>.</p>
95+ : <p>It queries all URI mappers and resolvers with kind
96+ : <tt>EntityData::SOME_CONTENT</tt>.</p>
97 :
98- : <p>The function is annotated with the <tt>an:streamable</tt>
99- : annotation, that is it returns a streamable string. A streamable
100- : string can only be consumed once. Please see section "Streamable Strings"
101- : in the <a href="../../html/options_and_annotations.html">
102- : documentation of Zorba's annotations</a>.
103- : </p>
104+ : <p>The content is assumed to be UTF-8 encoded.</p>
105 :
106 : @param $uri the resource to fetch.
107 : @return the resource referred to by the given URI as streamble string.
108@@ -73,28 +63,85 @@
109 (:~
110 : <p>Tries to fetch the resource referred to by the given URI.</p>
111 :
112- : <p>In order to retrieve the content, the functions uses the
113- : URI resolution and URL resolver process as documented at
114- : <a href="../../html/uriresolvers.html">
115- : URI Resolvers</a>. Therefore, it queries all URI mappers
116- : and resolvers with the specified entity kind.</p>
117- :
118- : <p>The function is annotated with the <tt>an:streamable</tt>
119- : annotation, that is it returns a streamable string. A streamable
120- : string can only be consumed once. Please see section "Streamable Strings"
121- : in the <a href="../../html/options_and_annotations.html">
122- : documentation of Zorba's annotations</a>.
123- : </p>
124- :
125- : @param $uri the resource to fetch.
126- : @param $entityKind the kind of resource to fetch.
127- : @return the resource referred to by the given URI as streamble string.
128- :
129- : @error zerr:ZXQP0025 if the URI could not be resolved
130- : or did not resolve to a <tt>StreamResource</tt>.
131- :
132- : @see <a href="../../html/uriresolvers.html">URI Resolvers</a>.
133- : @see <a href="../../html/options_and_annotations.html">Documentation of Zorba's annotations</a>.
134- :)
135-
136-declare %an:streamable function fetch:content($uri as xs:string, $entityKind as xs:string) as xs:string external;
137+ : <p>It queries all URI mappers and resolvers with kind the specified
138+ : entity kind.</p>
139+ :
140+ : <p>The content is assumed to be UTF-8 encoded.</p>
141+ :
142+ : @param $uri the resource to fetch.
143+ : @param $entity-kind the kind of resource to fetch.
144+ : @return the resource referred to by the given URI as streamble string.
145+ :
146+ : @error zerr:ZXQP0025 if the URI could not be resolved
147+ : or did not resolve to a <tt>StreamResource</tt>.
148+ :
149+ : @see <a href="../../html/uriresolvers.html">URI Resolvers</a>.
150+ : @see <a href="../../html/options_and_annotations.html">Documentation of Zorba's annotations</a>.
151+ :)
152+declare %an:streamable function fetch:content($uri as xs:string, $entity-kind as xs:string)
153+as xs:string
154+{
155+ fetch:content($uri, $entity-kind, "UTF-8")
156+};
157+
158+(:~
159+ : <p>Tries to fetch the resource referred to by the given URI.</p>
160+ :
161+ : <p>It queries all URI mappers and resolvers with kind the specified
162+ : entity kind.</p>
163+ :
164+ : @param $uri the resource to fetch.
165+ : @param $entity-kind the kind of resource to fetch.
166+ : @param $encoding the encoding of the content
167+ : @return the resource referred to by the given URI as streamble string.
168+ :
169+ : @error zerr:ZXQP0025 if the URI could not be resolved
170+ : or did not resolve to a <tt>StreamResource</tt>.
171+ : @error zerr:ZXQP0006 if the given encoding is invalid or not supported.
172+ :
173+ : @see <a href="../../html/uriresolvers.html">URI Resolvers</a>.
174+ : @see <a href="../../html/options_and_annotations.html">Documentation of Zorba's annotations</a>.
175+ :)
176+declare %an:streamable function fetch:content(
177+ $uri as xs:string,
178+ $entity-kind as xs:string,
179+ $encoding as xs:string)
180+as xs:string external;
181+
182+(:~
183+ : <p>Tries to fetch the resource referred to by the given URI and
184+ : returning it as base64Binary.</p>
185+ :
186+ : <p>It queries all URI mappers and resolvers with kind
187+ : <tt>EntityData::SOME_CONTENT</tt>.</p>
188+
189+ : @param $uri the resource to fetch.
190+ : @return the resource referred to by the given URI as streamble base64Binary.
191+ :
192+ : @error zerr:ZXQP0025 if the URI could not be resolved
193+ : or did not resolve to a <tt>StreamResource</tt>.
194+ :)
195+declare %an:streamable function fetch:content-binary($uri as xs:string)
196+as xs:base64Binary
197+{
198+ fetch:content-binary($uri, "SOME_CONTENT")
199+};
200+
201+(:~
202+ : <p>Tries to fetch the resource referred to by the given URI and
203+ : returning it as base64Binary.</p>
204+ :
205+ : <p>It queries all URI mappers and resolvers with kind the specified
206+ : entity kind.</p>
207+ :
208+ : @param $uri the resource to fetch.
209+ : @param $entity-kind the kind of resource to fetch.
210+ : @return the resource referred to by the given URI as streamble base64Binary.
211+ :
212+ : @error zerr:ZXQP0025 if the URI could not be resolved
213+ : or did not resolve to a <tt>StreamResource</tt>.
214+ :)
215+declare %an:streamable function fetch:content-binary(
216+ $uri as xs:string,
217+ $entity-kind as xs:string)
218+as xs:base64Binary external;
219
220=== modified file 'src/api/uri_resolver_wrappers.cpp'
221--- src/api/uri_resolver_wrappers.cpp 2012-05-03 12:31:51 +0000
222+++ src/api/uri_resolver_wrappers.cpp 2012-05-10 02:25:25 +0000
223@@ -146,7 +146,9 @@
224 // StreamResource, by passing the StreamReleaser to it and setting the
225 // user's StreamResource's StreamReleaser to nullptr.
226 lRetval = new internal::StreamResource(lUserStream->getStream(),
227- lUserStream->getStreamReleaser());
228+ lUserStream->getStreamReleaser(),
229+ "",
230+ lUserStream->isStreamSeekable());
231 lUserStream->setStreamReleaser(nullptr);
232 }
233 #ifndef ZORBA_NO_FULL_TEXT
234
235=== modified file 'src/api/uriresolverimpl.cpp'
236--- src/api/uriresolverimpl.cpp 2012-05-03 12:31:51 +0000
237+++ src/api/uriresolverimpl.cpp 2012-05-10 02:25:25 +0000
238@@ -43,15 +43,18 @@
239 }
240
241 StreamResource* StreamResource::create(std::istream* aStream,
242- StreamReleaser aStreamReleaser)
243+ StreamReleaser aStreamReleaser,
244+ bool aIsStreamSeekable)
245 {
246- return new StreamResourceImpl(aStream, aStreamReleaser);
247+ return new StreamResourceImpl(aStream, aStreamReleaser, aIsStreamSeekable);
248 }
249
250 StreamResourceImpl::StreamResourceImpl(std::istream* aStream,
251- StreamReleaser aStreamReleaser)
252+ StreamReleaser aStreamReleaser,
253+ bool aIsStreamSeekable)
254 : theStream(aStream),
255- theStreamReleaser(aStreamReleaser)
256+ theStreamReleaser(aStreamReleaser),
257+ theIsStreamSeekable(aIsStreamSeekable)
258 {
259 }
260
261
262=== modified file 'src/api/uriresolverimpl.h'
263--- src/api/uriresolverimpl.h 2012-05-03 12:31:51 +0000
264+++ src/api/uriresolverimpl.h 2012-05-10 02:25:25 +0000
265@@ -39,14 +39,21 @@
266
267 virtual void destroy() const;
268
269+ virtual bool isStreamSeekable() const { return theIsStreamSeekable; }
270+
271 private:
272
273- StreamResourceImpl(std::istream* aStream, StreamReleaser aStreamReleaser);
274+ StreamResourceImpl(
275+ std::istream* aStream,
276+ StreamReleaser aStreamReleaser,
277+ bool aIsStreamSeekable);
278
279 friend StreamResource* StreamResource::create(std::istream *aStream,
280- StreamReleaser aStreamReleaser);
281+ StreamReleaser aStreamReleaser,
282+ bool aIsStreamSeekable);
283 std::istream* theStream;
284 StreamReleaser theStreamReleaser;
285+ bool theIsStreamSeekable;
286
287 };
288
289
290=== modified file 'src/capi/error.cpp'
291--- src/capi/error.cpp 2012-05-03 12:31:51 +0000
292+++ src/capi/error.cpp 2012-05-10 02:25:25 +0000
293@@ -115,7 +115,7 @@
294 || error == ZXQP0013_FXCHARHEAP_EXCEPTION
295 || error == ZXQP0020_INVALID_URI
296 || error == ZXQP0021_USER_ERROR
297- || error == ZXQP0025_ITEM_CREATION_FAILED
298+ || error == ZXQP0025_COULD_NOT_FETCH_RESOURCE
299 || error == ZXQP0028_TARGET_NAMESPACE_NOT_PROVIDED
300 || error == ZXQP0029_URI_ACCESS_DENIED
301 || error == ZXQP0030_DEADLOCK
302
303=== modified file 'src/context/default_url_resolvers.cpp'
304--- src/context/default_url_resolvers.cpp 2012-05-03 12:31:51 +0000
305+++ src/context/default_url_resolvers.cpp 2012-05-10 02:25:25 +0000
306@@ -107,7 +107,8 @@
307 zstring lPath = fs::get_normalized_path(aUrl);
308 if (fs::get_type(lPath) == fs::file) {
309 std::ifstream* lStream = new std::ifstream(lPath.c_str());
310- return new StreamResource(lStream, &fileStreamReleaser);
311+ return new StreamResource(
312+ lStream, &fileStreamReleaser, "", true /* seekable */);
313 }
314 return NULL;
315 }
316
317=== modified file 'src/context/uri_resolver.cpp'
318--- src/context/uri_resolver.cpp 2012-05-03 12:31:51 +0000
319+++ src/context/uri_resolver.cpp 2012-05-10 02:25:25 +0000
320@@ -46,11 +46,13 @@
321
322 StreamResource::StreamResource
323 (std::istream* aStream, StreamReleaser aStreamReleaser,
324- zstring aStreamUrl /* = "" */)
325+ zstring aStreamUrl /* = "" */,
326+ bool aIsStreamSeekable)
327 : Resource(),
328 theStream(aStream),
329 theStreamReleaser(aStreamReleaser),
330- theStreamUrl(aStreamUrl)
331+ theStreamUrl(aStreamUrl),
332+ theIsStreamSeekable(aIsStreamSeekable)
333 {}
334
335 StreamResource::~StreamResource()
336
337=== modified file 'src/context/uri_resolver.h'
338--- src/context/uri_resolver.h 2012-05-03 12:31:51 +0000
339+++ src/context/uri_resolver.h 2012-05-10 02:25:25 +0000
340@@ -97,10 +97,13 @@
341 * are certain unusual circumstances where a URLResolver may wish to
342 * return a stream over some other URL than the one passed to it. In
343 * that case, the URLResolver may pass the true URL here.
344+ * @param aIsStreamSeekable determines whether the stream passed as first
345+ * argument is seekable.
346 */
347 StreamResource(std::istream* aStream,
348 StreamReleaser aStreamReleaser,
349- zstring aStreamUrl = "");
350+ zstring aStreamUrl = "",
351+ bool aIsStreamSeekable = false);
352
353 virtual ~StreamResource();
354
355@@ -127,11 +130,18 @@
356 */
357 zstring getStreamUrl();
358
359+ /**
360+ * @brief Returns true if the stream returned by getStream is seekable,
361+ * false otherwise.
362+ */
363+ bool isStreamSeekable() const { return theIsStreamSeekable; }
364+
365 private:
366
367 std::istream* theStream;
368 StreamReleaser theStreamReleaser;
369 zstring theStreamUrl;
370+ bool theIsStreamSeekable;
371 };
372
373 /**
374
375=== modified file 'src/diagnostics/diagnostic_en.xml'
376--- src/diagnostics/diagnostic_en.xml 2012-05-03 12:31:51 +0000
377+++ src/diagnostics/diagnostic_en.xml 2012-05-10 02:25:25 +0000
378@@ -1697,8 +1697,12 @@
379 <value>XML does not match schema${: "1"}${ 2}</value>
380 </diagnostic>
381
382- <diagnostic code="ZXQP0025" name="ITEM_CREATION_FAILED">
383- <value>item creation failed</value>
384+ <diagnostic code="ZXQP0025" name="COULD_NOT_FETCH_RESOURCE">
385+ <value>"$1": could not fetch resource${; reason: 2}</value>
386+
387+ <entry key="RESOURCE_NOT_FOUND">
388+ <value>resource not found</value>
389+ </entry>
390 </diagnostic>
391
392 <diagnostic code="ZXQP0026" name="INVALID_ENUM_VALUE">
393
394=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
395--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-05-03 12:31:51 +0000
396+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2012-05-10 02:25:25 +0000
397@@ -610,7 +610,7 @@
398 ZorbaErrorCode ZXQP0024_XML_DOES_NOT_MATCH_SCHEMA( "ZXQP0024" );
399
400
401-ZorbaErrorCode ZXQP0025_ITEM_CREATION_FAILED( "ZXQP0025" );
402+ZorbaErrorCode ZXQP0025_COULD_NOT_FETCH_RESOURCE( "ZXQP0025" );
403
404
405 ZorbaErrorCode ZXQP0026_INVALID_ENUM_VALUE( "ZXQP0026" );
406
407=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
408--- src/diagnostics/pregenerated/dict_en.cpp 2012-05-03 12:31:51 +0000
409+++ src/diagnostics/pregenerated/dict_en.cpp 2012-05-10 02:25:25 +0000
410@@ -411,7 +411,7 @@
411 { "ZXQP0020", "\"$1\": invalid URI${: 2}" },
412 { "ZXQP0021", "user error" },
413 { "ZXQP0024", "XML does not match schema${: \"1\"}${ 2}" },
414- { "ZXQP0025", "item creation failed" },
415+ { "ZXQP0025", "\"$1\": could not fetch resource${; reason: 2}" },
416 { "ZXQP0026", "\"$1\": invalid enumerated value for $2" },
417 { "ZXQP0028", "\"$1\": target namespace not provided by module from $2" },
418 { "ZXQP0029", "\"$1\": URI access not allowed" },
419@@ -797,6 +797,7 @@
420 { "~ZXQD0004_NON_NEGATIVE", "given value must be non-negative ($2)" },
421 { "~ZXQD0004_NOT_WITHIN_RANGE", "not within allowed range ($2)" },
422 { "~ZXQP0004_TypeOps_is_in_scope_ForFunctionItemTypes", "TypeOps::is_in_scope() for function-item types" },
423+ { "~ZXQP0025_RESOURCE_NOT_FOUND", "resource not found" },
424 { "~ZeroLenURI", "zero-length URI (and no base URI given)" },
425 { "~Zorba API error", "Zorba API error" },
426 { "~Zorba data-definition error", "Zorba data-definition error" },
427
428=== modified file 'src/functions/pregenerated/func_fetch.cpp'
429--- src/functions/pregenerated/func_fetch.cpp 2012-05-03 12:31:51 +0000
430+++ src/functions/pregenerated/func_fetch.cpp 2012-05-10 02:25:25 +0000
431@@ -41,6 +41,16 @@
432 return new FetchContentIterator(sctx, loc, argv);
433 }
434
435+PlanIter_t fn_zorba_fetch_content_binary::codegen(
436+ CompilerCB*,
437+ static_context* sctx,
438+ const QueryLoc& loc,
439+ std::vector<PlanIter_t>& argv,
440+ expr& ann) const
441+{
442+ return new FetchContentBinaryIterator(sctx, loc, argv);
443+}
444+
445 PlanIter_t fn_zorba_fetch_content_type::codegen(
446 CompilerCB*,
447 static_context* sctx,
448@@ -60,8 +70,22 @@
449 (createQName("http://www.zorba-xquery.com/modules/fetch","","content"),
450 GENV_TYPESYSTEM.STRING_TYPE_ONE,
451 GENV_TYPESYSTEM.STRING_TYPE_ONE,
452+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
453 GENV_TYPESYSTEM.STRING_TYPE_ONE),
454- FunctionConsts::FN_ZORBA_FETCH_CONTENT_2);
455+ FunctionConsts::FN_ZORBA_FETCH_CONTENT_3);
456+
457+ }
458+
459+
460+ {
461+
462+
463+ DECL_WITH_KIND(sctx, fn_zorba_fetch_content_binary,
464+ (createQName("http://www.zorba-xquery.com/modules/fetch","","content-binary"),
465+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
466+ GENV_TYPESYSTEM.STRING_TYPE_ONE,
467+ GENV_TYPESYSTEM.BASE64BINARY_TYPE_ONE),
468+ FunctionConsts::FN_ZORBA_FETCH_CONTENT_BINARY_2);
469
470 }
471
472
473=== modified file 'src/functions/pregenerated/func_fetch.h'
474--- src/functions/pregenerated/func_fetch.h 2012-05-03 12:31:51 +0000
475+++ src/functions/pregenerated/func_fetch.h 2012-05-10 02:25:25 +0000
476@@ -55,6 +55,23 @@
477 };
478
479
480+//fn-zorba-fetch:content-binary
481+class fn_zorba_fetch_content_binary : public function
482+{
483+public:
484+ fn_zorba_fetch_content_binary(const signature& sig, FunctionConsts::FunctionKind kind)
485+ :
486+ function(sig, kind)
487+ {
488+
489+ }
490+
491+ bool accessesDynCtx() const { return true; }
492+
493+ CODEGEN_DECL();
494+};
495+
496+
497 //fn-zorba-fetch:content-type
498 class fn_zorba_fetch_content_type : public function
499 {
500
501=== modified file 'src/functions/pregenerated/function_enum.h'
502--- src/functions/pregenerated/function_enum.h 2012-05-08 03:09:12 +0000
503+++ src/functions/pregenerated/function_enum.h 2012-05-10 02:25:25 +0000
504@@ -137,7 +137,8 @@
505 FN_TRACE_2,
506 OP_ZORBA_READ_LINE_0,
507 FN_ZORBA_UTIL_PRINT_1,
508- FN_ZORBA_FETCH_CONTENT_2,
509+ FN_ZORBA_FETCH_CONTENT_3,
510+ FN_ZORBA_FETCH_CONTENT_BINARY_2,
511 FN_ZORBA_FETCH_CONTENT_TYPE_1,
512 FN_PUT_2,
513 FULL_TEXT_CURRENT_LANG_0,
514
515=== modified file 'src/runtime/fetch/fetch_impl.cpp'
516--- src/runtime/fetch/fetch_impl.cpp 2012-05-03 12:31:51 +0000
517+++ src/runtime/fetch/fetch_impl.cpp 2012-05-10 02:25:25 +0000
518@@ -15,6 +15,8 @@
519 */
520 #include "stdafx.h"
521
522+#include <zorba/transcode_stream.h>
523+
524 #include "diagnostics/assert.h"
525 #include "diagnostics/xquery_diagnostics.h"
526
527@@ -30,33 +32,17 @@
528
529 /*******************************************************************************
530 ********************************************************************************/
531-void
532-FetchContentIterator::destroyStream(std::istream& aStream)
533-{
534- delete &aStream;
535-}
536-
537-bool
538-FetchContentIterator::nextImpl(
539- store::Item_t& result,
540- PlanState& aPlanState) const
541-{
542- store::Item_t lUri;
543- store::Item_t lEntityKind;
544+std::auto_ptr<internal::Resource>
545+getFetchResource(
546+ const store::Item_t& aUri,
547+ const store::Item_t& aKind,
548+ const static_context* aSctx,
549+ const QueryLoc& aLoc)
550+{
551 internal::EntityData::Kind lKind;
552- zstring lKindStr;
553- zstring lErrorMessage;
554- std::auto_ptr<internal::Resource> lRes;
555- internal::StreamResource* lStreamRes;
556-
557- PlanIteratorState* state;
558- DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
559-
560- consumeNext(lUri, theChildren[0].getp(), aPlanState);
561- consumeNext(lEntityKind, theChildren[1].getp(), aPlanState);
562+ zstring lKindStr = aKind->getStringValue();
563
564 // Figure out the EntityKind (any better way to do this?)
565- lKindStr = lEntityKind->getStringValue();
566 if ( ! lKindStr.compare("SOME_CONTENT")) {
567 lKind = internal::EntityData::SOME_CONTENT;
568 }
569@@ -78,41 +64,147 @@
570 throw XQUERY_EXCEPTION(
571 zerr::ZXQP0026_INVALID_ENUM_VALUE,
572 ERROR_PARAMS(lKindStr, "entityKind"),
573- ERROR_LOC(loc));
574+ ERROR_LOC(aLoc));
575 }
576
577 try {
578 // ask the uri mappers and resolvers to give
579 // me a resource of specified kind
580- lRes = theSctx->resolve_uri(
581- lUri->getStringValue(),
582+ zstring lErrorMessage;
583+ return aSctx->resolve_uri(
584+ aUri->getStringValue(),
585 lKind,
586 lErrorMessage);
587
588 } catch (ZorbaException const& e) {
589 throw XQUERY_EXCEPTION(
590- zerr::ZXQP0025_ITEM_CREATION_FAILED,
591- ERROR_PARAMS( e.what() ),
592- ERROR_LOC( loc )
593+ zerr::ZXQP0025_COULD_NOT_FETCH_RESOURCE,
594+ ERROR_PARAMS( aUri->getStringValue(), e.what() ),
595+ ERROR_LOC( aLoc )
596 );
597 }
598+}
599+
600+/*******************************************************************************
601+********************************************************************************/
602+void
603+FetchContentIterator::destroyStream(std::istream& aStream)
604+{
605+ delete &aStream;
606+}
607+
608+bool
609+FetchContentIterator::nextImpl(
610+ store::Item_t& result,
611+ PlanState& aPlanState) const
612+{
613+ store::Item_t lUri;
614+ store::Item_t lEntityKind;
615+ store::Item_t lEncoding;
616+ zstring lEncodingStr("UTF-8");
617+ std::auto_ptr<internal::Resource> lRes;
618+ internal::StreamResource* lStreamRes;
619+
620+ PlanIteratorState* state;
621+ DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
622+
623+ consumeNext(lUri, theChildren[0].getp(), aPlanState);
624+ consumeNext(lEntityKind, theChildren[1].getp(), aPlanState);
625+ consumeNext(lEncoding, theChildren[2].getp(), aPlanState);
626+
627+ lEncodingStr = lEncoding->getStringValue();
628+
629+ lRes = getFetchResource(lUri, lEntityKind, theSctx, loc);
630
631 lStreamRes = dynamic_cast<internal::StreamResource*>(lRes.get());
632 if ( !lStreamRes ) {
633 throw XQUERY_EXCEPTION(
634- zerr::ZXQP0025_ITEM_CREATION_FAILED,
635- ERROR_PARAMS( "Resource not available." ),
636+ zerr::ZXQP0025_COULD_NOT_FETCH_RESOURCE,
637+ ERROR_PARAMS(
638+ lUri->getStringValue(),
639+ ZED(ZXQP0025_RESOURCE_NOT_FOUND`)
640+ ),
641 ERROR_LOC( loc )
642 );
643 }
644
645+ if (transcode::is_necessary(lEncodingStr.c_str()))
646+ {
647+ if (!transcode::is_supported(lEncodingStr.c_str()))
648+ {
649+ throw XQUERY_EXCEPTION(
650+ zerr::ZXQP0006_UNKNOWN_ENCODING,
651+ ERROR_PARAMS( lEncodingStr.c_str() ),
652+ ERROR_LOC( loc )
653+ );
654+ }
655+ transcode::attach(*lStreamRes->getStream(), lEncodingStr.c_str());
656+ }
657+
658 // return the resource in a streamable string. This transfers memory
659 // ownership of the istream (via its StreamReleaser) to the StreamableString
660 // object, so we then remove the StreamReleaser from the StreamResource.
661 GENV_ITEMFACTORY->createStreamableString(
662 result,
663 *lStreamRes->getStream(),
664- lStreamRes->getStreamReleaser()
665+ lStreamRes->getStreamReleaser(),
666+ lStreamRes->isStreamSeekable()
667+ );
668+ lStreamRes->setStreamReleaser(nullptr);
669+
670+ STACK_PUSH(result != NULL, state);
671+
672+ STACK_END(state);
673+}
674+
675+
676+/*******************************************************************************
677+********************************************************************************/
678+void
679+FetchContentBinaryIterator::destroyStream(std::istream& aStream)
680+{
681+ delete &aStream;
682+}
683+
684+bool
685+FetchContentBinaryIterator::nextImpl(
686+ store::Item_t& result,
687+ PlanState& aPlanState) const
688+{
689+ store::Item_t lUri;
690+ store::Item_t lEntityKind;
691+ std::auto_ptr<internal::Resource> lRes;
692+ internal::StreamResource* lStreamRes;
693+
694+ PlanIteratorState* state;
695+ DEFAULT_STACK_INIT(PlanIteratorState, state, aPlanState);
696+
697+ consumeNext(lUri, theChildren[0].getp(), aPlanState);
698+ consumeNext(lEntityKind, theChildren[1].getp(), aPlanState);
699+
700+ lRes = getFetchResource(lUri, lEntityKind, theSctx, loc);
701+
702+ lStreamRes = dynamic_cast<internal::StreamResource*>(lRes.get());
703+ if ( !lStreamRes ) {
704+ throw XQUERY_EXCEPTION(
705+ zerr::ZXQP0025_COULD_NOT_FETCH_RESOURCE,
706+ ERROR_PARAMS(
707+ lUri->getStringValue(),
708+ ZED(ZXQP0025_RESOURCE_NOT_FOUND)
709+ ),
710+ ERROR_LOC( loc )
711+ );
712+ }
713+
714+ // return the resource in a streamable base64. This transfers memory
715+ // ownership of the istream (via its StreamReleaser) to the StreamableBase64BinaryItem
716+ // object, so we then remove the StreamReleaser from the StreamResource.
717+ GENV_ITEMFACTORY->createStreamableBase64Binary(
718+ result,
719+ *lStreamRes->getStream(),
720+ lStreamRes->getStreamReleaser(),
721+ lStreamRes->isStreamSeekable(),
722+ false
723 );
724 lStreamRes->setStreamReleaser(nullptr);
725
726
727=== modified file 'src/runtime/fetch/pregenerated/fetch.cpp'
728--- src/runtime/fetch/pregenerated/fetch.cpp 2012-05-03 12:31:51 +0000
729+++ src/runtime/fetch/pregenerated/fetch.cpp 2012-05-10 02:25:25 +0000
730@@ -54,6 +54,28 @@
731 // </FetchContentIterator>
732
733
734+// <FetchContentBinaryIterator>
735+FetchContentBinaryIterator::class_factory<FetchContentBinaryIterator>
736+FetchContentBinaryIterator::g_class_factory;
737+
738+
739+void FetchContentBinaryIterator::accept(PlanIterVisitor& v) const {
740+ v.beginVisit(*this);
741+
742+ std::vector<PlanIter_t>::const_iterator lIter = theChildren.begin();
743+ std::vector<PlanIter_t>::const_iterator lEnd = theChildren.end();
744+ for ( ; lIter != lEnd; ++lIter ){
745+ (*lIter)->accept(v);
746+ }
747+
748+ v.endVisit(*this);
749+}
750+
751+FetchContentBinaryIterator::~FetchContentBinaryIterator() {}
752+
753+// </FetchContentBinaryIterator>
754+
755+
756 // <FetchContentTypeIterator>
757 FetchContentTypeIterator::class_factory<FetchContentTypeIterator>
758 FetchContentTypeIterator::g_class_factory;
759
760=== modified file 'src/runtime/fetch/pregenerated/fetch.h'
761--- src/runtime/fetch/pregenerated/fetch.h 2012-05-03 12:31:51 +0000
762+++ src/runtime/fetch/pregenerated/fetch.h 2012-05-10 02:25:25 +0000
763@@ -73,6 +73,42 @@
764 *
765 * Author: Matthias Brantner
766 */
767+class FetchContentBinaryIterator : public NaryBaseIterator<FetchContentBinaryIterator, PlanIteratorState>
768+{
769+public:
770+ SERIALIZABLE_CLASS(FetchContentBinaryIterator);
771+
772+ SERIALIZABLE_CLASS_CONSTRUCTOR2T(FetchContentBinaryIterator,
773+ NaryBaseIterator<FetchContentBinaryIterator, PlanIteratorState>);
774+
775+ void serialize( ::zorba::serialization::Archiver& ar)
776+ {
777+ serialize_baseclass(ar,
778+ (NaryBaseIterator<FetchContentBinaryIterator, PlanIteratorState>*)this);
779+ }
780+
781+ FetchContentBinaryIterator(
782+ static_context* sctx,
783+ const QueryLoc& loc,
784+ std::vector<PlanIter_t>& children)
785+ :
786+ NaryBaseIterator<FetchContentBinaryIterator, PlanIteratorState>(sctx, loc, children)
787+ {}
788+
789+ virtual ~FetchContentBinaryIterator();
790+
791+public:
792+ static void destroyStream(std::istream& aStream);
793+ void accept(PlanIterVisitor& v) const;
794+
795+ bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
796+};
797+
798+
799+/**
800+ *
801+ * Author: Matthias Brantner
802+ */
803 class FetchContentTypeIterator : public NaryBaseIterator<FetchContentTypeIterator, PlanIteratorState>
804 {
805 public:
806
807=== modified file 'src/runtime/full_text/ft_token_matcher.cpp'
808=== modified file 'src/runtime/nodes/nodes_impl.cpp'
809--- src/runtime/nodes/nodes_impl.cpp 2012-05-03 12:31:51 +0000
810+++ src/runtime/nodes/nodes_impl.cpp 2012-05-10 02:25:25 +0000
811@@ -638,11 +638,13 @@
812 lIterator->open();
813 while(lIterator->next(lItem))
814 {
815- if(lItem->getNodeKind() == aNode->getNodeKind())
816+ if (lItem->getNodeKind() == aNode->getNodeKind())
817+ {
818 if(lItem->equals(aNode))
819 break;
820 else
821 count++;
822+ }
823 }
824 lIterator->close();
825 return count;
826@@ -663,7 +665,7 @@
827 PlanIteratorState* state;
828 DEFAULT_STACK_INIT(PlanIteratorState, state, planState);
829
830- if (consumeNext(inNode, theChildren[0], planState));
831+ if (consumeNext(inNode, theChildren[0], planState))
832 {
833 do
834 {
835
836=== modified file 'src/runtime/spec/fetch/fetch.xml'
837--- src/runtime/spec/fetch/fetch.xml 2012-05-03 12:31:51 +0000
838+++ src/runtime/spec/fetch/fetch.xml 2012-05-10 02:25:25 +0000
839@@ -16,7 +16,8 @@
840 <zorba:function>
841 <zorba:signature localname="content" prefix="fn-zorba-fetch">
842 <zorba:param>xs:string</zorba:param>
843- <zorba:param>xs:string</zorba:param>
844+ <zorba:param>xs:string</zorba:param> <!-- entityKind -->
845+ <zorba:param>xs:string</zorba:param> <!-- encoding -->
846 <zorba:output>xs:string</zorba:output>
847 </zorba:signature>
848
849@@ -25,8 +26,33 @@
850 </zorba:methods>
851 </zorba:function>
852
853- <zorba:method static="true" name="destroyStream"
854- return="void">
855+ <zorba:method static="true" name="destroyStream" return="void">
856+ <zorba:param type="std::istream&amp;" name="aStream"/>
857+ </zorba:method>
858+
859+</zorba:iterator>
860+
861+<!--
862+/*********************************************************************
863+*********************************************************************/
864+-->
865+<zorba:iterator name="FetchContentBinaryIterator">
866+
867+ <zorba:description author="Matthias Brantner"></zorba:description>
868+
869+ <zorba:function>
870+ <zorba:signature localname="content-binary" prefix="fn-zorba-fetch">
871+ <zorba:param>xs:string</zorba:param>
872+ <zorba:param>xs:string</zorba:param>
873+ <zorba:output>xs:base64Binary</zorba:output>
874+ </zorba:signature>
875+
876+ <zorba:methods>
877+ <zorba:accessesDynCtx returnValue="true"/>
878+ </zorba:methods>
879+ </zorba:function>
880+
881+ <zorba:method static="true" name="destroyStream" return="void">
882 <zorba:param type="std::istream&amp;" name="aStream"/>
883 </zorba:method>
884
885
886=== modified file 'src/runtime/visitors/pregenerated/planiter_visitor.h'
887--- src/runtime/visitors/pregenerated/planiter_visitor.h 2012-05-08 23:49:22 +0000
888+++ src/runtime/visitors/pregenerated/planiter_visitor.h 2012-05-10 02:25:25 +0000
889@@ -189,6 +189,8 @@
890
891 class FetchContentIterator;
892
893+ class FetchContentBinaryIterator;
894+
895 class FetchContentTypeIterator;
896
897 class FnPutIterator;
898@@ -900,6 +902,9 @@
899 virtual void beginVisit ( const FetchContentIterator& ) = 0;
900 virtual void endVisit ( const FetchContentIterator& ) = 0;
901
902+ virtual void beginVisit ( const FetchContentBinaryIterator& ) = 0;
903+ virtual void endVisit ( const FetchContentBinaryIterator& ) = 0;
904+
905 virtual void beginVisit ( const FetchContentTypeIterator& ) = 0;
906 virtual void endVisit ( const FetchContentTypeIterator& ) = 0;
907
908
909=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.cpp'
910--- src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-05-08 23:49:22 +0000
911+++ src/runtime/visitors/pregenerated/printer_visitor.cpp 2012-05-10 02:25:25 +0000
912@@ -1219,6 +1219,20 @@
913 // </FetchContentIterator>
914
915
916+// <FetchContentBinaryIterator>
917+void PrinterVisitor::beginVisit ( const FetchContentBinaryIterator& a) {
918+ thePrinter.startBeginVisit("FetchContentBinaryIterator", ++theId);
919+ printCommons( &a, theId );
920+ thePrinter.endBeginVisit( theId );
921+}
922+
923+void PrinterVisitor::endVisit ( const FetchContentBinaryIterator& ) {
924+ thePrinter.startEndVisit();
925+ thePrinter.endEndVisit();
926+}
927+// </FetchContentBinaryIterator>
928+
929+
930 // <FetchContentTypeIterator>
931 void PrinterVisitor::beginVisit ( const FetchContentTypeIterator& a) {
932 thePrinter.startBeginVisit("FetchContentTypeIterator", ++theId);
933
934=== modified file 'src/runtime/visitors/pregenerated/printer_visitor.h'
935--- src/runtime/visitors/pregenerated/printer_visitor.h 2012-05-08 23:49:22 +0000
936+++ src/runtime/visitors/pregenerated/printer_visitor.h 2012-05-10 02:25:25 +0000
937@@ -286,6 +286,9 @@
938 void beginVisit( const FetchContentIterator& );
939 void endVisit ( const FetchContentIterator& );
940
941+ void beginVisit( const FetchContentBinaryIterator& );
942+ void endVisit ( const FetchContentBinaryIterator& );
943+
944 void beginVisit( const FetchContentTypeIterator& );
945 void endVisit ( const FetchContentTypeIterator& );
946
947
948=== modified file 'src/util/fs_util.cpp'
949--- src/util/fs_util.cpp 2012-05-03 12:31:51 +0000
950+++ src/util/fs_util.cpp 2012-05-10 02:25:25 +0000
951@@ -324,7 +324,7 @@
952 case DT_DIR: {
953 char const *const name = ent_->d_name;
954 // skip "." and ".." entries
955- if ( name[0] == '.' && (!name[1] || name[1] == '.' && !name[2]) )
956+ if ( name[0] == '.' && (!name[1] || (name[1] == '.' && !name[2])) )
957 continue;
958 ent_type_ = directory;
959 break;
960
961=== modified file 'src/zorbaserialization/archiver.cpp'
962--- src/zorbaserialization/archiver.cpp 2012-05-03 12:31:51 +0000
963+++ src/zorbaserialization/archiver.cpp 2012-05-10 02:25:25 +0000
964@@ -125,9 +125,9 @@
965 theCurrentLevel(0),
966 theNonClassFieldsMap(0),
967 theClassFieldsMap(0),
968+ theOnlyForEval(0),
969 all_reference_list(0),
970 internal_archive(internal_archive),
971- theOnlyForEval(0),
972 theSerializeEverything(false),
973 loading_hardcoded_objects(false),
974 theAllowDelay2(ALLOW_DELAY),
975
976=== added file 'test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable.xml.res'
977--- test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable.xml.res 1970-01-01 00:00:00 +0000
978+++ test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable.xml.res 2012-05-10 02:25:25 +0000
979@@ -0,0 +1,1 @@
980+true true true
981
982=== added file 'test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable_binary.xml.res'
983--- test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable_binary.xml.res 1970-01-01 00:00:00 +0000
984+++ test/rbkt/ExpQueryResults/zorba/fetch/fetch_seekable_binary.xml.res 2012-05-10 02:25:25 +0000
985@@ -0,0 +1,1 @@
986+8 5Pb8Cg==
987
988=== added file 'test/rbkt/ExpQueryResults/zorba/fetch/fetch_some_transcode.xml.res'
989--- test/rbkt/ExpQueryResults/zorba/fetch/fetch_some_transcode.xml.res 1970-01-01 00:00:00 +0000
990+++ test/rbkt/ExpQueryResults/zorba/fetch/fetch_some_transcode.xml.res 2012-05-10 02:25:25 +0000
991@@ -0,0 +1,1 @@
992+äöü
993
994=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_bogus1.xq'
995--- test/rbkt/Queries/zorba/fetch/fetch_bogus1.xq 2012-05-03 12:31:51 +0000
996+++ test/rbkt/Queries/zorba/fetch/fetch_bogus1.xq 2012-05-10 02:25:25 +0000
997@@ -1,4 +1,4 @@
998 (: Fetch with unknown entity kind :)
999-import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";
1000+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1001
1002 fetch:content("http://www.zorba-xquery.com/modules/ext", "NOTHING")
1003
1004=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq'
1005--- test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq 2012-05-03 12:31:51 +0000
1006+++ test/rbkt/Queries/zorba/fetch/fetch_bogus2.xq 2012-05-10 02:25:25 +0000
1007@@ -1,4 +1,4 @@
1008 (: Fetch a valid module URI but as SOME_CONTENT :)
1009-import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";
1010+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1011
1012 fetch:content("http://www.flworfound.org/modules/ext", "SOME_CONTENT")
1013
1014=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_module1.xq'
1015--- test/rbkt/Queries/zorba/fetch/fetch_module1.xq 2012-05-03 12:31:51 +0000
1016+++ test/rbkt/Queries/zorba/fetch/fetch_module1.xq 2012-05-10 02:25:25 +0000
1017@@ -1,4 +1,4 @@
1018 (: Fetch a module's content :)
1019-import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";
1020+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1021
1022 fetch:content("http://www.zorba-xquery.com/modules/ext", "MODULE")
1023
1024=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_module2.xq'
1025--- test/rbkt/Queries/zorba/fetch/fetch_module2.xq 2012-05-03 12:31:51 +0000
1026+++ test/rbkt/Queries/zorba/fetch/fetch_module2.xq 2012-05-10 02:25:25 +0000
1027@@ -1,4 +1,4 @@
1028 (: Fetch a module's content with versioning :)
1029-import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";
1030+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1031
1032 fetch:content("http://www.zorba-xquery.com/modules/ext#1.0", "MODULE")
1033
1034=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_random_file.xq'
1035--- test/rbkt/Queries/zorba/fetch/fetch_random_file.xq 2012-02-01 17:13:01 +0000
1036+++ test/rbkt/Queries/zorba/fetch/fetch_random_file.xq 2012-05-10 02:25:25 +0000
1037@@ -1,4 +1,4 @@
1038 (: Fetch a random file from the filesystem :)
1039-import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";
1040+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1041
1042 fetch:content("http://www.zorba-xquery.com/random-file", "SOME_CONTENT")
1043
1044=== modified file 'test/rbkt/Queries/zorba/fetch/fetch_schema1.xq'
1045--- test/rbkt/Queries/zorba/fetch/fetch_schema1.xq 2012-05-03 12:31:51 +0000
1046+++ test/rbkt/Queries/zorba/fetch/fetch_schema1.xq 2012-05-10 02:25:25 +0000
1047@@ -1,5 +1,5 @@
1048 (: Fetch a schemas's content :)
1049-import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch#2.0";
1050+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1051
1052 fn:parse-xml(
1053 fetch:content("http://www.zorba-xquery.com/modules/theschema", "SCHEMA")
1054
1055=== added file 'test/rbkt/Queries/zorba/fetch/fetch_seekable.xml.res'
1056--- test/rbkt/Queries/zorba/fetch/fetch_seekable.xml.res 1970-01-01 00:00:00 +0000
1057+++ test/rbkt/Queries/zorba/fetch/fetch_seekable.xml.res 2012-05-10 02:25:25 +0000
1058@@ -0,0 +1,1 @@
1059+true true true
1060
1061=== added file 'test/rbkt/Queries/zorba/fetch/fetch_seekable.xq'
1062--- test/rbkt/Queries/zorba/fetch/fetch_seekable.xq 1970-01-01 00:00:00 +0000
1063+++ test/rbkt/Queries/zorba/fetch/fetch_seekable.xq 2012-05-10 02:25:25 +0000
1064@@ -0,0 +1,8 @@
1065+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1066+
1067+import module namespace s = "http://www.zorba-xquery.com/modules/string";
1068+
1069+(: make sure the returned string is streamable and can be consumed twice, i.e. is seekable :)
1070+let $x := fetch:content(fn:resolve-uri("iso-8859-1.txt"))
1071+return (s:is-streamable($x), string-length($x) gt 0, string-length($x) gt 0)
1072+
1073
1074=== added file 'test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq'
1075--- test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq 1970-01-01 00:00:00 +0000
1076+++ test/rbkt/Queries/zorba/fetch/fetch_seekable_binary.xq 2012-05-10 02:25:25 +0000
1077@@ -0,0 +1,8 @@
1078+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1079+
1080+import module namespace b = "http://www.zorba-xquery.com/modules/converters/base64";
1081+
1082+(: make sure the returned string is streamable and can be consumed twice, i.e. is seekable :)
1083+let $x := fetch:content-binary(fn:resolve-uri("iso-8859-1.txt"))
1084+return (string-length(xs:string($x)), $x)
1085+
1086
1087=== added file 'test/rbkt/Queries/zorba/fetch/fetch_some_transcode.xq'
1088--- test/rbkt/Queries/zorba/fetch/fetch_some_transcode.xq 1970-01-01 00:00:00 +0000
1089+++ test/rbkt/Queries/zorba/fetch/fetch_some_transcode.xq 2012-05-10 02:25:25 +0000
1090@@ -0,0 +1,3 @@
1091+import module namespace fetch = "http://www.zorba-xquery.com/modules/fetch";
1092+
1093+fetch:content(resolve-uri("iso-8859-1.txt"), "SOME_CONTENT", "ISO-8859-1")
1094
1095=== added file 'test/rbkt/Queries/zorba/fetch/iso-8859-1.txt'
1096--- test/rbkt/Queries/zorba/fetch/iso-8859-1.txt 1970-01-01 00:00:00 +0000
1097+++ test/rbkt/Queries/zorba/fetch/iso-8859-1.txt 2012-05-10 02:25:25 +0000
1098@@ -0,0 +1,1 @@
1099+äöü

Subscribers

People subscribed via source and target branches