|
|
|
@ -1,4 +1,6 @@
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using DownKyi.Core.Logging;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace DownKyi.Core.Storage.Database
|
|
|
|
|
{
|
|
|
|
@ -25,20 +27,37 @@ namespace DownKyi.Core.Storage.Database
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cover"></param>
|
|
|
|
|
public void Insert(Cover cover)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string sql = $"insert into cover values ({cover.Avid}, '{cover.Bvid}', {cover.Cid}, '{cover.Url}', '{cover.Md5}')";
|
|
|
|
|
dbHelper.ExecuteNonQuery(sql);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Utils.Debugging.Console.PrintLine("Insert()发生异常: {0}", e);
|
|
|
|
|
LogManager.Error("CoverDb", e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 更新数据,以url检索
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cover"></param>
|
|
|
|
|
public void Update(Cover cover)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string sql = $"update cover set avid={cover.Avid}, bvid='{cover.Bvid}', cid={cover.Cid}, md5='{cover.Md5}' where url glob '{cover.Url}'";
|
|
|
|
|
dbHelper.ExecuteNonQuery(sql);
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Utils.Debugging.Console.PrintLine("Update()发生异常: {0}", e);
|
|
|
|
|
LogManager.Error("CoverDb", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询所有数据
|
|
|
|
|