Markos Zaharioudakis has proposed merging lp:~zorba-coders/zorba/markos-scratch 
into lp:zorba.

Commit message:
added dynamic_function_invocation_expr to the exprs handled by 
expr_tools::match_exact()

Requested reviews:
  Markos Zaharioudakis (markos-za)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/161292

added dynamic_function_invocation_expr to the exprs handled by 
expr_tools::match_exact()
-- 
https://code.launchpad.net/~zorba-coders/zorba/markos-scratch/+merge/161292
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/expression/function_item_expr.h'
--- src/compiler/expression/function_item_expr.h	2013-04-24 01:35:58 +0000
+++ src/compiler/expression/function_item_expr.h	2013-04-27 16:45:32 +0000
@@ -95,7 +95,7 @@
       const std::vector<expr*>& args);
 
 public:
-  const expr* get_function() const { return theExpr; }
+  expr* get_function() const { return theExpr; }
 
   const std::vector<expr*>& get_args() const { return theArgs; }
   

=== modified file 'src/compiler/rewriter/tools/expr_tools.cpp'
--- src/compiler/rewriter/tools/expr_tools.cpp	2013-02-28 11:15:32 +0000
+++ src/compiler/rewriter/tools/expr_tools.cpp	2013-04-27 16:45:32 +0000
@@ -22,6 +22,7 @@
 #include "compiler/expression/script_exprs.h"
 #include "compiler/expression/ft_expr.h"
 #include "compiler/expression/ftnode.h"
+#include "compiler/expression/function_item_expr.h"
 #include "compiler/expression/expr_iter.h"
 #include "compiler/api/compilercb.h"
 
@@ -368,6 +369,33 @@
     return true;
   }
 
+  case dynamic_function_invocation_expr_kind:
+  {
+    const dynamic_function_invocation_expr* qe =
+    static_cast<const dynamic_function_invocation_expr*>(query);
+
+    const dynamic_function_invocation_expr* ve =
+    static_cast<const dynamic_function_invocation_expr*>(view);
+
+    if (!match_exact(qe->get_function(), ve->get_function(), subst))
+      return false;
+
+    if (qe->get_args().size() != ve->get_args().size())
+      return false;
+
+    std::vector<expr*>::const_iterator qite = qe->get_args().begin();
+    std::vector<expr*>::const_iterator qend = qe->get_args().end();
+    std::vector<expr*>::const_iterator vite = ve->get_args().begin();
+
+    for (; qite != qend; ++qite, ++vite)
+    { 
+      if (!match_exact(*qite, *vite, subst))
+        return false;
+    }
+
+    return true;
+  }
+
   case relpath_expr_kind:
   {
     relpath_expr* qe = static_cast<relpath_expr*>(query);

=== added file 'test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter'
--- test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter	1970-01-01 00:00:00 +0000
+++ test/rbkt/ExpCompilerResults/IterPlan/zorba/index/match_vrange_04.iter	2013-04-27 16:45:32 +0000
@@ -0,0 +1,52 @@
+Iterator tree for index:
+<flwor::FLWORIterator>
+  <ForVariable name="$$context-item">
+    <ZorbaCollectionIterator>
+      <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo)"/>
+    </ZorbaCollectionIterator>
+  </ForVariable>
+  <ReturnClause>
+    <ValueIndexEntryBuilderIterator>
+      <ForVarIterator varname="$$context-item"/>
+      <PromoteIterator type="xs:string">
+        <FnDataIterator>
+          <DynamicFnCallIterator>
+            <ForVarIterator varname="$$context-item"/>
+            <SingletonIterator value="xs:string(_id)"/>
+          </DynamicFnCallIterator>
+        </FnDataIterator>
+      </PromoteIterator>
+    </ValueIndexEntryBuilderIterator>
+  </ReturnClause>
+</flwor::FLWORIterator>
+
+Iterator tree for main query:
+<SequentialIterator>
+  <ApplyIterator>
+    <ZorbaCreateCollectionIterator>
+      <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo)"/>
+    </ZorbaCreateCollectionIterator>
+  </ApplyIterator>
+  <ApplyIterator>
+    <CreateIndexIterator>
+      <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo__id_)"/>
+    </CreateIndexIterator>
+  </ApplyIterator>
+  <flwor::FLWORIterator>
+    <ForVariable name="i">
+      <ProbeIndexRangeValueIterator>
+        <SingletonIterator value="xs:QName(http://28.io/collections,db28,foo__id_)"/>
+        <SingletonIterator value="xs:string(3)"/>
+        <SingletonIterator value="xs:string(3)"/>
+        <SingletonIterator value="xs:boolean(true)"/>
+        <SingletonIterator value="xs:boolean(true)"/>
+        <SingletonIterator value="xs:boolean(true)"/>
+        <SingletonIterator value="xs:boolean(true)"/>
+      </ProbeIndexRangeValueIterator>
+    </ForVariable>
+    <ReturnClause>
+      <ForVarIterator varname="i"/>
+    </ReturnClause>
+  </flwor::FLWORIterator>
+</SequentialIterator>
+

=== added file 'test/rbkt/ExpQueryResults/zorba/index/match_vrange_04.xml.res'
=== added file 'test/rbkt/Queries/zorba/index/match_vrange_04.xq'
--- test/rbkt/Queries/zorba/index/match_vrange_04.xq	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/index/match_vrange_04.xq	2013-04-27 16:45:32 +0000
@@ -0,0 +1,20 @@
+
+import module namespace db28 = "http://28.io/collections"; at "match_vrange_04.xqlib";
+
+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 iddl = 
+"http://www.zorba-xquery.com/modules/store/static/indexes/ddl";;
+
+
+ddl:create(xs:QName("db28:foo"));
+
+iddl:create(xs:QName("db28:foo__id_"));
+
+for $i in dml:collection(xs:QName("db28:foo"))
+where $i("_id") eq "3"
+return $i

=== added file 'test/rbkt/Queries/zorba/index/match_vrange_04.xqlib'
--- test/rbkt/Queries/zorba/index/match_vrange_04.xqlib	1970-01-01 00:00:00 +0000
+++ test/rbkt/Queries/zorba/index/match_vrange_04.xqlib	2013-04-27 16:45:32 +0000
@@ -0,0 +1,12 @@
+
+module namespace db28 = "http://28.io/collections";;
+
+import module namespace dml = "http://www.zorba-xquery.com/modules/store/static/collections/dml";;
+
+declare namespace an = "http://www.zorba-xquery.com/annotations";;
+
+declare %an:mutable %an:unordered %an:mutable-nodes collection db28:foo;
+
+declare %an:manual %an:value-range index db28:foo__id_
+on nodes dml:collection(xs:QName("db28:foo"))
+by .("_id") as Q{http://www.w3.org/2001/XMLSchema}string;

-- 
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

Reply via email to