zorba-coders team mailing list archive
-
zorba-coders team
-
Mailing list archive
-
Message #13737
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
David Graf has proposed merging lp:~davidagraf/zorba/paging_index_probe into lp:zorba.
Requested reviews:
David Graf (davidagraf)
For more details, see:
https://code.launchpad.net/~davidagraf/zorba/paging_index_probe/+merge/122621
skip for value probes
--
https://code.launchpad.net/~davidagraf/zorba/paging_index_probe/+merge/122621
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h 2012-08-30 13:45:43 +0000
+++ include/zorba/pregenerated/diagnostic_list.h 2012-09-04 07:00:27 +0000
@@ -750,6 +750,8 @@
extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZSTR0065_STRINGS_IN_POOL;
+extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZSTR0066_REFERENCED_NODE_NOT_IN_COLLECTION;
+
extern ZORBA_DLL_PUBLIC ZorbaErrorCode XSST0001;
extern ZORBA_DLL_PUBLIC ZorbaErrorCode XSST0002;
=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2012-08-30 13:45:43 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq 2012-09-04 07:00:27 +0000
@@ -781,6 +781,10 @@
(:~
:)
+declare variable $zerr:ZSTR0066 as xs:QName := fn:QName($zerr:NS, "zerr:ZSTR0066");
+
+(:~
+:)
declare variable $zerr:XSST0001 as xs:QName := fn:QName($zerr:NS, "zerr:XSST0001");
(:~
=== modified file 'modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq 2012-08-30 13:45:43 +0000
+++ modules/com/zorba-xquery/www/modules/store/dynamic/collections/dml.xq 2012-09-04 07:00:27 +0000
@@ -632,6 +632,31 @@
(:~
+ : The collection function returns the sequence of nodes and/or json items
+ : that belong to the collection identified by the given name.
+ :
+ : @param $name The name of the collection.
+ : @param $start The reference to first node to return. All nodes before
+ are skipped (order is implementation dependent).
+ : @param $skip The number of collection items to skip. Might be negative to
+ navigate relative from $start (order is
+ implementation dependent).
+ :
+ : @return The sequence contained in the given collection.
+ :
+ : @error zerr:ZDDY0003 If available collections does not provide a mapping
+ : for the expanded QName $name.
+ : @error zerr:ZSTR0066 if the passed reference $start doesn't reference
+ : a not from the collection identified by $name.
+ :
+ :)
+declare function
+dml:collection($name as xs:QName,
+ $start as xs:anyURI,
+ $skip as xs:integer) as item()* external;
+
+
+(:~
: The collection-name function returns the name of the collection the given
: item (node or json item) belongs to.
:
=== modified file 'modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq 2012-08-30 13:45:43 +0000
+++ modules/com/zorba-xquery/www/modules/store/static/collections/dml.xq 2012-09-04 07:00:27 +0000
@@ -884,6 +884,29 @@
(:~
+ : The collection function returns the sequence of nodes and/or json items
+ : that belong to the collection identified by the given name.
+ :
+ : @param $name The name of the collection.
+ : @param $start The reference to first node to return. All nodes before
+ are skipped (order is implementation dependent).
+ : @param $skip The number of collection items to skip. Might be negative to
+ navigate relative from $start (order is
+ implementation dependent).
+ :
+ : @return The sequence contained in the given collection.
+ :
+ : @error zerr:ZDDY0001 if the collection identified by $name is not declared.
+ : @error zerr:ZDDY0003 if the collection identified by $name is not available.
+ : @error zerr:ZSTR0066 if the passed reference $start doesn't reference
+ : a not from the collection identified by $name.
+ :
+ :)
+declare function
+cdml:collection($name as xs:QName,
+ $start as xs:anyURI,
+ $skip as xs:integer) as item()* external;
+(:~
: The collection-name function returns the name of the collection the given
: item (node or json item) belongs to.
:
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp 2012-08-31 12:40:20 +0000
+++ src/compiler/translator/translator.cpp 2012-09-04 07:00:27 +0000
@@ -1386,6 +1386,13 @@
else
paramType = theRTM.ANY_ATOMIC_TYPE_QUESTION;
}
+ else if (func->getKind() == FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_SKIP_N)
+ {
+ if (i <= 1)
+ paramType = sign[i];
+ else
+ paramType = theRTM.ANY_ATOMIC_TYPE_QUESTION;
+ }
else if (func->getKind() == FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_N)
{
if (i == 0)
@@ -1395,6 +1402,15 @@
else
paramType = theRTM.BOOLEAN_TYPE_ONE;
}
+ else if (func->getKind() == FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_SKIP_N)
+ {
+ if (i <= 1)
+ paramType = sign[i];
+ else if (i % 6 == 2 || i % 6 == 3)
+ paramType = theRTM.ANY_ATOMIC_TYPE_QUESTION;
+ else
+ paramType = theRTM.BOOLEAN_TYPE_ONE;
+ }
else if (func->getKind() == FunctionConsts::FN_ZORBA_INVOKE_N ||
func->getKind() == FunctionConsts::FN_ZORBA_INVOKE_N_N ||
func->getKind() == FunctionConsts::FN_ZORBA_INVOKE_U_N ||
@@ -10510,7 +10526,9 @@
switch (lKind)
{
case FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_N:
+ case FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_SKIP_N:
case FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_N:
+ case FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_SKIP_N:
{
FunctionConsts::FunctionKind fkind = FunctionConsts::OP_SORT_NODES_ASC_1;
=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml 2012-08-31 19:53:50 +0000
+++ src/diagnostics/diagnostic_en.xml 2012-09-04 07:00:27 +0000
@@ -2433,6 +2433,10 @@
<value>Zorba did not close properly, objects may still in memory.\n$1 referenced URI(s) remain in the string pool.\nFor help avoiding this message please refer to http://www.zorba-xquery.com/html/documentation in section General Architecture -> Memory Leaks.</value>
</diagnostic>
+ <diagnostic code="ZSTR0066" name="REFERENCED_NODE_NOT_IN_COLLECTION">
+ <value>Node reference $1 doesn't reference a node in collection $2.</value>
+ </diagnostic>
+
<!--////////// XQuery Scripting ////////////////////////////////////////-->
<diagnostic code="XSST0001">
=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp 2012-08-30 13:45:43 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp 2012-09-04 07:00:27 +0000
@@ -1103,6 +1103,9 @@
ZorbaErrorCode ZSTR0065_STRINGS_IN_POOL( "ZSTR0065" );
+ZorbaErrorCode ZSTR0066_REFERENCED_NODE_NOT_IN_COLLECTION( "ZSTR0066" );
+
+
ZorbaErrorCode XSST0001( "XSST0001" );
=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp 2012-08-31 19:53:50 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp 2012-09-04 07:00:27 +0000
@@ -444,6 +444,7 @@
{ "ZSTR0055", "streamable string has already been consumed" },
{ "ZSTR0060", "out of range: $1" },
{ "ZSTR0065", "Zorba did not close properly, objects may still in memory.\n$1 referenced URI(s) remain in the string pool.\nFor help avoiding this message please refer to http://www.zorba-xquery.com/html/documentation in section General Architecture -> Memory Leaks." },
+ { "ZSTR0066", "Node reference $1 doesn't reference a node in collection $2." },
{ "ZWST0002", "\"$1\": unknown or unsupported annotation" },
{ "ZWST0003", "\"$1\": function declared sequential, but has non-sequential body" },
{ "ZWST0004", "Sequential FLWOR expr may not have the semantics you expect" },
=== modified file 'src/functions/func_index_ddl.cpp'
--- src/functions/func_index_ddl.cpp 2012-08-30 13:45:43 +0000
+++ src/functions/func_index_ddl.cpp 2012-09-04 07:00:27 +0000
@@ -109,7 +109,18 @@
std::vector<PlanIter_t>& argv,
expr& ann) const
{
- return new ProbeIndexPointValueIterator(sctx, loc, argv);
+ return new ProbeIndexPointValueIterator(sctx, loc, argv, false, false);
+}
+
+
+PlanIter_t fn_zorba_ddl_probe_index_point_value_skip::codegen(
+ CompilerCB*,
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& argv,
+ expr& ann) const
+{
+ return new ProbeIndexPointValueIterator(sctx, loc, argv, false, true);
}
@@ -131,7 +142,18 @@
std::vector<PlanIter_t>& argv,
expr& ann) const
{
- return new ProbeIndexRangeValueIterator(sctx, loc, argv);
+ return new ProbeIndexRangeValueIterator(sctx, loc, argv, false, false);
+}
+
+
+PlanIter_t fn_zorba_ddl_probe_index_range_value_skip::codegen(
+ CompilerCB*,
+ static_context* sctx,
+ const QueryLoc& loc,
+ std::vector<PlanIter_t>& argv,
+ expr& ann) const
+{
+ return new ProbeIndexRangeValueIterator(sctx, loc, argv, false, true);
}
@@ -197,6 +219,15 @@
true,
GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR));
+ DECL(sctx, fn_zorba_ddl_probe_index_point_value_skip,
+ (createQName("http://www.zorba-xquery.com/modules/store/static/indexes/dml",
+ "",
+ "probe-index-point-value-skip"),
+ GENV_TYPESYSTEM.QNAME_TYPE_ONE,
+ GENV_TYPESYSTEM.INTEGER_TYPE_ONE,
+ true,
+ GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR));
+
DECL(sctx, fn_zorba_ddl_probe_index_point_general,
(createQName("http://www.zorba-xquery.com/modules/store/static/indexes/dml",
"",
@@ -214,6 +245,15 @@
true,
GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR));
+ DECL(sctx, fn_zorba_ddl_probe_index_range_value_skip,
+ (createQName("http://www.zorba-xquery.com/modules/store/static/indexes/dml",
+ "",
+ "probe-index-range-value-skip"),
+ GENV_TYPESYSTEM.QNAME_TYPE_ONE,
+ GENV_TYPESYSTEM.INTEGER_TYPE_ONE,
+ true,
+ GENV_TYPESYSTEM.ANY_NODE_TYPE_STAR));
+
DECL(sctx, fn_zorba_ddl_probe_index_range_general,
(createQName("http://www.zorba-xquery.com/modules/store/static/indexes/dml",
"",
=== modified file 'src/functions/func_index_ddl.h'
--- src/functions/func_index_ddl.h 2012-08-30 13:45:43 +0000
+++ src/functions/func_index_ddl.h 2012-09-04 07:00:27 +0000
@@ -194,6 +194,37 @@
/*******************************************************************************
+ fn-zorba-ddl:probe-index-point-value-skip(
+ $indexName as xs:QName,
+ $skip as xs:integer,
+ $key1 as xs:anyAtomicItem?,
+ ....
+ $keyN as xs:anyAtomicItem?) as node()*
+
+ Note: the translator wraps calls to this function with an OP_NODE_SORT_ASC
+ function.
+********************************************************************************/
+class fn_zorba_ddl_probe_index_point_value_skip : public function
+{
+public:
+ fn_zorba_ddl_probe_index_point_value_skip(const signature& sig)
+ :
+ function(sig, FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_SKIP_N)
+ {
+ }
+
+ bool accessesDynCtx() const { return true; }
+
+ FunctionConsts::AnnotationValue producesDistinctNodes() const
+ {
+ return FunctionConsts::YES;
+ }
+
+ CODEGEN_DECL();
+};
+
+
+/*******************************************************************************
fn-zorba-ddl:probe-index-point-general(
$indexName as xs:QName,
$keys as xs:anyAtomicItem*) as node()*
@@ -244,6 +275,35 @@
/*******************************************************************************
+ fn-zorba-ddl:probe-index-range-value-skip(
+ $indexName as xs:QName,
+ $skip as xs:integer,
+ ....) as node()*
+
+ Note: the translator wraps calls to this function with an OP_NODE_SORT_ASC
+ function.
+********************************************************************************/
+class fn_zorba_ddl_probe_index_range_value_skip : public function
+{
+public:
+ fn_zorba_ddl_probe_index_range_value_skip(const signature& sig)
+ :
+ function(sig, FunctionConsts::FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_SKIP_N)
+ {
+ }
+
+ bool accessesDynCtx() const { return true; }
+
+ FunctionConsts::AnnotationValue producesDistinctNodes() const
+ {
+ return FunctionConsts::YES;
+ }
+
+ CODEGEN_DECL();
+};
+
+
+/*******************************************************************************
fn-zorba-ddl:probe-index-range-general(
$indexName as xs:QName,
$lowerBoundKeys as xs:anyAtomicType*,
=== modified file 'src/functions/func_sequences_impl.cpp'
--- src/functions/func_sequences_impl.cpp 2012-08-30 13:45:43 +0000
+++ src/functions/func_sequences_impl.cpp 2012-09-04 07:00:27 +0000
@@ -543,16 +543,19 @@
ZorbaCollectionIterator& collection =
static_cast<ZorbaCollectionIterator&>(*argv[0]);
- return new CountCollectionIterator(
- sctx,
- loc,
- collection.getChildren(),
- (
- collection.isDynamic()
- ? CountCollectionIterator::ZORBADYNAMIC
- : CountCollectionIterator::ZORBASTATIC
- )
- );
+ if (collection.isCountOptimizable())
+ {
+ return new CountCollectionIterator(
+ sctx,
+ loc,
+ collection.getChildren(),
+ (
+ collection.isDynamic()
+ ? CountCollectionIterator::ZORBADYNAMIC
+ : CountCollectionIterator::ZORBASTATIC
+ )
+ );
+ }
}
else if (typeid(FnCollectionIterator) == counted_type)
{
@@ -570,7 +573,7 @@
= static_cast<ProbeIndexPointValueIterator&>(*argv[0]);
return new ProbeIndexPointValueIterator(
- sctx, loc, lIter.getChildren(), true);
+ sctx, loc, lIter.getChildren(), true, lIter.hasSkip());
}
else if (typeid(ProbeIndexRangeValueIterator) == counted_type)
{
@@ -578,7 +581,7 @@
= static_cast<ProbeIndexRangeValueIterator&>(*argv[0]);
return new ProbeIndexRangeValueIterator(
- sctx, loc, lIter.getChildren(), true);
+ sctx, loc, lIter.getChildren(), true, lIter.hasSkip());
}
else if (typeid(ProbeIndexPointGeneralIterator) == counted_type)
{
=== modified file 'src/functions/function_consts.h'
--- src/functions/function_consts.h 2012-08-30 13:45:43 +0000
+++ src/functions/function_consts.h 2012-09-04 07:00:27 +0000
@@ -52,8 +52,10 @@
FN_ZORBA_INVOKE_S_N,
FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_N,
+ FN_ZORBA_XQDDF_PROBE_INDEX_POINT_VALUE_SKIP_N,
FN_ZORBA_XQDDF_PROBE_INDEX_POINT_GENERAL_N,
FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_N,
+ FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_VALUE_SKIP_N,
FN_ZORBA_XQDDF_PROBE_INDEX_RANGE_GENERAL_N,
OP_CREATE_INTERNAL_INDEX_2,
FN_ZORBA_XQDDF_CREATE_INDEX_1,
=== modified file 'src/functions/pregenerated/func_collections.cpp'
--- src/functions/pregenerated/func_collections.cpp 2012-08-30 13:45:43 +0000
+++ src/functions/pregenerated/func_collections.cpp 2012-09-04 07:00:27 +0000
@@ -355,6 +355,20 @@
{
DECL_WITH_KIND(sctx, static_collections_dml_collection,
+ (createQName("http://www.zorba-xquery.com/modules/store/static/collections/dml","","collection"),
+ GENV_TYPESYSTEM.QNAME_TYPE_ONE,
+ GENV_TYPESYSTEM.ANY_URI_TYPE_ONE,
+ GENV_TYPESYSTEM.INTEGER_TYPE_ONE,
+ GENV_TYPESYSTEM.STRUCTURED_ITEM_TYPE_STAR),
+ FunctionConsts::STATIC_COLLECTIONS_DML_COLLECTION_3);
+
+ }
+
+
+
+
+ {
+ DECL_WITH_KIND(sctx, static_collections_dml_collection,
(createQName("http://www.zorba-xquery.com/modules/store/dynamic/collections/dml","","collection"),
GENV_TYPESYSTEM.QNAME_TYPE_ONE,
GENV_TYPESYSTEM.STRUCTURED_ITEM_TYPE_STAR),
@@ -379,6 +393,20 @@
{
+ DECL_WITH_KIND(sctx, static_collections_dml_collection,
+ (createQName("http://www.zorba-xquery.com/modules/store/dynamic/collections/dml","","collection"),
+ GENV_TYPESYSTEM.QNAME_TYPE_ONE,
+ GENV_TYPESYSTEM.ANY_URI_TYPE_ONE,
+ GENV_TYPESYSTEM.INTEGER_TYPE_ONE,
+ GENV_TYPESYSTEM.STRUCTURED_ITEM_TYPE_STAR),
+ FunctionConsts::DYNAMIC_COLLECTIONS_DML_COLLECTION_3);
+
+ }
+
+
+
+
+ {
DECL_WITH_KIND(sctx, static_collections_dml_collection_name,
(createQName("http://www.zorba-xquery.com/modules/store/static/collections/dml","","collection-name"),
GENV_TYPESYSTEM.STRUCTURED_ITEM_TYPE_ONE,
=== modified file 'src/functions/pregenerated/function_enum.h'
--- src/functions/pregenerated/function_enum.h 2012-08-30 13:45:43 +0000
+++ src/functions/pregenerated/function_enum.h 2012-09-04 07:00:27 +0000
@@ -55,8 +55,10 @@
FN_COLLECTION_1,
STATIC_COLLECTIONS_DML_COLLECTION_1,
STATIC_COLLECTIONS_DML_COLLECTION_2,
+ STATIC_COLLECTIONS_DML_COLLECTION_3,
DYNAMIC_COLLECTIONS_DML_COLLECTION_1,
DYNAMIC_COLLECTIONS_DML_COLLECTION_2,
+ DYNAMIC_COLLECTIONS_DML_COLLECTION_3,
STATIC_COLLECTIONS_DML_COLLECTION_NAME_1,
DYNAMIC_COLLECTIONS_DML_COLLECTION_NAME_1,
STATIC_COLLECTIONS_DML_INDEX_OF_1,
=== modified file 'src/functions/signature.cpp'
--- src/functions/signature.cpp 2012-08-30 13:45:43 +0000
+++ src/functions/signature.cpp 2012-09-04 07:00:27 +0000
@@ -31,78 +31,94 @@
{
SERIALIZABLE_CLASS_VERSIONS(signature)
-
-
-signature::signature(
- const store::Item_t& name,
- const xqtref_t& paramType1,
- bool variadic,
- const xqtref_t& returnType)
- :
- theQName(name),
- theIsVariadic(variadic)
-{
- theTypes.push_back(returnType);
- theTypes.push_back(paramType1);
-}
-
-
-signature::signature(
- const store::Item_t& name,
- const xqtref_t& returnType)
- :
- theQName(name),
- theIsVariadic(false)
-{
- theTypes.push_back(returnType);
-}
-
-
-signature::signature(
- const store::Item_t& name,
- const xqtref_t& paramType1,
- const xqtref_t& returnType)
- :
- theQName(name),
- theIsVariadic(false)
-{
- theTypes.push_back(returnType);
- theTypes.push_back(paramType1);
-}
-
-
-signature::signature(
- const store::Item_t& name,
- const xqtref_t& paramType1,
- const xqtref_t& paramType2,
- const xqtref_t& returnType)
- :
- theQName(name),
- theIsVariadic(false)
-{
- theTypes.push_back(returnType);
- theTypes.push_back(paramType1);
- theTypes.push_back(paramType2);
-}
-
-
-signature::signature(
- const store::Item_t& name,
- const xqtref_t& paramType1,
- const xqtref_t& paramType2,
+
+
+signature::signature(
+ const store::Item_t& name,
+ const xqtref_t& paramType1,
+ bool variadic,
+ const xqtref_t& returnType)
+ :
+ theQName(name),
+ theIsVariadic(variadic)
+{
+ theTypes.push_back(returnType);
+ theTypes.push_back(paramType1);
+}
+
+
+signature::signature(
+ const store::Item_t& name,
+ const xqtref_t& paramType1,
+ const xqtref_t& paramType2,
+ bool variadic,
+ const xqtref_t& returnType)
+ :
+ theQName(name),
+ theIsVariadic(variadic)
+{
+ theTypes.push_back(returnType);
+ theTypes.push_back(paramType1);
+ theTypes.push_back(paramType2);
+}
+
+
+signature::signature(
+ const store::Item_t& name,
+ const xqtref_t& returnType)
+ :
+ theQName(name),
+ theIsVariadic(false)
+{
+ theTypes.push_back(returnType);
+}
+
+
+signature::signature(
+ const store::Item_t& name,
+ const xqtref_t& paramType1,
+ const xqtref_t& returnType)
+ :
+ theQName(name),
+ theIsVariadic(false)
+{
+ theTypes.push_back(returnType);
+ theTypes.push_back(paramType1);
+}
+
+
+signature::signature(
+ const store::Item_t& name,
+ const xqtref_t& paramType1,
+ const xqtref_t& paramType2,
+ const xqtref_t& returnType)
+ :
+ theQName(name),
+ theIsVariadic(false)
+{
+ theTypes.push_back(returnType);
+ theTypes.push_back(paramType1);
+ theTypes.push_back(paramType2);
+}
+
+
+signature::signature(
+ const store::Item_t& name,
+ const xqtref_t& paramType1,
+ const xqtref_t& paramType2,
const xqtref_t& paramType3,
- const xqtref_t& returnType)
- :
- theQName(name),
- theIsVariadic(false)
-{
- theTypes.push_back(returnType);
- theTypes.push_back(paramType1);
- theTypes.push_back(paramType2);
+ const xqtref_t& returnType)
+ :
+ theQName(name),
+ theIsVariadic(false)
+{
+ theTypes.push_back(returnType);
+ theTypes.push_back(paramType1);
+ theTypes.push_back(paramType2);
theTypes.push_back(paramType3);
}
-
-
+
+
signature::signature(
const store::Item_t& name,
const xqtref_t& paramType1,
=== modified file 'src/functions/signature.h'
--- src/functions/signature.h 2012-08-30 13:45:43 +0000
+++ src/functions/signature.h 2012-09-04 07:00:27 +0000
@@ -56,6 +56,13 @@
signature(
const store::Item_t& name,
+ const xqtref_t& paramType1,
+ const xqtref_t& paramType2,
+ bool variadic,
+ const xqtref_t& returnType);
+
+ signature(
+ const store::Item_t& name,
const xqtref_t& returnType);
signature(
=== modified file 'src/runtime/collections/collections_impl.cpp'
--- src/runtime/collections/collections_impl.cpp 2012-08-30 13:45:43 +0000
+++ src/runtime/collections/collections_impl.cpp 2012-09-04 07:00:27 +0000
@@ -367,6 +367,12 @@
}
}
+bool ZorbaCollectionIterator::isCountOptimizable() const
+{
+ // if ref is passed to the collections function, count cannot be
+ // optimized anymore.
+ return theChildren.size() <= 2;
+}
bool ZorbaCollectionIterator::nextImpl(
store::Item_t& result,
@@ -375,6 +381,7 @@
store::Item_t name;
store::Collection_t collection;
xs_integer lSkip;
+ zstring lStart;
ZorbaCollectionIteratorState* state;
DEFAULT_STACK_INIT(ZorbaCollectionIteratorState, state, planState);
@@ -383,21 +390,42 @@
(void)getCollection(theSctx, name, loc, theIsDynamic, collection);
- if (theChildren.size() > 1)
- {
- // skip parameter passed
+ if (theChildren.size() == 1)
+ {
+ state->theIterator = collection->getIterator();
+ }
+ else
+ {
+ bool lRefPassed = theChildren.size() >= 3;
+
+ // read positional skip parameter
store::Item_t lSkipItem;
- consumeNext(lSkipItem, theChildren[1].getp(), planState);
+ consumeNext(lSkipItem, theChildren[(lRefPassed ? 2 : 1)].getp(), planState);
lSkip = lSkipItem->getIntegerValue();
- // negative is transformed into 0
- state->theIterator = ( lSkip > xs_integer::zero()
- ? collection->getIterator(lSkip)
- : collection->getIterator()
- );
- }
- else
- {
- state->theIterator = collection->getIterator();
+ // negative skip is not allowed
+ if (lSkip < xs_integer::zero())
+ {
+ lSkip = xs_integer::zero();
+ }
+ if (!lRefPassed)
+ {
+ state->theIterator = collection->getIterator(lSkip);
+ }
+ else
+ {
+ store::Item_t lRefItem;
+ consumeNext(lRefItem, theChildren[1].getp(), planState);
+ lStart = lRefItem->getString();
+ try
+ {
+ state->theIterator = collection->getIterator(lSkip, lStart);
+ }
+ catch (ZorbaException& e)
+ {
+ set_source(e, loc);
+ throw;
+ }
+ }
}
ZORBA_ASSERT(state->theIterator != NULL);
=== modified file 'src/runtime/collections/pregenerated/collections.h'
--- src/runtime/collections/pregenerated/collections.h 2012-08-30 13:45:43 +0000
+++ src/runtime/collections/pregenerated/collections.h 2012-09-04 07:00:27 +0000
@@ -285,6 +285,8 @@
bool isDynamic() const { return theIsDynamic; }
+public:
+ bool isCountOptimizable() const;
void accept(PlanIterVisitor& v) const;
bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
=== modified file 'src/runtime/indexing/index_ddl.cpp'
--- src/runtime/indexing/index_ddl.cpp 2012-08-30 13:45:43 +0000
+++ src/runtime/indexing/index_ddl.cpp 2012-09-04 07:00:27 +0000
@@ -566,12 +566,14 @@
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children,
- bool aCountOnly)
+ bool aCountOnly,
+ bool aSkip)
:
NaryBaseIterator<ProbeIndexPointValueIterator,
ProbeIndexPointValueIteratorState>(sctx, loc, children),
theCheckKeyType(true),
- theCountOnly(aCountOnly)
+ theCountOnly(aCountOnly),
+ theSkip(aSkip)
{
}
@@ -588,6 +590,7 @@
ar & theCheckKeyType;
ar & theCountOnly;
+ ar & theSkip;
}
@@ -603,6 +606,8 @@
bool status;
TypeManager* tm = theSctx->get_typemanager();
RootTypeManager& rtm = GENV_TYPESYSTEM;
+ xs_integer lSkip = xs_integer::zero();
+ ulong lAmountNonKeyParams = (theSkip ? 2 : 1);
try
{
@@ -622,13 +627,14 @@
ERROR_PARAMS(qnameItem->getStringValue()));
}
- if (state->theIndexDecl->getNumKeyExprs() != numChildren-1)
+ if ( state->theIndexDecl->getNumKeyExprs()
+ != numChildren-lAmountNonKeyParams )
{
RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
ERROR_PARAMS(
qnameItem->getStringValue(),
"index",
- numChildren-1,
+ numChildren - lAmountNonKeyParams,
state->theIndexDecl->getNumKeyExprs())
);
}
@@ -649,7 +655,16 @@
cond = state->theIndex->createCondition(store::IndexCondition::POINT_VALUE);
- for (i = 1; i < numChildren; ++i)
+ // read skip
+ if (theSkip)
+ {
+ store::Item_t lSkipItem;
+ status = consumeNext(lSkipItem, theChildren[1], planState);
+ ZORBA_ASSERT(status);
+ lSkip = lSkipItem->getIntegerValue();
+ }
+
+ for (i = lAmountNonKeyParams; i < numChildren; ++i)
{
if (!consumeNext(keyItem, theChildren[i], planState))
{
@@ -659,11 +674,11 @@
if (theCheckKeyType)
{
- checkKeyType(loc, tm, state->theIndexDecl, i-1, keyItem);
+ checkKeyType(loc, tm, state->theIndexDecl, i-lAmountNonKeyParams, keyItem);
}
if (state->theIndexDecl->isGeneral() &&
- (state->theIndexDecl->getKeyTypes())[i-1] == NULL)
+ (state->theIndexDecl->getKeyTypes())[i-lAmountNonKeyParams] == NULL)
{
xqtref_t searchKeyType = tm->create_value_type(keyItem);
@@ -679,7 +694,7 @@
if (i == numChildren)
{
- state->theIterator->init(cond);
+ state->theIterator->init(cond, lSkip);
if (!theCountOnly)
{
@@ -942,12 +957,14 @@
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children,
- bool aCountOnly)
+ bool aCountOnly,
+ bool aSkip)
:
NaryBaseIterator<ProbeIndexRangeValueIterator,
ProbeIndexRangeValueIteratorState>(sctx, loc, children),
theCheckKeyType(true),
- theCountOnly(aCountOnly)
+ theCountOnly(aCountOnly),
+ theSkip(aSkip)
{
}
@@ -965,6 +982,7 @@
ar & theCheckKeyType;
ar & theCountOnly;
+ ar & theSkip;
}
@@ -979,6 +997,8 @@
bool status;
TypeManager* tm = theSctx->get_typemanager();
RootTypeManager& rtm = GENV_TYPESYSTEM;
+ xs_integer lSkip = xs_integer::zero();
+ ulong lAmountNonKeyParams = (theSkip ? 2 : 1);
try
{
@@ -1004,21 +1024,22 @@
ERROR_PARAMS(qname->getStringValue()));
}
- if (numChildren < 7 || (numChildren-1) % 6 != 0)
+ if (numChildren < (6 + lAmountNonKeyParams)
+ || (numChildren-lAmountNonKeyParams) % 6 != 0)
{
RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
ERROR_PARAMS(qname->getStringValue(),
"index",
- numChildren-1,
+ numChildren-lAmountNonKeyParams,
"multiple of 6"));
}
- if (indexDecl->getNumKeyExprs() * 6 < numChildren-1)
+ if (indexDecl->getNumKeyExprs() * 6 < numChildren-lAmountNonKeyParams)
{
RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
ERROR_PARAMS(qname->getStringValue(),
"index",
- numChildren-1,
+ numChildren-lAmountNonKeyParams,
indexDecl->getNumKeyExprs() * 6));
}
@@ -1038,9 +1059,18 @@
cond = state->theIndex->createCondition(store::IndexCondition::BOX_VALUE);
+ // read skip
+ if (theSkip)
+ {
+ store::Item_t lSkipItem;
+ status = consumeNext(lSkipItem, theChildren[1], planState);
+ ZORBA_ASSERT(status);
+ lSkip = lSkipItem->getIntegerValue();
+ }
+
ulong keyNo;
ulong i;
- for (i = 1, keyNo = 0; i < numChildren; i += 6, ++keyNo)
+ for (i = lAmountNonKeyParams, keyNo = 0; i < numChildren; i += 6, ++keyNo)
{
store::Item_t tempLeft;
store::Item_t tempRight;
@@ -1126,7 +1156,7 @@
cond->pushRange(tempLeft, tempRight, haveLeft, haveRight, inclLeft, inclRight);
}
- state->theIterator->init(cond);
+ state->theIterator->init(cond, lSkip);
if (!theCountOnly)
{
state->theIterator->open();
=== modified file 'src/runtime/indexing/index_ddl.h'
--- src/runtime/indexing/index_ddl.h 2012-08-30 13:45:43 +0000
+++ src/runtime/indexing/index_ddl.h 2012-09-04 07:00:27 +0000
@@ -346,6 +346,7 @@
protected:
bool theCheckKeyType;
bool theCountOnly;
+ bool theSkip;
public:
SERIALIZABLE_CLASS(ProbeIndexPointValueIterator);
@@ -359,10 +360,13 @@
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children,
- bool aCountOnly = false);
+ bool aCountOnly,
+ bool aSkip);
~ProbeIndexPointValueIterator();
+ bool hasSkip() const { return theSkip; }
+
void accept(PlanIterVisitor& v) const;
bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
@@ -469,6 +473,7 @@
protected:
bool theCheckKeyType;
bool theCountOnly;
+ bool theSkip;
public:
SERIALIZABLE_CLASS(ProbeIndexRangeValueIterator);
@@ -483,10 +488,13 @@
static_context* sctx,
const QueryLoc& loc,
std::vector<PlanIter_t>& children,
- bool aCountOnly = false);
+ bool aCountOnly,
+ bool aSkip);
~ProbeIndexRangeValueIterator();
+ bool hasSkip() const { return theSkip; }
+
void accept(PlanIterVisitor& v) const;
bool nextImpl(store::Item_t& result, PlanState& aPlanState) const;
=== modified file 'src/runtime/spec/collections/collections.xml'
--- src/runtime/spec/collections/collections.xml 2012-08-30 13:45:43 +0000
+++ src/runtime/spec/collections/collections.xml 2012-09-04 07:00:27 +0000
@@ -255,13 +255,29 @@
<zorba:output>structured-item()*</zorba:output>
</zorba:signature>
- <zorba:signature localname="collection" prefix="dynamic-collections-dml">
- <zorba:param>xs:QName</zorba:param>
- <zorba:output>structured-item()*</zorba:output>
- </zorba:signature>
-
- <zorba:signature localname="collection" prefix="dynamic-collections-dml">
- <zorba:param>xs:QName</zorba:param>
+ <zorba:signature localname="collection"
+ prefix="static-collections-dml">
+ <zorba:param>xs:QName</zorba:param>
+ <zorba:param>xs:anyURI</zorba:param><!-- start ref -->
+ <zorba:param>xs:integer</zorba:param><!-- nodes to skip -->
+ <zorba:output>structured-item()*</zorba:output>
+ </zorba:signature>
+
+ <zorba:signature localname="collection" prefix="dynamic-collections-dml">
+ <zorba:param>xs:QName</zorba:param>
+ <zorba:output>structured-item()*</zorba:output>
+ </zorba:signature>
+
+ <zorba:signature localname="collection" prefix="dynamic-collections-dml">
+ <zorba:param>xs:QName</zorba:param>
+ <zorba:param>xs:integer</zorba:param><!-- start to skip -->
+ <zorba:output>structured-item()*</zorba:output>
+ </zorba:signature>
+
+ <zorba:signature localname="collection"
+ prefix="dynamic-collections-dml">
+ <zorba:param>xs:QName</zorba:param>
+ <zorba:param>xs:anyURI</zorba:param><!-- node ref-->
<zorba:param>xs:integer</zorba:param><!-- nodes to skip -->
<zorba:output>structured-item()*</zorba:output>
</zorba:signature>
@@ -281,6 +297,10 @@
<zorba:member type="bool" name="theIsDynamic" getterName="isDynamic"/>
+ <zorba:method const="true"
+ name="isCountOptimizable"
+ return="bool" />
+
<zorba:state generateInit="false" generateReset="false" generateDestructor="false">
<zorba:member type="store::Iterator_t" name="theIterator"/>
<zorba:member type="bool" name="theIteratorOpened" defaultValue="false"/>
=== removed directory 'src/runtime/spec/json.moved'
=== modified file 'src/store/api/collection.h'
--- src/store/api/collection.h 2012-08-30 13:45:43 +0000
+++ src/store/api/collection.h 2012-09-04 07:00:27 +0000
@@ -54,11 +54,13 @@
* It is allowed to have several concurrent iterators on the same Collection,
* but each iterator should be used by a single thread only.
*
- * @param aSkip The number of collection entries to skip.
+ * @param aSkip The number of collection items to skip.
+ * @param aStart The reference to the first node. All nodes before are skipped.
* @return Iterator
*/
virtual Iterator_t getIterator(
- const xs_integer& aSkip = xs_integer::zero()) = 0;
+ const xs_integer& aSkip = xs_integer::zero(),
+ const zstring& aStart = "") = 0;
/**
* Get the node at the given position in the collection.
=== modified file 'src/store/api/iterator.h'
--- src/store/api/iterator.h 2012-08-30 13:45:43 +0000
+++ src/store/api/iterator.h 2012-09-04 07:00:27 +0000
@@ -171,7 +171,8 @@
public:
virtual ~IndexProbeIterator() { }
- virtual void init(const IndexCondition_t& cond) = 0;
+ virtual void init(const IndexCondition_t& cond,
+ const xs_integer& aSkip = xs_integer::zero()) = 0;
virtual void open() = 0;
=== modified file 'src/store/naive/collection.h'
--- src/store/naive/collection.h 2012-08-30 13:45:43 +0000
+++ src/store/naive/collection.h 2012-09-04 07:00:27 +0000
@@ -54,7 +54,9 @@
zorba::xs_integer size() const = 0;
- zorba::store::Iterator_t getIterator(const xs_integer& aSkip) = 0;
+ zorba::store::Iterator_t getIterator(
+ const xs_integer& aSkip,
+ const zstring& aStart) = 0;
virtual zorba::store::Item_t nodeAt(xs_integer position) = 0;
=== modified file 'src/store/naive/simple_collection.cpp'
--- src/store/naive/simple_collection.cpp 2012-08-30 13:45:43 +0000
+++ src/store/naive/simple_collection.cpp 2012-09-04 07:00:27 +0000
@@ -81,9 +81,22 @@
Note: it is allowed to have several concurrent iterators on the same collection
but each iterator should be used by a single thread only.
********************************************************************************/
-store::Iterator_t SimpleCollection::getIterator(const xs_integer& aSkip)
+store::Iterator_t SimpleCollection::getIterator(const xs_integer& aSkip,
+ const zstring& aStart)
{
- return new CollectionIter(this, aSkip);
+ store::Item_t lReferencedNode;
+ xs_integer lReferencedPosition = xs_integer::zero();
+ if (aStart.size() != 0
+ && (!GET_STORE().getNodeByReference(lReferencedNode, aStart)
+ || !findNode(lReferencedNode.getp(), lReferencedPosition)))
+ {
+ throw ZORBA_EXCEPTION(zerr::ZSTR0066_REFERENCED_NODE_NOT_IN_COLLECTION,
+ ERROR_PARAMS(aStart, theName->getStringValue()));
+ }
+
+ return new CollectionIter(
+ this,
+ aSkip + lReferencedPosition);
}
@@ -596,6 +609,21 @@
theCollection->theLatch.unlock();)
}
+void SimpleCollection::CollectionIter::skip()
+{
+ // skip by position
+ long lToSkip = to_xs_long(theSkip);
+ if (theSkip >= theCollection->size())
+ {
+ // we need to skip more then possible -> jump to the end
+ theIterator = theEnd;
+ }
+ else
+ {
+ theIterator += to_xs_long(theSkip);
+ }
+}
+
/*******************************************************************************
@@ -606,8 +634,8 @@
theHaveLock = true;
theIterator = theCollection->theXmlTrees.begin();
- theIterator += to_xs_long(theSkip);
theEnd = theCollection->theXmlTrees.end();
+ skip();
}
@@ -641,8 +669,8 @@
void SimpleCollection::CollectionIter::reset()
{
theIterator = theCollection->theXmlTrees.begin();
- theIterator += to_xs_long(theSkip);
theEnd = theCollection->theXmlTrees.end();
+ skip();
}
=== modified file 'src/store/naive/simple_collection.h'
--- src/store/naive/simple_collection.h 2012-08-30 13:45:43 +0000
+++ src/store/naive/simple_collection.h 2012-09-04 07:00:27 +0000
@@ -57,7 +57,8 @@
xs_integer theSkip;
public:
- CollectionIter(SimpleCollection* collection, const xs_integer& aSkip);
+ CollectionIter(SimpleCollection* collection,
+ const xs_integer& aSkip);
~CollectionIter();
@@ -65,6 +66,8 @@
bool next(store::Item_t& result);
void reset();
void close();
+ private:
+ void skip();
};
@@ -110,7 +113,8 @@
TreeId createTreeId();
- store::Iterator_t getIterator(const xs_integer& aSkip);
+ store::Iterator_t getIterator(const xs_integer& aSkip,
+ const zstring& aStart);
void addNode(store::Item* node, xs_integer position = xs_integer(-1));
=== modified file 'src/store/naive/simple_index_general.cpp'
--- src/store/naive/simple_index_general.cpp 2012-08-30 13:45:43 +0000
+++ src/store/naive/simple_index_general.cpp 2012-09-04 07:00:27 +0000
@@ -1668,7 +1668,8 @@
/*******************************************************************************
********************************************************************************/
-void ProbeGeneralIndexIterator::init(const store::IndexCondition_t& cond)
+void ProbeGeneralIndexIterator::init(const store::IndexCondition_t& cond,
+ const xs_integer& aSkip)
{
theProbeKind = cond->getKind();
theCondition = static_cast<GeneralIndexCondition*>(cond.getp());
=== modified file 'src/store/naive/simple_index_general.h'
--- src/store/naive/simple_index_general.h 2012-08-30 13:45:43 +0000
+++ src/store/naive/simple_index_general.h 2012-09-04 07:00:27 +0000
@@ -460,7 +460,7 @@
bool haveUpper) const;
public:
- void init(const store::IndexCondition_t& cond);
+ void init(const store::IndexCondition_t& cond, const xs_integer& aSkip);
void open();
=== modified file 'src/store/naive/simple_index_value.cpp'
--- src/store/naive/simple_index_value.cpp 2012-08-30 13:45:43 +0000
+++ src/store/naive/simple_index_value.cpp 2012-09-04 07:00:27 +0000
@@ -471,8 +471,11 @@
/******************************************************************************
********************************************************************************/
-void ProbeValueHashIndexIterator::init(const store::IndexCondition_t& cond)
+void ProbeValueHashIndexIterator::init(const store::IndexCondition_t& cond,
+ const xs_integer& aSkip)
{
+ theSkip = aSkip;
+
theCondition = reinterpret_cast<IndexPointCondition*>(cond.getp());
store::IndexKey* key = &(theCondition->theKey);
@@ -495,7 +498,17 @@
void ProbeValueHashIndexIterator::open()
{
if (theResultSet)
+ {
theIte = theResultSet->begin();
+ if (theSkip >= theResultSet->size())
+ {
+ theIte = theEnd;
+ }
+ else
+ {
+ theIte += to_xs_long(theSkip);
+ }
+ }
}
@@ -780,8 +793,11 @@
/******************************************************************************
********************************************************************************/
-void ProbeValueTreeIndexIterator::init(const store::IndexCondition_t& cond)
+void ProbeValueTreeIndexIterator::init(const store::IndexCondition_t& cond,
+ const xs_integer& aSkip)
{
+ theSkip = aSkip;
+
if (cond->getKind() != store::IndexCondition::BOX_VALUE &&
cond->getKind() != store::IndexCondition::POINT_VALUE)
{
@@ -967,6 +983,15 @@
theResultSet = theMapBegin->second;
theIte = theResultSet->begin();
theEnd = theResultSet->end();
+
+ if (theSkip > theResultSet->size())
+ {
+ theIte = theEnd;
+ }
+ else
+ {
+ theIte += to_xs_long(theSkip);
+ }
}
}
=== modified file 'src/store/naive/simple_index_value.h'
--- src/store/naive/simple_index_value.h 2012-08-30 13:45:43 +0000
+++ src/store/naive/simple_index_value.h 2012-09-04 07:00:27 +0000
@@ -171,6 +171,7 @@
ValueIndexValue * theResultSet;
ValueIndexValue::const_iterator theIte;
ValueIndexValue::const_iterator theEnd;
+ xs_integer theSkip;
public:
ProbeValueHashIndexIterator(const store::Index_t& index) : theResultSet(NULL)
@@ -178,7 +179,7 @@
theIndex = static_cast<ValueHashIndex*>(index.getp());
}
- void init(const store::IndexCondition_t& cond);
+ void init(const store::IndexCondition_t& cond, const xs_integer& aSkip);
void open();
@@ -273,6 +274,8 @@
ValueIndexValue::const_iterator theIte;
ValueIndexValue::const_iterator theEnd;
+ xs_integer theSkip;
+
protected:
void initExact();
@@ -287,7 +290,7 @@
theIndex = reinterpret_cast<ValueTreeIndex*>(index.getp());
}
- void init(const store::IndexCondition_t& cond);
+ void init(const store::IndexCondition_t& cond, const xs_integer& aSkip);
void open();
=== modified file 'test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res 2012-06-28 18:19:34 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/paging_1.xml.res 2012-09-04 07:00:27 +0000
@@ -1,1 +1,1 @@
-<d/><e/><a/><b/><c/><d/><e/>
+<d/><e/><delim/><a/><b/><c/><d/><e/><delim/><c/><d/><e/>
=== modified file 'test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res 2012-06-28 18:19:34 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/paging_2.xml.res 2012-09-04 07:00:27 +0000
@@ -1,1 +1,1 @@
-2 5 0
+2 5 0 3
=== modified file 'test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res 2012-06-28 18:19:34 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/paging_3.xml.res 2012-09-04 07:00:27 +0000
@@ -1,1 +1,1 @@
-<d/><e/><a/><b/><c/><d/><e/>
+<d/><e/><delim/><a/><b/><c/><d/><e/><delim/><c/><d/><e/>
=== modified file 'test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res'
--- test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res 2012-06-28 18:19:34 +0000
+++ test/rbkt/ExpQueryResults/zorba/collections/paging_4.xml.res 2012-09-04 07:00:27 +0000
@@ -1,1 +1,1 @@
-2 5 0
+2 5 0 3
=== modified file 'test/rbkt/Queries/zorba/collections/paging_1.xq'
--- test/rbkt/Queries/zorba/collections/paging_1.xq 2012-06-28 18:19:34 +0000
+++ test/rbkt/Queries/zorba/collections/paging_1.xq 2012-09-04 07:00:27 +0000
@@ -1,6 +1,7 @@
import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
import module namespace ns = "http://example.org/datamodule/" at "collections.xqdata";
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";
declare namespace ann = "http://www.zorba-xquery.com/annotations";
@@ -11,8 +12,10 @@
dml:insert-nodes(xs:QName("ns:test2"), <b/>);
dml:insert-nodes(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
(
- dml:collection(xs:QName("ns:test2"), 3),
- dml:collection(xs:QName("ns:test2"), -1)
+ dml:collection(xs:QName("ns:test2"), 3), <delim/>,
+ dml:collection(xs:QName("ns:test2"), -1), <delim/>,
+ let $ref := ref:node-reference(dml:collection(xs:QName("ns:test2"))[3])
+ return dml:collection(xs:QName("ns:test2"), $ref, 0)
)
};
=== modified file 'test/rbkt/Queries/zorba/collections/paging_2.xq'
--- test/rbkt/Queries/zorba/collections/paging_2.xq 2012-06-28 18:19:34 +0000
+++ test/rbkt/Queries/zorba/collections/paging_2.xq 2012-09-04 07:00:27 +0000
@@ -1,6 +1,7 @@
import module namespace ddl = "http://www.zorba-xquery.com/modules/store/static/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";
import module namespace ns = "http://example.org/datamodule/" at "collections.xqdata";
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";
declare namespace ann = "http://www.zorba-xquery.com/annotations";
@@ -13,7 +14,9 @@
(
fn:count(dml:collection(xs:QName("ns:test2"), 3)),
fn:count(dml:collection(xs:QName("ns:test2"), -1)),
- fn:count(dml:collection(xs:QName("ns:test2"), 100))
+ fn:count(dml:collection(xs:QName("ns:test2"), 100)),
+ let $ref := ref:node-reference(dml:collection(xs:QName("ns:test2"))[3])
+ return fn:count(dml:collection(xs:QName("ns:test2"), $ref, 0))
)
};
=== modified file 'test/rbkt/Queries/zorba/collections/paging_3.xq'
--- test/rbkt/Queries/zorba/collections/paging_3.xq 2012-06-28 18:19:34 +0000
+++ test/rbkt/Queries/zorba/collections/paging_3.xq 2012-09-04 07:00:27 +0000
@@ -1,5 +1,6 @@
import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";
declare namespace ann = "http://www.zorba-xquery.com/annotations";
declare namespace ns = "http://www.zorba-xquery.com/test";
@@ -11,8 +12,10 @@
dml:insert-nodes-last(xs:QName("ns:test2"), <b/>);
dml:insert-nodes-last(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
(
- dml:collection(xs:QName("ns:test2"), 3),
- dml:collection(xs:QName("ns:test2"), -1)
+ dml:collection(xs:QName("ns:test2"), 3), <delim/>,
+ dml:collection(xs:QName("ns:test2"), -1), <delim/>,
+ let $ref := ref:node-reference(dml:collection(xs:QName("ns:test2"))[3])
+ return dml:collection(xs:QName("ns:test2"), $ref, 0)
)
};
=== modified file 'test/rbkt/Queries/zorba/collections/paging_4.xq'
--- test/rbkt/Queries/zorba/collections/paging_4.xq 2012-06-28 18:19:34 +0000
+++ test/rbkt/Queries/zorba/collections/paging_4.xq 2012-09-04 07:00:27 +0000
@@ -1,5 +1,6 @@
import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";
declare namespace ann = "http://www.zorba-xquery.com/annotations";
declare namespace ns = "http://www.zorba-xquery.com/test";
@@ -13,7 +14,9 @@
(
fn:count(dml:collection(xs:QName("ns:test2"), 3)),
fn:count(dml:collection(xs:QName("ns:test2"), -1)),
- fn:count(dml:collection(xs:QName("ns:test2"), 100))
+ fn:count(dml:collection(xs:QName("ns:test2"), 100)),
+ let $ref := ref:node-reference(dml:collection(xs:QName("ns:test2"))[3])
+ return fn:count(dml:collection(xs:QName("ns:test2"), $ref, 0))
)
};
=== added file 'test/rbkt/Queries/zorba/collections/paging_5.spec'
--- test/rbkt/Queries/zorba/collections/paging_5.spec 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/paging_5.spec 2012-09-04 07:00:27 +0000
@@ -0,0 +1,1 @@
+Error: http://www.zorba-xquery.com/errors:ZSTR0066
=== added file 'test/rbkt/Queries/zorba/collections/paging_5.xq'
--- test/rbkt/Queries/zorba/collections/paging_5.xq 1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/collections/paging_5.xq 2012-09-04 07:00:27 +0000
@@ -0,0 +1,22 @@
+import module namespace ddl = "http://www.zorba-xquery.com/modules/store/dynamic/collections/ddl";
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/dynamic/collections/dml";
+import module namespace ref = "http://www.zorba-xquery.com/modules/node-reference";
+
+declare namespace ann = "http://www.zorba-xquery.com/annotations";
+declare namespace ns = "http://www.zorba-xquery.com/test";
+
+declare %ann:sequential function local:test()
+{
+ ddl:create(xs:QName("ns:test2"));
+ dml:insert-nodes-last(xs:QName("ns:test2"), <a/>);
+ dml:insert-nodes-last(xs:QName("ns:test2"), <b/>);
+ dml:insert-nodes-last(xs:QName("ns:test2"), (<c/>, <d/>, <e/>));
+
+ dml:collection(
+ xs:QName("ns:test2"),
+ xs:anyURI("urn:uuid:aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa"), 0)
+};
+
+local:test()
+
+
Follow ups
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: noreply, 2012-09-18
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Zorba Build Bot, 2012-09-18
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Zorba Build Bot, 2012-09-18
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: David Graf, 2012-09-18
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Zorba Build Bot, 2012-09-18
-
Re: [Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Zorba Build Bot, 2012-09-18
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Zorba Build Bot, 2012-09-18
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: David Graf, 2012-09-18
-
Re: [Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Matthias Brantner, 2012-09-18
-
Re: [Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Matthias Brantner, 2012-09-14
-
Re: [Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: Matthias Brantner, 2012-09-13
-
Re: [Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: David Graf, 2012-09-10
-
[Merge] lp:~davidagraf/zorba/paging_index_probe into lp:zorba
From: David Graf, 2012-09-04