|
|
|
@ -32,6 +32,8 @@ namespace DownKyi.Core.Storage.Database.Download
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="obj"></param>
|
|
|
|
|
public void Insert(string uuid, object obj)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 定义一个流
|
|
|
|
|
Stream stream = new MemoryStream();
|
|
|
|
@ -50,8 +52,6 @@ namespace DownKyi.Core.Storage.Database.Download
|
|
|
|
|
//关闭流
|
|
|
|
|
stream.Close();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string sql = $"insert into {tableName}(id, data) values (@id, @data)";
|
|
|
|
|
dbHelper.ExecuteNonQuery(sql, new Action<SQLiteParameterCollection>((para) =>
|
|
|
|
|
{
|
|
|
|
@ -85,6 +85,8 @@ namespace DownKyi.Core.Storage.Database.Download
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Update(string uuid, object obj)
|
|
|
|
|
{
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
// 定义一个流
|
|
|
|
|
Stream stream = new MemoryStream();
|
|
|
|
@ -103,8 +105,6 @@ namespace DownKyi.Core.Storage.Database.Download
|
|
|
|
|
//关闭流
|
|
|
|
|
stream.Close();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
string sql = $"update {tableName} set data=@data where id glob @id";
|
|
|
|
|
dbHelper.ExecuteNonQuery(sql, new Action<SQLiteParameterCollection>((para) =>
|
|
|
|
|
{
|
|
|
|
@ -160,6 +160,8 @@ namespace DownKyi.Core.Storage.Database.Download
|
|
|
|
|
{
|
|
|
|
|
Dictionary<string, object> objects = new Dictionary<string, object>();
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
|
{
|
|
|
|
|
dbHelper.ExecuteQuery(sql, reader =>
|
|
|
|
|
{
|
|
|
|
|
while (reader.Read())
|
|
|
|
@ -176,6 +178,13 @@ namespace DownKyi.Core.Storage.Database.Download
|
|
|
|
|
objects.Add((string)reader["id"], obj);
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
catch (Exception e)
|
|
|
|
|
{
|
|
|
|
|
Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e);
|
|
|
|
|
LogManager.Error($"{tableName}", e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return objects;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|