Skip to content

Commit

Permalink
Fix for regression caused by #806
Browse files Browse the repository at this point in the history
  • Loading branch information
borrrden committed Jan 26, 2017
1 parent 754e836 commit 88f648a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,5 @@ UnityDemo.sln
tmp/
sync_gateway
staging
AboutResources.txt
AboutAssets.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1057,25 +1057,26 @@ public RevisionInternal GetDocument(string docId, RevisionID revId, bool withBod
if (revId != null) {
sb.Append(" FROM revs WHERE revs.doc_id=? AND revid=? LIMIT 1");
} else {
sb.Append(" FROM revs WHERE revs.doc_id=? and current=1 ORDER BY revid DESC LIMIT 1");
sb.Append(" FROM revs WHERE revs.doc_id=? and current=1 ORDER BY deleted, revid DESC LIMIT 1");
}

var transactionStatus = TryQuery(c =>
{
if(revId == null) {
revId = c.GetString(0).AsRevID();
var revIDToUse = revId;
if(revIDToUse == null) {
revIDToUse = c.GetString(0).AsRevID();
}
bool deleted = c.GetInt(1) != 0;
result = new RevisionInternal(docId, revId, deleted);
result = new RevisionInternal(docId, revIDToUse, deleted);
result.Sequence = c.GetLong(2);
if(withBody) {
result.SetJson(c.GetBlob(3));
} else {
result.Missing = c.GetInt(3) == 0;
}
return false;
return revId == null && deleted;
}, sb.ToString(), docNumericId, revId?.ToString());

if (transactionStatus.IsError) {
Expand Down

0 comments on commit 88f648a

Please sign in to comment.