[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/fnserialize into 
lp:zorba.

Requested reviews:
  Till Westmann (tillw)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503

fn:serialize avoids copying the result but returns a streamable string instead
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-01-20 13:37:12 +
+++ ChangeLog	2012-01-20 22:01:33 +
@@ -23,6 +23,8 @@
   * zerr is not predeclared anymore to be http://www.zorba-xquery.com/errors
   * Add new XQuery interface for the PHP bindings.
   * Added API method Item::getNamespaceBindings().
+  * Added a function to the http://www.zorba-xquery.com/modules/store/static/indexes/dml module which returns
+the value of all keys contained in an index.
 
 version 2.1
 

=== modified file 'doc/zorba/xqddf.dox'
--- doc/zorba/xqddf.dox	2011-10-30 08:04:47 +
+++ doc/zorba/xqddf.dox	2012-01-20 22:01:33 +
@@ -20,6 +20,7 @@
   li \ref index_creation /li
   li \ref index_deletion /li
   li \ref index_probing /li
+  li \ref index_keys /li
   li \ref index_maintenance /li
 /ul
 li \ref integrity_constraints/li
@@ -2027,6 +2028,27 @@
 /li
 /ul
 
+\subsection index_keys Retrieving Index Keys
+In addition to probing an index, the ttidml/tt module also provides a function that allows listing all the keys contained in an index.
+
+\code
+  idml:keys($indexName as xs:QName) as item()*
+\endcode
+
+This function returns a sequence of element nodes.
+Each node in the sequence represents one key contained in the index and has the following structure:
+
+\code
+ key xmlns=http://www.zorba-xquery.com/modules/store/static/indexes/dml;
+   attribute value=key_1/
+   ...
+   attribute value=key_n/
+ /key
+\endcode
+
+The order of the attribute elements reflects the order of the key specifications in the declaration of the index.
+Also, the types of the values of the attributes are the types of the keys as they are declared.
+If a value attribute is not present, this means that the value of the corresponding key in the index is the empty sequence.
 
 \subsection index_maintenance Index Maintenance
 

=== modified file 'modules/com/zorba-xquery/www/modules/store/static/indexes/dml.xq'
--- modules/com/zorba-xquery/www/modules/store/static/indexes/dml.xq	2011-11-01 15:59:24 +
+++ modules/com/zorba-xquery/www/modules/store/static/indexes/dml.xq	2012-01-20 22:01:33 +
@@ -268,3 +268,27 @@
  :)
 declare updating function idml:refresh-index($name as xs:QName) external;
 
+(:~
+ : The keys function returns a sequence of all keys contained in the
+ : index with the given name. Each element has the following structure:
+ :   pre class=brush: xml;
+ :   lt;key xmlns=http://www.zorba-xquery.com/modules/store/static/indexes/dmlgt;
+ : lt;attribute value=key1_value/gt;
+ : lt;attribute value=key2_value/gt;
+ : lt;attribute value=key3_value/gt;
+ :   lt;/keygt;
+ :   /pre
+ :
+ : @param $name The QName of the index
+ : @return The result of the function is sequence of elements each representing
+ : one key contained in the index.
+ : 
+ : Note that the order of the attribute elements reflects the order of
+ : the keys in the index specification. Also note that the values in
+ : these attributes have the type that is declared in the corresponding
+ : index specification. 
+ :
+ : @error zerr:ZDDY0021 if the index with name $name is not declared.
+ : @error zerr:ZDDY0023 if the index with name $name does not exist.
+ :)
+declare function idml:keys($name as xs:QName) as node()* external;

=== modified file 'src/functions/library.cpp'
--- src/functions/library.cpp	2011-10-14 07:35:51 +
+++ src/functions/library.cpp	2012-01-20 22:01:33 +
@@ -41,6 +41,7 @@
 #include functions/func_fnput.h
 #include functions/func_hoist.h
 #include functions/func_index_ddl.h
+#include functions/func_index_func.h
 #include functions/func_ic_ddl.h
 #include functions/func_maths.h
 #include functions/func_nodes.h
@@ -106,6 +107,7 @@
   populate_context_errors_and_diagnostics(sctx);
   populate_context_fnput(sctx);
   populate_context_index_ddl(sctx);
+  populate_context_index_func(sctx);
   populate_context_ic_ddl(sctx);
   populate_context_maths(sctx);
   populate_context_nodes(sctx);

=== added file 'src/functions/pregenerated/func_index_func.cpp'
--- src/functions/pregenerated/func_index_func.cpp	1970-01-01 00:00:00 +
+++ src/functions/pregenerated/func_index_func.cpp	2012-01-20 22:01:33 +
@@ -0,0 +1,63 @@
+/*
+ * 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 

Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Commit Message changed to:

fn:serialize avoids copying the result but returns a streamable string instead

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Description changed to:

fn:serialize avoids copying the result but returns a streamable string instead

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89503
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
Matthias Brantner has proposed merging lp:~zorba-coders/zorba/fnserialize into 
lp:zorba.

Requested reviews:
  Till Westmann (tillw)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504

fn:serialize avoids copying the result but returns a streamable string instead
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp'
--- src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp	2011-08-10 02:50:23 +
+++ src/runtime/parsing_and_serializing/parsing_and_serializing_impl.cpp	2012-01-20 22:06:28 +
@@ -122,12 +122,16 @@
 /***
   14.9.2 fn:serialize
 /
+void
+FnSerializeIterator::streamReleaser(std::istream* s)
+{
+  delete s;
+}
+
 bool
 FnSerializeIterator::nextImpl(store::Item_t aResult, PlanState aPlanState) const
 {
   store::Item_t lParams;
-  std::stringstream lResultStream;
-  zstring lResult;
 
   PlanIteratorState* lState;
   DEFAULT_STACK_INIT(PlanIteratorState, lState, aPlanState);
@@ -254,12 +258,15 @@
   lElemIter-close();
 }
 
-// and now serialize
-lSerializer.serialize(lIterWrapper, lResultStream);
-lResult = lResultStream.str();
+{
+  // and now serialize
+  std::auto_ptrstd::stringstream lResultStream(new std::stringstream());
+  lSerializer.serialize(lIterWrapper, *lResultStream.get());
+  GENV_ITEMFACTORY-createStreamableString(aResult, *lResultStream.release(), FnSerializeIterator::streamReleaser, true);
+}
   }
+  STACK_PUSH(true, lState);
 
-  STACK_PUSH(GENV_ITEMFACTORY-createString(aResult, lResult), lState);
   STACK_END (lState);
 }
 

=== modified file 'src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h'
--- src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h	2011-10-19 15:28:51 +
+++ src/runtime/parsing_and_serializing/pregenerated/parsing_and_serializing.h	2012-01-20 22:06:28 +
@@ -95,6 +95,8 @@
 
   virtual ~FnSerializeIterator();
 
+public:
+  static void streamReleaser(std::istream* stream);
   void accept(PlanIterVisitor v) const;
 
   bool nextImpl(store::Item_t result, PlanState aPlanState) const;

=== modified file 'src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml'
--- src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml	2012-01-11 17:30:25 +
+++ src/runtime/spec/parsing_and_serializing/parsing_and_serializing.xml	2012-01-20 22:06:28 +
@@ -74,6 +74,10 @@
 
 /zorba:function
 
+zorba:method static=true name=streamReleaser return=void
+  zorba:param type=std::istream* name=stream/
+/zorba:method
+
   /zorba:iterator
   
 /zorba:iterators

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Commit Message changed to:

fn:serialize avoids copying the result but returns a streamable string instead

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Zorba Build Bot
Validation queue starting for merge proposal.
Log at: 
http://zorbatest.lambda.nu:8080/remotequeue/fnserialize-2012-01-20T22-20-00.394Z/log.html
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Zorba Build Bot
Validation queue job fnserialize-2012-01-20T22-20-00.394Z is finished. The 
final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Zorba Build Bot
Voting does not meet specified criteria. Required: Approve  1, Disapprove  1. 
Got: 1 Approve, 1 Pending.
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Zorba Build Bot
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Status: Approved = Needs review

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


Re: [Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Till Westmann
Review: Approve


-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Matthias Brantner
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Status: Needs review = Approved

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread Zorba Build Bot
Validation queue job fnserialize-2012-01-20T23-40-03.054Z is finished. The 
final status was:

All tests succeeded!
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp


[Zorba-coders] [Merge] lp:~zorba-coders/zorba/fnserialize into lp:zorba

2012-01-20 Thread noreply
The proposal to merge lp:~zorba-coders/zorba/fnserialize into lp:zorba has been 
updated.

Status: Approved = Merged

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
-- 
https://code.launchpad.net/~zorba-coders/zorba/fnserialize/+merge/89504
Your team Zorba Coders is subscribed to branch lp:zorba.

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp