couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jch...@apache.org
Subject svn commit: r983336 - in /couchdb/trunk: THANKS share/www/script/test/view_update_seq.js src/couchdb/couch_httpd_db.erl src/couchdb/couch_httpd_view.erl
Date Sun, 08 Aug 2010 02:23:53 GMT
Author: jchris
Date: Sun Aug  8 02:23:53 2010
New Revision: 983336

URL: http://svn.apache.org/viewvc?rev=983336&view=rev
Log:
provide the update_seq in all_docs view even when it is zero

Modified:
    couchdb/trunk/THANKS
    couchdb/trunk/share/www/script/test/view_update_seq.js
    couchdb/trunk/src/couchdb/couch_httpd_db.erl
    couchdb/trunk/src/couchdb/couch_httpd_view.erl

Modified: couchdb/trunk/THANKS
URL: http://svn.apache.org/viewvc/couchdb/trunk/THANKS?rev=983336&r1=983335&r2=983336&view=diff
==============================================================================
--- couchdb/trunk/THANKS (original)
+++ couchdb/trunk/THANKS Sun Aug  8 02:23:53 2010
@@ -67,5 +67,6 @@ suggesting improvements or submitting ch
  * Jonathan D. Knezek <jdknezek@gmail.com>
  * David Rose <doppler@gmail.com>
  * Lim Yue Chuan <shasderias@gmail.com>
+ * David Davis <xantus@xantus.org>
 
 For a list of authors see the `AUTHORS` file.

Modified: couchdb/trunk/share/www/script/test/view_update_seq.js
URL: http://svn.apache.org/viewvc/couchdb/trunk/share/www/script/test/view_update_seq.js?rev=983336&r1=983335&r2=983336&view=diff
==============================================================================
--- couchdb/trunk/share/www/script/test/view_update_seq.js (original)
+++ couchdb/trunk/share/www/script/test/view_update_seq.js Sun Aug  8 02:23:53 2010
@@ -18,6 +18,11 @@ couchTests.view_update_seq = function(de
 
   T(db.info().update_seq == 0);
 
+  resp = db.allDocs({update_seq:true});
+
+  T(resp.rows.length == 0);
+  T(resp.update_seq == 0);
+
   var designDoc = {
     _id:"_design/test",
     language: "javascript",
@@ -35,7 +40,7 @@ couchTests.view_update_seq = function(de
 
   T(db.info().update_seq == 1);
 
-  var resp = db.allDocs({update_seq:true});
+  resp = db.allDocs({update_seq:true});
 
   T(resp.rows.length == 1);
   T(resp.update_seq == 1);

Modified: couchdb/trunk/src/couchdb/couch_httpd_db.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_db.erl?rev=983336&r1=983335&r2=983336&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_db.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_db.erl Sun Aug  8 02:23:53 2010
@@ -486,7 +486,13 @@ all_docs_view(Req, Db, Keys) ->
         true -> EndDocId
         end,
         FoldAccInit = {Limit, SkipCount, undefined, []},
-		UpdateSeq = couch_db:get_update_seq(Db),
+        UpdateSeq = couch_db:get_update_seq(Db),
+        JsonParams = case couch_httpd:qs_value(Req, "update_seq") of
+        "true" ->
+            [{update_seq, UpdateSeq}];
+        _Else ->
+            []
+        end,
         case Keys of
         nil ->
             FoldlFun = couch_httpd_view:make_view_fold_fun(Req, QueryArgs, CurrentEtag, Db,
UpdateSeq,
@@ -504,7 +510,7 @@ all_docs_view(Req, Db, Keys) ->
             {ok, LastOffset, FoldResult} = couch_db:enum_docs(Db,
                 AdapterFun, FoldAccInit, [{start_key, StartId}, {dir, Dir},
                     {if Inclusive -> end_key; true -> end_key_gt end, EndId}]),
-            couch_httpd_view:finish_view_fold(Req, TotalRowCount, LastOffset, FoldResult);
+            couch_httpd_view:finish_view_fold(Req, TotalRowCount, LastOffset, FoldResult,
JsonParams);
         _ ->
             FoldlFun = couch_httpd_view:make_view_fold_fun(Req, QueryArgs, CurrentEtag, Db,
UpdateSeq,
                 TotalRowCount, #view_fold_helper_funs{
@@ -533,7 +539,7 @@ all_docs_view(Req, Db, Keys) ->
                     {_, FoldAcc2} = FoldlFun(Doc, 0, FoldAcc),
                     FoldAcc2
                 end, FoldAccInit, Keys),
-            couch_httpd_view:finish_view_fold(Req, TotalRowCount, 0, FoldResult)
+            couch_httpd_view:finish_view_fold(Req, TotalRowCount, 0, FoldResult, JsonParams)
         end
     end).
 

Modified: couchdb/trunk/src/couchdb/couch_httpd_view.erl
URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_httpd_view.erl?rev=983336&r1=983335&r2=983336&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_httpd_view.erl (original)
+++ couchdb/trunk/src/couchdb/couch_httpd_view.erl Sun Aug  8 02:23:53 2010
@@ -16,7 +16,7 @@
 -export([handle_view_req/3,handle_temp_view_req/2]).
 
 -export([parse_view_params/3]).
--export([make_view_fold_fun/7, finish_view_fold/4, view_row_obj/3]).
+-export([make_view_fold_fun/7, finish_view_fold/4, finish_view_fold/5, view_row_obj/3]).
 -export([view_group_etag/2, view_group_etag/3, make_reduce_fold_funs/6]).
 -export([design_doc_view/5, parse_bool_param/1, doc_member/2]).
 -export([make_key_options/1, load_view/4]).



Mime
View raw message