summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_httpd_show.erl
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-03-09 19:09:11 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-03-09 19:09:11 +0000
commit772fdde2eb970177438038a2479ec13385372cf5 (patch)
treef193e46bb51a99a533bdb13506c8e5fe248f0103 /src/couchdb/couch_httpd_show.erl
parent0d09aa9f79680be83e9893882bded0f4d8ba8b8d (diff)
Merged revision 1079939 from trunk
Parameter "include_docs" now honors parameter "conflicts" When querying a map view, /db/_all_docs/ or /db/_changes/ with "include_docs=true", if "conflicts=true" is given as well, the documents will contain the conflicts list (if there are conflicting revisions). Closes COUCHDB-549. git-svn-id: https://svn.apache.org/repos/asf/couchdb/branches/1.1.x@1079941 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd_show.erl')
-rw-r--r--src/couchdb/couch_httpd_show.erl19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/couchdb/couch_httpd_show.erl b/src/couchdb/couch_httpd_show.erl
index 70dd82e1..59f74e1c 100644
--- a/src/couchdb/couch_httpd_show.erl
+++ b/src/couchdb/couch_httpd_show.erl
@@ -309,18 +309,20 @@ start_list_resp(QServer, LName, Req, Db, Head, Etag) ->
{ok, Resp, ?b2l(?l2b(Chunks))}.
make_map_send_row_fun(QueryServer) ->
- fun(Resp, Db, Row, IncludeDocs, RowFront) ->
- send_list_row(Resp, QueryServer, Db, Row, RowFront, IncludeDocs)
+ fun(Resp, Db, Row, IncludeDocs, Conflicts, RowFront) ->
+ send_list_row(
+ Resp, QueryServer, Db, Row, RowFront, IncludeDocs, Conflicts)
end.
make_reduce_send_row_fun(QueryServer, Db) ->
fun(Resp, Row, RowFront) ->
- send_list_row(Resp, QueryServer, Db, Row, RowFront, false)
+ send_list_row(Resp, QueryServer, Db, Row, RowFront, false, false)
end.
-send_list_row(Resp, QueryServer, Db, Row, RowFront, IncludeDoc) ->
+send_list_row(Resp, QueryServer, Db, Row, RowFront, IncludeDoc, Conflicts) ->
try
- [Go,Chunks] = prompt_list_row(QueryServer, Db, Row, IncludeDoc),
+ [Go,Chunks] = prompt_list_row(
+ QueryServer, Db, Row, IncludeDoc, Conflicts),
Chunk = RowFront ++ ?b2l(?l2b(Chunks)),
send_non_empty_chunk(Resp, Chunk),
case Go of
@@ -336,11 +338,12 @@ send_list_row(Resp, QueryServer, Db, Row, RowFront, IncludeDoc) ->
end.
-prompt_list_row({Proc, _DDocId}, Db, {{Key, DocId}, Value}, IncludeDoc) ->
- JsonRow = couch_httpd_view:view_row_obj(Db, {{Key, DocId}, Value}, IncludeDoc),
+prompt_list_row({Proc, _DDocId}, Db, {{_Key, _DocId}, _} = Kv,
+ IncludeDoc, Conflicts) ->
+ JsonRow = couch_httpd_view:view_row_obj(Db, Kv, IncludeDoc, Conflicts),
couch_query_servers:proc_prompt(Proc, [<<"list_row">>, JsonRow]);
-prompt_list_row({Proc, _DDocId}, _, {Key, Value}, _IncludeDoc) ->
+prompt_list_row({Proc, _DDocId}, _, {Key, Value}, _IncludeDoc, _Conflicts) ->
JsonRow = {[{key, Key}, {value, Value}]},
couch_query_servers:proc_prompt(Proc, [<<"list_row">>, JsonRow]).