本文整理汇总了C#中Couchbase.Lite.Internal.RevisionInternal.SetMissing方法的典型用法代码示例。如果您正苦于以下问题:C# RevisionInternal.SetMissing方法的具体用法?C# RevisionInternal.SetMissing怎么用?C# RevisionInternal.SetMissing使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Couchbase.Lite.Internal.RevisionInternal
的用法示例。
在下文中一共展示了RevisionInternal.SetMissing方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetRevisionHistory
/// <summary>Returns an array of TDRevs in reverse chronological order, starting with the given revision.
/// </summary>
/// <remarks>Returns an array of TDRevs in reverse chronological order, starting with the given revision.
/// </remarks>
internal IList<RevisionInternal> GetRevisionHistory(RevisionInternal rev)
{
string docId = rev.GetDocId();
string revId = rev.GetRevId();
Debug.Assert(((docId != null) && (revId != null)));
long docNumericId = GetDocNumericID(docId);
if (docNumericId < 0)
{
return null;
}
else
{
if (docNumericId == 0)
{
return new AList<RevisionInternal>();
}
}
Cursor cursor = null;
IList<RevisionInternal> result;
var args = new [] { Convert.ToString(docNumericId) };
var sql = "SELECT sequence, parent, revid, deleted, json isnull FROM revs WHERE doc_id=? ORDER BY sequence DESC";
try
{
cursor = StorageEngine.RawQuery(sql, args);
cursor.MoveToNext();
long lastSequence = 0;
result = new AList<RevisionInternal>();
while (!cursor.IsAfterLast())
{
var sequence = cursor.GetLong(0);
var parent = cursor.GetLong(1);
bool matches = false;
if (lastSequence == 0)
{
matches = revId.Equals(cursor.GetString(2));
}
else
{
matches = (sequence == lastSequence);
}
if (matches)
{
revId = cursor.GetString(2);
var deleted = (cursor.GetInt(3) > 0);
var missing = (cursor.GetInt(4) > 0);
var aRev = new RevisionInternal(docId, revId, deleted, this);
aRev.SetSequence(sequence);
aRev.SetMissing(missing);
result.AddItem(aRev);
if (parent > -1)
lastSequence = parent;
if (lastSequence == 0)
{
break;
}
}
cursor.MoveToNext();
}
}
catch (SQLException e)
{
Log.E(Tag, "Error getting revision history", e);
return null;
}
finally
{
if (cursor != null)
{
cursor.Close();
}
}
return result;
}
示例2: ExpandStoredJSONIntoRevisionWithAttachments
/// <summary>Inserts the _id, _rev and _attachments properties into the JSON data and stores it in rev.
/// </summary>
/// <remarks>
/// Inserts the _id, _rev and _attachments properties into the JSON data and stores it in rev.
/// Rev must already have its revID and sequence properties set.
/// </remarks>
internal void ExpandStoredJSONIntoRevisionWithAttachments(IEnumerable<Byte> json, RevisionInternal rev, DocumentContentOptions contentOptions)
{
var extra = ExtraPropertiesForRevision(rev, contentOptions);
if (json != null && json.Any())
{
rev.SetJson(AppendDictToJSON(json, extra));
}
else
{
rev.SetProperties(extra);
if (json == null)
{
rev.SetMissing(true);
}
}
}
示例3: GetRevisionHistory
public IList<RevisionInternal> GetRevisionHistory(RevisionInternal rev)
{
string docId = rev.GetDocId();
string revId = rev.GetRevId();
System.Diagnostics.Debug.Assert(((docId != null) && (revId != null)));
long docNumericId = GetDocNumericID(docId);
if (docNumericId < 0)
{
return null;
}
else
{
if (docNumericId == 0)
{
return new AList<RevisionInternal>();
}
}
string sql = "SELECT sequence, parent, revid, deleted, json isnull FROM revs " +
"WHERE doc_id=? ORDER BY sequence DESC";
string[] args = new string[] { System.Convert.ToString(docNumericId) };
Cursor cursor = null;
IList<RevisionInternal> result;
try
{
cursor = database.RawQuery(sql, args);
cursor.MoveToNext();
long lastSequence = 0;
result = new AList<RevisionInternal>();
while (!cursor.IsAfterLast())
{
long sequence = cursor.GetLong(0);
bool matches = false;
if (lastSequence == 0)
{
matches = revId.Equals(cursor.GetString(2));
}
else
{
matches = (sequence == lastSequence);
}
if (matches)
{
revId = cursor.GetString(2);
bool deleted = (cursor.GetInt(3) > 0);
bool missing = (cursor.GetInt(4) > 0);
RevisionInternal aRev = new RevisionInternal(docId, revId, deleted, this);
aRev.SetMissing(missing);
aRev.SetSequence(cursor.GetLong(0));
result.AddItem(aRev);
lastSequence = cursor.GetLong(1);
if (lastSequence == 0)
{
break;
}
}
cursor.MoveToNext();
}
}
catch (SQLException e)
{
Log.E(Database.Tag, "Error getting revision history", e);
return null;
}
finally
{
if (cursor != null)
{
cursor.Close();
}
}
return result;
}
示例4: GetRevisionHistory
public IList<RevisionInternal> GetRevisionHistory(RevisionInternal rev, ICollection<string> ancestorRevIds)
{
var history = new List<RevisionInternal>();
WithC4Document(rev.GetDocId(), rev.GetRevId(), false, false, doc =>
{
var enumerator = new CBForestHistoryEnumerator(doc, false);
foreach(var next in enumerator) {
if(ancestorRevIds != null && ancestorRevIds.Contains((string)next.Document->selectedRev.revID)) {
break;
}
var newRev = new RevisionInternal(next.Document, false);
newRev.SetMissing(!Native.c4doc_hasRevisionBody(next.Document));
history.Add(newRev);
}
});
return history;
}
示例5: CopyWithoutBody
internal RevisionInternal CopyWithoutBody()
{
if (_body == null) {
return this;
}
var rev = new RevisionInternal(_docId, _revId, _deleted);
rev.SetSequence(_sequence);
rev.SetMissing(_missing);
return rev;
}