/// <summary> /// Inserts a new blob record /// </summary> /// <param name="blob"> /// The blob to insert /// </param> /// <returns> /// The inserted blob, including the generated primary key /// </returns> public Blob InsertBlob(Blob blob) { Execute( "INSERT INTO Blob (" + "Name, " + "Length, " + "Created, " + "Updated) " + "VALUES (@p0, @p1, @p2, @p2);", blob.Name, blob.Length, blob.Updated = blob.Created = DateTime.UtcNow ); blob.ID = GetLastRowID(); return blob; }
/// <summary> /// Updates an existing blob record /// </summary> /// <param name="blob"> /// The blob to update /// </param> /// <returns> /// The updated blob record /// </returns> public Blob UpdateBlob(Blob blob) { Execute( "UPDATE Blob SET " + "Name = @p1, " + "Length = @p2, " + "Updated = @p3 " + "WHERE ID = @p0;", blob.ID, blob.Name, blob.Length, blob.Updated = DateTime.UtcNow ); return blob; }
/// <summary> /// Deletes an existing blob /// </summary> /// <param name="blob"> /// The blob to delete /// </param> public void DeleteBlob(Blob blob) { Execute( "DELETE FROM Blob WHERE ID = @p0;", blob.ID ); }