From 5e8650817997aed5cfae730e7e8a065e0c59a40f Mon Sep 17 00:00:00 2001 From: violet-dev Date: Tue, 6 Apr 2021 13:31:04 +0000 Subject: [PATCH] (server) Update when key duplicate, init-server --- hsync/Command.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/hsync/Command.cs b/hsync/Command.cs index f777834..b00d55b 100644 --- a/hsync/Command.cs +++ b/hsync/Command.cs @@ -665,7 +665,10 @@ static void _uploadToServerArticlesData(int range1 = 0, int range2 = int.MaxValu string.Join(',', query.Select(x => $"(\"{_ggg(x.Title)}\", {x.Id}, " + $"\"{x.EHash}\", \"{_ggg(x.Type)}\", \"{_ggg(x.Language)}\", " + $"\"{_ggg(x.Uploader)}\", \"{(x.Published.HasValue ? x.Published.Value.ToString("yyyy-MM-dd HH:mm:ss") : "")}\", " + - $"{x.Files}, \"{_ggg(x.Class)}\", {x.ExistOnHitomi})")); + $"{x.Files}, \"{_ggg(x.Class)}\", {x.ExistOnHitomi})")) + " " + + "ON DUPLICATE KEY UPDATE " + + "Title=VALUES(Title), EHash=VALUES(EHash), Type=VALUES(Type), Language=VALUES(Language)," + + "Uploader=VALUES(Uploader),Published=VALUES(Published),Files=VALUES(Files),Class=VALUES(Class),ExistOnHitomi=VALUES(ExistOnHitomi)"; myCommand.ExecuteNonQuery(); var new_index_artist = new List<(string, int)>();