コード例 #1
0
ファイル: BackupIndex.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Inserts a new entry record
 /// </summary>
 /// <param name="entry">
 /// The entry to insert
 /// </param>
 /// <returns>
 /// The inserted entry, including the generated primary key
 /// </returns>
 public Entry InsertEntry(Entry entry)
 {
     Execute(
     "INSERT INTO Entry (" +
        "SessionID, " +
        "NodeID, " +
        "BlobID, " +
        "State, " +
        "Offset, " +
        "Length, " +
        "Crc32) " +
     "VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6);",
     entry.Session.ID,
     entry.Node.ID,
     (entry.Blob != null) ? (Object)entry.Blob.ID : null,
     Convert.ToInt32(entry.State),
     entry.Offset,
     entry.Length,
     BitConverter.GetBytes(entry.Crc32)
      );
      entry.ID = GetLastRowID();
      return entry;
 }
コード例 #2
0
ファイル: BackupIndex.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Updates an existing entry record
 /// </summary>
 /// <param name="entry">
 /// The entry to update
 /// </param>
 /// <returns>
 /// The updated entry record
 /// </returns>
 public Entry UpdateEntry(Entry entry)
 {
     Execute(
     "UPDATE Entry SET " +
        "SessionID = @p1, " +
        "NodeID = @p2, " +
        "BlobID = @p3, " +
        "State = @p4, " +
        "Offset = @p5, " +
        "Length = @p6, " +
        "Crc32 = @p7 " +
     "WHERE ID = @p0;",
     entry.ID,
     entry.Session.ID,
     entry.Node.ID,
     (entry.Blob != null) ? (Object)entry.Blob.ID : null,
     Convert.ToInt32(entry.State),
     entry.Offset,
     entry.Length,
     BitConverter.GetBytes(entry.Crc32)
      );
      return entry;
 }
コード例 #3
0
ファイル: BackupIndex.cs プロジェクト: bspell1/SkyFloe
 /// <summary>
 /// Deletes an existing entry
 /// </summary>
 /// <param name="entry">
 /// The entry to delete
 /// </param>
 public void DeleteEntry(Entry entry)
 {
     Execute(
     "DELETE FROM Entry WHERE ID = @p0;",
     entry.ID
      );
 }