예제 #1
0
 /// <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
 /// <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
 /// <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
      );
 }