修复因Query数据库异常导致数据库锁死的问题

croire 3 years ago
parent f6536284e9
commit c2b70c3ab1

@ -160,11 +160,11 @@ namespace DownKyi.Core.Storage.Database.Download
{ {
Dictionary<string, object> objects = new Dictionary<string, object>(); Dictionary<string, object> objects = new Dictionary<string, object>();
try dbHelper.ExecuteQuery(sql, reader =>
{ {
dbHelper.ExecuteQuery(sql, reader => while (reader.Read())
{ {
while (reader.Read()) try
{ {
// 读取字节数组 // 读取字节数组
byte[] array = (byte[])reader["data"]; byte[] array = (byte[])reader["data"];
@ -177,18 +177,17 @@ namespace DownKyi.Core.Storage.Database.Download
objects.Add((string)reader["id"], obj); objects.Add((string)reader["id"], obj);
} }
}); catch (Exception e)
} {
catch (Exception e) Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e);
{ LogManager.Error($"{tableName}", e);
Utils.Debugging.Console.PrintLine("Query()发生异常: {0}", e); }
LogManager.Error($"{tableName}", e); }
} });
return objects; return objects;
} }
/// <summary> /// <summary>
/// 如果表不存在则创建表 /// 如果表不存在则创建表
/// </summary> /// </summary>

Loading…
Cancel
Save