Juan Zacarias has proposed merging 
lp:~zorba-coders/zorba/couchbase-view-changes into lp:zorba/couchbase-module.

Commit message:
Changed the return type of the view function from xs:string to object()

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Chris Hillery (ceejatec)

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/couchbase-view-changes/+merge/141968

Changed the return type of the view function from xs:string to object()
-- 
https://code.launchpad.net/~zorba-coders/zorba/couchbase-view-changes/+merge/141968
Your team Zorba Coders is subscribed to branch lp:zorba/couchbase-module.
=== modified file 'examples/example.xq'
--- examples/example.xq	2012-11-07 17:08:47 +0000
+++ examples/example.xq	2013-01-04 19:28:23 +0000
@@ -7,7 +7,7 @@
   "password" : null,
   "bucket" : "default"});
 variable $view-name := cb:create-view($instance, "zip", "zip", {"key" : "doc.state", "values" : "doc.pop"});
-variable $data := jn:parse-json(cb:view($instance, $view-name))("rows");
+variable $data := cb:view($instance, $view-name)("rows");
 for $d in jn:members($data)
 let $state := $d("key")
 group by $state

=== modified file 'examples/example2.xq'
--- examples/example2.xq	2012-11-07 17:08:47 +0000
+++ examples/example2.xq	2013-01-04 19:28:23 +0000
@@ -8,7 +8,7 @@
   "bucket" : "default"});
 
 variable $view-name := cb:create-view($instance, "zip", "zip", {"key" : "doc.state", "values" : "doc.pop"});
-variable $data := jn:parse-json(cb:view($instance, $view-name))("rows");
+variable $data := cb:view($instance, $view-name)("rows");
 for $d in jn:members($data)
 let $state := $d("key")
 group by $state

=== modified file 'examples/example3.xq'
--- examples/example3.xq	2012-11-07 17:08:47 +0000
+++ examples/example3.xq	2013-01-04 19:28:23 +0000
@@ -8,7 +8,7 @@
   "bucket" : "default"});
 
 variable $view-name := cb:create-view($instance, "zip", "zip", {"key" : "doc.state", "values" : "doc.pop"});
-variable $data := jn:parse-json(cb:view($instance, $view-name))("rows");
+variable $data := cb:view($instance, $view-name)("rows");
 for $d in jn:members($data)
 let $state := $d("key")
 group by $state

=== modified file 'examples/example4.xq'
--- examples/example4.xq	2012-11-07 19:33:40 +0000
+++ examples/example4.xq	2013-01-04 19:28:23 +0000
@@ -8,7 +8,7 @@
   "bucket" : "default"});
 
 variable $view-name := cb:create-view($instance, "zip", "zip", {"key" : "doc.state", "values" : ["doc.pop", "doc.city"]});
-variable $data := jn:parse-json(cb:view($instance, $view-name))("rows");
+variable $data := cb:view($instance, $view-name)("rows");
 
 
 let $city-pop :=

=== modified file 'src/couchbase.xq'
--- src/couchbase.xq	2012-12-23 09:46:07 +0000
+++ src/couchbase.xq	2013-01-04 19:28:23 +0000
@@ -346,8 +346,14 @@
  :
  : @return a sequence of strings (as JSON) containing information of the views.
  :)
+declare %fn:private %an:sequential function cb:view-text($db as xs:anyURI, $path as xs:string*)
+  as xs:string* external;
+
 declare %an:sequential function cb:view($db as xs:anyURI, $path as xs:string*)
-  as xs:string* external;
+  as object()*
+{
+  jn:parse-json(cb:view-text($db, $path))
+};
 
 (:~
  : Retrieve the content of existing views.
@@ -366,11 +372,20 @@
  :
  : @return a sequence of strings (as JSON) containing information of the views.
  :)
+declare %fn:private %an:sequential function cb:view-text(
+  $db as xs:anyURI,
+  $path as xs:string*,
+  $options as object())
+as xs:string* external; 
+
 declare %an:sequential function cb:view(
   $db as xs:anyURI,
   $path as xs:string*,
   $options as object())
-as xs:string* external; 
+as object()*
+{
+  jn:parse-json(cb:view-text($db, $path, $options))
+};
 
 (:~
  : Create a document/view.

=== modified file 'src/couchbase.xq.src/couchbase.cpp'
--- src/couchbase.xq.src/couchbase.cpp	2012-12-18 09:15:12 +0000
+++ src/couchbase.xq.src/couchbase.cpp	2013-01-04 19:28:23 +0000
@@ -85,7 +85,7 @@
     {
       lFunc = new TouchFunction(this);
     }
-    else if (localname == "view")
+    else if (localname == "view-text")
     {
       lFunc = new ViewFunction(this);
     }

=== modified file 'src/couchbase.xq.src/couchbase.h'
--- src/couchbase.xq.src/couchbase.h	2012-11-06 19:59:19 +0000
+++ src/couchbase.xq.src/couchbase.h	2013-01-04 19:28:23 +0000
@@ -552,7 +552,7 @@
     virtual ~ViewFunction(){}
 
     virtual zorba::String
-      getLocalName() const { return "view"; }
+      getLocalName() const { return "view-text"; }
 
     virtual zorba::ItemSequence_t
       evaluate( const Arguments_t&,

=== modified file 'test/Queries/couchbase_module/connect2.xq'
--- test/Queries/couchbase_module/connect2.xq	2012-10-19 21:11:28 +0000
+++ test/Queries/couchbase_module/connect2.xq	2013-01-04 19:28:23 +0000
@@ -1,7 +1,7 @@
 import module namespace cb = "http://www.zorba-xquery.com/modules/couchbase";;
 
 variable $instance := cb:connect({
-  "host": "none",
+  "host": "12492873009",
   "username" : null,
   "password" : null,
   "bucket" : "default"});

=== modified file 'test/Queries/couchbase_module/view.xq'
--- test/Queries/couchbase_module/view.xq	2012-11-07 17:08:47 +0000
+++ test/Queries/couchbase_module/view.xq	2013-01-04 19:28:23 +0000
@@ -10,8 +10,8 @@
 
 variable $view-name := cb:create-view($instance, "test-view", "test", {"key":"doc.view"});
 
-variable $data := jn:parse-json(cb:view($instance, $view-name))("rows");
+variable $data := cb:view($instance, $view-name)("rows");
 for $d in jn:members($data)
-where $d("key") > 0
+where $d("key") >0
 return $d
 

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