mirror of
https://github.com/hmaxnl/SharpRSS.git
synced 2025-01-18 21:04:21 +01:00
Reworking DbAccess
This commit is contained in:
parent
e0352e374c
commit
ce90818e3d
|
@ -130,6 +130,7 @@ namespace SharpRss
|
|||
}
|
||||
public static async Task<FeedModel?> SetFeedsAsync(IEnumerable<FeedModel> feedModels)
|
||||
{
|
||||
//TODO: Implement fetching system!!!
|
||||
FeedModel? resultModel = null;
|
||||
await using SqliteConnection dbc = new SqliteConnection(ConnectionString);
|
||||
dbc.Open();
|
||||
|
@ -153,7 +154,8 @@ namespace SharpRss
|
|||
new SqliteParameter("lastUpdated", feedModel.LastUpdated?.ToUnixTimeMilliseconds()),
|
||||
new SqliteParameter("imageUrl", feedModel.ImageUrl ?? string.Empty),
|
||||
new SqliteParameter("originalDoc", feedModel.OriginalDocument ?? string.Empty)
|
||||
}
|
||||
},
|
||||
Transaction = transaction
|
||||
};
|
||||
await cmd.ExecuteNonQueryAsync();
|
||||
}
|
||||
|
@ -225,7 +227,10 @@ namespace SharpRss
|
|||
dbc.Open();
|
||||
await using SqliteTransaction transaction = dbc.BeginTransaction();
|
||||
await using SqliteCommand cmd = new SqliteCommand($"INSERT OR REPLACE INTO {FeedItemTable} (id, feed_id, read, title, description, link, last_updated, publishing_date, author, categories, content)" +
|
||||
$"VALUES (IFNULL((SELECT id FROM {FeedItemTable} WHERE link=@link), @id), @feedId, @read, @title, @description, @link, @lastUpdated, @publishingDate, @author, @categories, @content)", dbc);
|
||||
$"VALUES (IFNULL((SELECT id FROM {FeedItemTable} WHERE link=@link), @id), @feedId, @read, @title, @description, @link, @lastUpdated, @publishingDate, @author, @categories, @content)", dbc)
|
||||
{
|
||||
Transaction = transaction
|
||||
};
|
||||
foreach (FeedItemModel item in items)
|
||||
{
|
||||
cmd.Parameters.Clear();
|
||||
|
|
Loading…
Reference in New Issue
Block a user