zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #18021
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
Paul J. Lucas has proposed merging lp:~zorba-coders/zorba/bug-1122396 into lp:zorba.
Commit message:
Added a way to associate a URI to any iostream. Specifically for Zorba, a URI can now be associated with a streamable string and streamable base64 stream.
Requested reviews:
Paul J. Lucas (paul-lucas)
Related bugs:
Bug #1122396 in Zorba: "Associate origin/destination URI to I/O stream"
https://bugs.launchpad.net/zorba/+bug/1122396
For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-1122396/+merge/147827
Added a way to associate a URI to any iostream. Specifically for Zorba, a URI can now be associated with a streamable string and streamable base64 stream.
--
https://code.launchpad.net/~zorba-coders/zorba/bug-1122396/+merge/147827
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/base64_stream.h'
--- include/zorba/base64_stream.h 2012-06-15 22:59:04 +0000
+++ include/zorba/base64_stream.h 2013-02-12 04:25:27 +0000
@@ -149,7 +149,7 @@
* already has a base64::streambuf attached to it, this function does
* nothing.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
void attach( std::basic_ios<charT,Traits> &ios ) {
int const index = internal::base64::get_streambuf_index();
void *&pword = ios.pword( index );
@@ -170,7 +170,7 @@
* stream doesn't have a base64::streambuf attached to it, this function
* does nothing.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
void detach( std::basic_ios<charT,Traits> &ios ) {
int const index = internal::base64::get_streambuf_index();
if ( streambuf *const buf = static_cast<streambuf*>( ios.pword( index ) ) ) {
@@ -186,7 +186,7 @@
* @param ios The stream to check.
* @return \c true only if a base64::streambuf is attached.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
bool is_attached( std::basic_ios<charT,Traits> &ios ) {
return !!ios.pword( internal::base64::get_streambuf_index() );
}
=== modified file 'include/zorba/item_factory.h'
--- include/zorba/item_factory.h 2012-10-08 12:09:36 +0000
+++ include/zorba/item_factory.h 2013-02-12 04:25:27 +0000
@@ -66,6 +66,24 @@
StreamReleaser streamReleaser,
bool seekable = false ) = 0;
+ /** \brief Creates a streamable String Item
+ * see [http://www.w3.org/TR/xmlschema-2/#string]
+ *
+ * @param stream An istream from where to read the string's content.
+ * @param streamReleaser A function pointer which is invoked once
+ * the StreamableStringItem is destroyed. Normally this function
+ * will delete the std::istream object passed to it.
+ * @param uri The URI is intended to be used to note the origination URI
+ * (e.g., file) that data is coming from.
+ * @param seekable
+ * @return The streamable String Item
+ */
+ virtual Item
+ createStreamableString( std::istream &stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable = false ) = 0;
+
/** \brief Creates an AnyURI Item
* see [http://www.w3.org/TR/xmlschema-2/#anyURI]
*
@@ -168,6 +186,28 @@
bool seekable = false,
bool encoded = false) = 0;
+ /** \brief Creates a streamable Base64Binary Item
+ * see [http://www.w3.org/TR/xmlschema-2/#base64Binary]
+ *
+ * @param stream An istream from where to read the binary's content.
+ * @param streamReleaser A function pointer which is invoked once
+ * the StreamableBase64Binary is destroyed. Normally this function
+ * will delete the std::istream object passed to it.
+ * @param uri The URI is intended to be used to note the origination URI
+ * (e.g., file) that data is coming from.
+ * @param seekable is the given stream seekable
+ * @param encoded is the contents of the given stream already base64
+ * encoded
+ * @return The streamable String Item
+ */
+ virtual Item
+ createStreamableBase64Binary(
+ std::istream &stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable = false,
+ bool encoded = false) = 0;
+
/** \brief Creates a Boolean Item
* see [http://www.w3.org/TR/xmlschema-2/#bool]
*
=== modified file 'include/zorba/transcode_stream.h'
--- include/zorba/transcode_stream.h 2012-12-27 18:51:26 +0000
+++ include/zorba/transcode_stream.h 2013-02-12 04:25:27 +0000
@@ -139,7 +139,7 @@
* nothing.
* @param charset The name of the character encoding to convert from/to.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
void attach( std::basic_ios<charT,Traits> &ios, char const *charset ) {
int const index = internal::transcode::get_streambuf_index();
void *&pword = ios.pword( index );
@@ -160,7 +160,7 @@
* stream doesn't have a transcode::streambuf attached to it, this function
* does nothing.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
void detach( std::basic_ios<charT,Traits> &ios ) {
int const index = internal::transcode::get_streambuf_index();
if ( streambuf *const buf = static_cast<streambuf*>( ios.pword( index ) ) ) {
@@ -176,7 +176,7 @@
* @param ios The stream to check.
* @return \c true only if a transcode::streambuf is attached.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
bool is_attached( std::basic_ios<charT,Traits> &ios ) {
return !!ios.pword( internal::transcode::get_streambuf_index() );
}
@@ -187,7 +187,7 @@
* @param ios The stream to get the original streambuf of.
* @return the original streambuf.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
std::streambuf* orig_streambuf( std::basic_ios<charT,Traits> &ios ) {
std::streambuf *const buf = ios.rdbuf();
if ( streambuf *const tbuf = dynamic_cast<streambuf*>( buf ) )
=== modified file 'modules/org/expath/ns/file.xq.src/file.cpp'
--- modules/org/expath/ns/file.xq.src/file.cpp 2013-02-05 18:36:40 +0000
+++ modules/org/expath/ns/file.xq.src/file.cpp 2013-02-12 04:25:27 +0000
@@ -216,7 +216,7 @@
}
lFile->openInputStream(*lInStream.get(), false, true);
lResult = theModule->getItemFactory()->createStreamableString(
- *lInStream.release(), &FileModule::streamReleaser, true
+ *lInStream.release(), &FileModule::streamReleaser, lFileStr.c_str(), true
);
return ItemSequence_t(new SingletonItemSequence(lResult));
=== modified file 'src/api/itemfactoryimpl.cpp'
--- src/api/itemfactoryimpl.cpp 2013-01-10 19:24:23 +0000
+++ src/api/itemfactoryimpl.cpp 2013-02-12 04:25:27 +0000
@@ -76,6 +76,18 @@
}
+Item ItemFactoryImpl::createStreamableString(
+ std::istream &stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable)
+{
+ store::Item_t lItem;
+ theItemFactory->createStreamableString(lItem, stream, streamReleaser, uri, seekable);
+ return &*lItem;
+}
+
+
Item ItemFactoryImpl::createAnyURI(const String& aURI)
{
zstring lString = Unmarshaller::getInternalString(aURI);
@@ -256,6 +268,22 @@
}
+Item
+ItemFactoryImpl::createStreamableBase64Binary(
+ std::istream &stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable,
+ bool encoded)
+{
+ store::Item_t lItem;
+ theItemFactory->createStreamableBase64Binary(
+ lItem, stream, streamReleaser, uri, seekable, encoded
+ );
+ return &*lItem;
+}
+
+
Item ItemFactoryImpl::createBoolean(bool aValue)
{
store::Item_t lItem;
=== modified file 'src/api/itemfactoryimpl.h'
--- src/api/itemfactoryimpl.h 2012-10-08 12:09:36 +0000
+++ src/api/itemfactoryimpl.h 2013-02-12 04:25:27 +0000
@@ -45,6 +45,12 @@
bool seekable = false );
virtual Item
+ createStreamableString( std::istream&,
+ StreamReleaser,
+ char const*,
+ bool seekable = false );
+
+ virtual Item
createAnyURI(const String& aURI);
virtual Item
@@ -76,6 +82,14 @@
bool seekable = false,
bool encoded = false);
+ virtual Item
+ createStreamableBase64Binary(
+ std::istream &stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable = false,
+ bool encoded = false);
+
virtual Item
createBoolean(bool aValue);
=== modified file 'src/runtime/fetch/fetch_impl.cpp'
--- src/runtime/fetch/fetch_impl.cpp 2012-09-19 21:16:15 +0000
+++ src/runtime/fetch/fetch_impl.cpp 2013-02-12 04:25:27 +0000
@@ -197,6 +197,7 @@
result,
*lRes->getStream(),
lRes->getStreamReleaser(),
+ lUri->getStringValue().c_str(),
lRes->isStreamSeekable(),
false
);
=== modified file 'src/runtime/json/json_impl.cpp'
--- src/runtime/json/json_impl.cpp 2013-02-07 03:44:12 +0000
+++ src/runtime/json/json_impl.cpp 2013-02-12 04:25:27 +0000
@@ -25,7 +25,9 @@
#include "system/globalenv.h"
#include "util/ascii_util.h"
+#include "util/cxx_util.h"
#include "util/mem_streambuf.h"
+#include "util/stream_util.h"
#include "jsonml_array.h"
#include "snelson.h"
@@ -65,6 +67,7 @@
istringstream iss;
mem_streambuf buf;
zstring s;
+ char const *uri;
PlanIteratorState *state;
DEFAULT_STACK_INIT( PlanIteratorState, state, planState );
@@ -79,19 +82,24 @@
istream *is;
if ( cur_item->isStreamable() ) {
is = &cur_item->getStream();
+ uri = get_uri( *is );
} else {
cur_item->getStringValue2( s );
// Doing it this way uses the string data in-place with no copy.
buf.set( s.data(), s.size() );
iss.ios::rdbuf( &buf );
is = &iss;
+ uri = nullptr;
}
try {
json::parser p( *is );
- p.set_loc(
- loc.getFilename().c_str(), loc.getLineBegin(), loc.getColumnBegin()
- );
+ if ( uri )
+ p.set_loc( uri, 1, 1 );
+ else
+ p.set_loc(
+ loc.getFilename().c_str(), loc.getLineBegin(), loc.getColumnBegin()
+ );
options_type::mapped_type const &format = options[ "json-format" ];
ZORBA_ASSERT( !format.empty() );
=== modified file 'src/runtime/json/jsoniq_functions_impl.cpp'
--- src/runtime/json/jsoniq_functions_impl.cpp 2012-12-07 23:59:55 +0000
+++ src/runtime/json/jsoniq_functions_impl.cpp 2013-02-12 04:25:27 +0000
@@ -56,6 +56,7 @@
#include <store/api/copymode.h>
#include "util/uri_util.h"
+#include "util/stream_util.h"
#include <zorba/store_consts.h>
#include <zorbatypes/URI.h>
@@ -809,6 +810,7 @@
{
store::Item_t lInput;
bool lStripTopLevelArray = false;
+ char const *stream_uri;
JSONParseIteratorState* state;
DEFAULT_STACK_INIT(JSONParseIteratorState, state, planState);
@@ -831,12 +833,14 @@
{
state->theInput = lInput;
state->theInputStream = &lInput->getStream();
+ stream_uri = get_uri( *state->theInputStream );
}
else
{
// will be deleted in the state
state->theInputStream =
new std::stringstream( lInput->getStringValue().c_str() );
+ stream_uri = nullptr;
}
state->loader_ = new json::loader(
@@ -852,6 +856,8 @@
theRelativeLocation.getColumnBegin()
);
}
+ if ( stream_uri )
+ state->loader_->set_loc( stream_uri, 1, 1 );
while ( state->loader_->next( &result ) ) {
if ( !state->theAllowMultiple && state->theGotOne ) {
=== modified file 'src/store/api/item_factory.h'
--- src/store/api/item_factory.h 2012-09-19 21:16:15 +0000
+++ src/store/api/item_factory.h 2013-02-12 04:25:27 +0000
@@ -96,6 +96,13 @@
StreamReleaser,
bool seekable = false) = 0;
+ virtual bool createStreamableString(
+ Item_t& result,
+ std::istream&,
+ StreamReleaser,
+ char const *uri,
+ bool seekable = false) = 0;
+
/**
* Create a StreamableStringItem which re-uses the stream from another
* Streamable*Item. This will maintain a reference to the original
@@ -241,6 +248,13 @@
bool seekable = false,
bool encoded = false) = 0;
+ virtual bool createStreamableBase64Binary(
+ Item_t& result,
+ std::istream&,
+ StreamReleaser,
+ char const *uri,
+ bool seekable = false,
+ bool encoded = false) = 0;
/**
* Specification: [http://www.w3.org/TR/xmlschema-2/#bool]
=== modified file 'src/store/naive/simple_item_factory.cpp'
--- src/store/naive/simple_item_factory.cpp 2013-01-16 15:16:33 +0000
+++ src/store/naive/simple_item_factory.cpp 2013-02-12 04:25:27 +0000
@@ -41,6 +41,7 @@
#endif
#include "util/ascii_util.h"
+#include "util/stream_util.h"
namespace zorba { namespace simplestore {
@@ -160,6 +161,18 @@
return true;
}
+bool BasicItemFactory::createStreamableString(
+ store::Item_t& result,
+ std::istream& stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable)
+{
+ result = new StreamableStringItem(store::XS_STRING, stream, streamReleaser, seekable);
+ set_uri( stream, uri );
+ return true;
+}
+
bool BasicItemFactory::createSharedStreamableString(
store::Item_t& result,
store::Item_t& streamable_dependent)
@@ -1046,6 +1059,24 @@
}
+bool BasicItemFactory::createStreamableBase64Binary(
+ store::Item_t& result,
+ std::istream& aStream,
+ StreamReleaser aReleaser,
+ char const *uri,
+ bool seekable,
+ bool encoded)
+{
+ result = new StreamableBase64BinaryItem(store::XS_BASE64BINARY,
+ aStream,
+ aReleaser,
+ seekable,
+ encoded);
+ set_uri( aStream, uri );
+ return true;
+}
+
+
bool BasicItemFactory::createHexBinary(store::Item_t& result, xs_hexBinary value)
{
result = new HexBinaryItem(store::XS_HEXBINARY, value);
=== modified file 'src/store/naive/simple_item_factory.h'
--- src/store/naive/simple_item_factory.h 2012-09-19 21:16:15 +0000
+++ src/store/naive/simple_item_factory.h 2013-02-12 04:25:27 +0000
@@ -109,6 +109,13 @@
StreamReleaser,
bool seekable = false);
+ bool createStreamableString(
+ store::Item_t& result,
+ std::istream& stream,
+ StreamReleaser streamReleaser,
+ char const *uri,
+ bool seekable = false);
+
bool createSharedStreamableString(
store::Item_t& result,
store::Item_t& streamable_dependent);
@@ -128,6 +135,14 @@
bool seekable = false,
bool encoded = false);
+ bool createStreamableBase64Binary(
+ store::Item_t& result,
+ std::istream&,
+ StreamReleaser,
+ char const *uri,
+ bool seekable = false,
+ bool encoded = false);
+
bool createBoolean(store::Item_t& result, xs_boolean value);
=== modified file 'src/util/CMakeLists.txt'
--- src/util/CMakeLists.txt 2013-01-25 22:30:06 +0000
+++ src/util/CMakeLists.txt 2013-02-12 04:25:27 +0000
@@ -24,6 +24,7 @@
json_util.cpp
mem_streambuf.cpp
regex.cpp
+ stream_util.cpp
string_util.cpp
time_util.cpp
time_parse.cpp
=== modified file 'src/util/indent.h'
--- src/util/indent.h 2012-09-19 21:16:15 +0000
+++ src/util/indent.h 2013-02-12 04:25:27 +0000
@@ -29,7 +29,7 @@
* @param os The ostream to get the indentation amount for.
* @return Returns a modifyable reference to said indentation.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
long& get_indent( std::basic_ostream<charT,Traits> &os )
{
//
@@ -46,7 +46,7 @@
* @param os The ostream to increment the indentation amount of.
* @return Returns the given ostream.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
std::basic_ostream<charT,Traits>&
inc_indent( std::basic_ostream<charT,Traits> &os )
{
@@ -60,7 +60,7 @@
* @param os The ostream to decrement the indentation amount of.
* @return Returns the given ostream.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
std::basic_ostream<charT,Traits>&
dec_indent( std::basic_ostream<charT,Traits> &os )
{
@@ -77,7 +77,7 @@
* @param os The ostream to emit the space characters to.
* @return Returns the given ostream.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
std::basic_ostream<charT,Traits>&
indent( std::basic_ostream<charT,Traits> &os )
{
=== added file 'src/util/stream_util.cpp'
--- src/util/stream_util.cpp 1970-01-01 00:00:00 +0000
+++ src/util/stream_util.cpp 2013-02-12 04:25:27 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+#include "stdafx.h"
+
+#include "stream_util.h"
+
+using namespace std;
+
+namespace zorba {
+
+///////////////////////////////////////////////////////////////////////////////
+
+int get_stream_uri_index() {
+ //
+ // This function is out-of-line because it has a static constant within it.
+ // It has a static constant within it to guarantee (1) initialization before
+ // use and (2) initialization happens exactly once.
+ //
+ // See: "Standard C++ IOStreams and Locales: Advanced Programmer's Guide and
+ // Reference," Angelika Langer and Klaus Kreft, Addison-Wesley, 2000, section
+ // 3.3.1.1: "Initializing and Maintaining the iword/pword Index."
+ //
+ // See: "The C++ Programming Language," Bjarne Stroustrup, Addison-Wesley,
+ // 2000, section 10.4.8: "Local Static Store."
+ //
+ static int const index = ios_base::xalloc();
+ return index;
+}
+
+void delete_stream_uri_callback( ios_base::event e, ::ios_base &ios,
+ int index ) {
+ //
+ // See: "Standard C++ IOStreams and Locales: Advanced Programmer's Guide and
+ // Reference," Angelika Langer and Klaus Kreft, Addison-Wesley, 2000, section
+ // 3.3.1.4: "Using Stream Callbacks for Memory Management."
+ //
+ if ( e == ios_base::erase_event )
+ delete[] static_cast<char const*>( ios.pword( index ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+/* vim:set et sw=2 ts=2: */
=== added file 'src/util/stream_util.h'
--- src/util/stream_util.h 1970-01-01 00:00:00 +0000
+++ src/util/stream_util.h 2013-02-12 04:25:27 +0000
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2006-2008 The FLWOR Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+#ifndef ZORBA_STREAM_UTIL_H
+#define ZORBA_STREAM_UTIL_H
+
+#include <iostream>
+
+#include "string_util.h"
+
+namespace zorba {
+
+int get_stream_uri_index();
+void delete_stream_uri_callback( std::ios_base::event, std::ios_base&, int );
+
+///////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Sets a URI value for the given iostream. The URI is intended to be used to
+ * note the origination or destination URI (e.g., file) that data is coming
+ * from or going to.
+ * If the given iostream already has a URI set for it, that URI is replaced.
+ *
+ * @param ios The iostream to set the URI of.
+ * @param uri The URI to set.
+ */
+template<typename charT,class Traits> inline
+void set_uri( std::basic_ios<charT,Traits> &ios, char const *uri ) {
+ int const index = get_stream_uri_index();
+ void *&pword = ios.pword( index );
+ if ( pword )
+ delete[] static_cast<char const*>( pword );
+ pword = ztd::new_strdup( uri );
+ ios.register_callback( delete_stream_uri_callback, index );
+}
+
+/**
+ * Gets a URI value for the given iostream.
+ *
+ * @param ios The iostream to get the URI of.
+ * @return Returns said URI or \c null if none was set.
+ */
+template<typename charT,class Traits> inline
+char const* get_uri( std::basic_ios<charT,Traits> &ios ) {
+ return static_cast<char const*>( ios.pword( get_stream_uri_index() ) );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+} // namespace zorba
+
+#endif /* ZORBA_STREAM_UTIL_H */
+/*
+ * Local variables:
+ * mode: c++
+ * End:
+ */
+/* vim:set et sw=2 ts=2: */
=== modified file 'src/util/utf8_streambuf.h'
--- src/util/utf8_streambuf.h 2013-01-09 05:09:48 +0000
+++ src/util/utf8_streambuf.h 2013-02-12 04:25:27 +0000
@@ -149,7 +149,7 @@
* already has a utf8::streambuf attached to it, this function does
* nothing.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
void attach( std::basic_ios<charT,Traits> &ios ) {
int const index = get_streambuf_index();
void *&pword = ios.pword( index );
@@ -168,7 +168,7 @@
* @param ios The stream to detach the utf8::streambuf from. If the stream
* doesn't have a utf8::streambuf attached to it, this function does nothing.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
void detach( std::basic_ios<charT,Traits> &ios ) {
int const index = get_streambuf_index();
if ( streambuf *const buf = static_cast<streambuf*>( ios.pword( index ) ) ) {
@@ -184,7 +184,7 @@
* @param ios The stream to check.
* @return \c true only if a utf8::streambuf is attached.
*/
-template<typename charT,typename Traits> inline
+template<typename charT,class Traits> inline
bool is_attached( std::basic_ios<charT,Traits> &ios ) {
return !!ios.pword( get_streambuf_index() );
}
=== modified file 'test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res 2013-02-08 00:41:29 +0000
+++ test/rbkt/ExpQueryResults/zorba/error/data-location-json-1.xml.res 2013-02-12 04:25:27 +0000
@@ -1,1 +1,1 @@
-. 3 1
+data-location.json 3 1
=== added file 'test/rbkt/ExpQueryResults/zorba/error/data-location-json-2.xml.res'
--- test/rbkt/ExpQueryResults/zorba/error/data-location-json-2.xml.res 1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpQueryResults/zorba/error/data-location-json-2.xml.res 2013-02-12 04:25:27 +0000
@@ -0,0 +1,1 @@
+data-location.json 3 1
=== modified file 'test/rbkt/Queries/zorba/error/data-location-json-1.xq'
--- test/rbkt/Queries/zorba/error/data-location-json-1.xq 2013-02-08 00:41:29 +0000
+++ test/rbkt/Queries/zorba/error/data-location-json-1.xq 2013-02-12 04:25:27 +0000
@@ -9,13 +9,7 @@
jn:parse-json( $json )
}
catch * {
- (:
- : This "if" is here temporarily until streamable strings have their
- : filenames passed along with them.
- :)
- if ( exists( $zerr:data-uri ) )
- then file:base-name( $zerr:data-uri )
- else (),
+ file:base-name( $zerr:data-uri ),
$zerr:data-line-number,
$zerr:data-column-number
}
=== added file 'test/rbkt/Queries/zorba/error/data-location-json-2.xq'
--- test/rbkt/Queries/zorba/error/data-location-json-2.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/error/data-location-json-2.xq 2013-02-12 04:25:27 +0000
@@ -0,0 +1,17 @@
+import module namespace file = "http://expath.org/ns/file";;
+import module namespace json = "http://www.zorba-xquery.com/modules/converters/json";;
+declare namespace zerr = "http://www.zorba-xquery.com/errors";;
+
+let $file := "$RBKT_SRC_DIR/Queries/zorba/error/data-location.json"
+let $json := file:read-text( $file )
+return
+ try {
+ json:parse( $json )
+ }
+ catch * {
+ file:base-name( $zerr:data-uri ),
+ $zerr:data-line-number,
+ $zerr:data-column-number
+ }
+
+(: vim:set et sw=2 ts=2: :)
Follow ups
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: noreply, 2013-02-13
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Zorba Build Bot, 2013-02-13
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Zorba Build Bot, 2013-02-13
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Paul J. Lucas, 2013-02-13
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Zorba Build Bot, 2013-02-13
-
Re: [Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Zorba Build Bot, 2013-02-13
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Zorba Build Bot, 2013-02-13
-
[Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Matthias Brantner, 2013-02-13
-
Re: [Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Matthias Brantner, 2013-02-13
-
Re: [Merge] lp:~zorba-coders/zorba/bug-1122396 into lp:zorba
From: Paul J. Lucas, 2013-02-12