Skip to content
This repository has been archived by the owner on Mar 9, 2022. It is now read-only.

Commit

Permalink
incorporated fix for issues noted by Jens here:
Browse files Browse the repository at this point in the history
  • Loading branch information
mschoch committed Mar 28, 2012
1 parent 1b6a963 commit 42b5ee6
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions TouchDB-Android/src/com/couchbase/touchdb/TDDatabase.java
Original file line number Diff line number Diff line change
Expand Up @@ -672,8 +672,11 @@ public TDRevision getDocumentWithIDAndRev(String id, String rev, EnumSet<TDConte
boolean deleted = (cursor.getInt(1) > 0);
result = new TDRevision(id, rev, deleted);
result.setSequence(cursor.getLong(2));
if(!contentOptions.contains(TDContentOptions.TDNoBody)) {
byte[] json = cursor.getBlob(3);
if(!contentOptions.equals(EnumSet.of(TDContentOptions.TDNoBody))) {
byte[] json = null;
if(!contentOptions.contains(TDContentOptions.TDNoBody)) {
json = cursor.getBlob(3);
}
expandStoredJSONIntoRevisionWithAttachments(json, result, contentOptions);
}
}
Expand All @@ -688,8 +691,7 @@ public TDRevision getDocumentWithIDAndRev(String id, String rev, EnumSet<TDConte
}

public boolean existsDocumentWithIDAndRev(String docId, String revId) {
//OPT: Do this without loading the data
return getDocumentWithIDAndRev(docId, revId, EnumSet.noneOf(TDContentOptions.class)) != null;
return getDocumentWithIDAndRev(docId, revId, EnumSet.of(TDContentOptions.TDNoBody)) != null;
}

public TDStatus loadRevisionBody(TDRevision rev, EnumSet<TDContentOptions> contentOptions) {
Expand Down

0 comments on commit 42b5ee6

Please sign in to comment.