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: 1118 lines (+468/-113) (has conflicts)
42 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 (+94/-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/static_context.cpp (+7/-0)
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)
Text conflict in src/context/static_context.cpp
To merge this branch: bzr merge lp:~zorba-coders/zorba/feature-fetch_binary
Reviewer Review Type Date Requested Status
Matthias Brantner Pending
Review via email: mp+105359@code.launchpad.net

This proposal has been superseded by a proposal from 2012-05-11.

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 :
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-10T17-26-13.72Z 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-10T21-26-27.53Z 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

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

Subscribers

People subscribed via source and target branches