From 15a175144d83d6177e9bbb923a7f7157e5ea8917 Mon Sep 17 00:00:00 2001 From: Christopher Lenz Date: Sun, 31 Aug 2008 09:43:41 +0000 Subject: Merged json_term_changes branch back into trunk. git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@690668 13f79535-47bb-0310-9956-ffa450edef68 --- src/couchdb/couch_db.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/couchdb/couch_db.erl') diff --git a/src/couchdb/couch_db.erl b/src/couchdb/couch_db.erl index e8c7eb93..4bcefdcd 100644 --- a/src/couchdb/couch_db.erl +++ b/src/couchdb/couch_db.erl @@ -228,11 +228,11 @@ update_docs(#db{update_pid=UpdatePid}=Db, Docs, Options) -> Docs2 = lists:map( fun(#doc{id=Id,revs=Revs}=Doc) -> case Id of - ?LOCAL_DOC_PREFIX ++ _ -> - Rev = case Revs of [] -> 0; [Rev0|_] -> list_to_integer(Rev0) end, - Doc#doc{revs=[integer_to_list(Rev + 1)]}; + <> -> + Rev = case Revs of [] -> 0; [Rev0|_] -> list_to_integer(binary_to_list(Rev0)) end, + Doc#doc{revs=[list_to_binary(integer_to_list(Rev + 1))]}; _ -> - Doc#doc{revs=[integer_to_list(couch_util:rand32()) | Revs]} + Doc#doc{revs=[list_to_binary(integer_to_list(couch_util:rand32())) | Revs]} end end, Docs), NewRevs = [NewRev || #doc{revs=[NewRev|_]} <- Docs2], @@ -429,10 +429,10 @@ open_doc_revs_int(Db, IdRevs, Options) -> end, IdRevs, LookupResults). -open_doc_int(Db, ?LOCAL_DOC_PREFIX ++ _ = Id, _Options) -> +open_doc_int(Db, <> = Id, _Options) -> case couch_btree:lookup(Db#db.local_docs_btree, [Id]) of [{ok, {_, {Rev, BodyData}}}] -> - {ok, #doc{id=Id, revs=[integer_to_list(Rev)], body=BodyData}}; + {ok, #doc{id=Id, revs=[list_to_binary(integer_to_list(Rev))], body=BodyData}}; [not_found] -> {not_found, missing} end; -- cgit v1.2.3