Improve list-broken-files output
This hand-picks the changes from #5049 by @gpatel-fr. The change is to use a left-join to include all broken files, even if there are no entries in the Blockset table. The update is only visual but makes the results consistent with the actual operation performed by purge-broken-files. This close #5049
This commit is contained in:
@@ -1091,7 +1091,7 @@ namespace Duplicati.CommandLine
|
||||
{
|
||||
previd = id;
|
||||
outputcount = 0;
|
||||
con.MessageEvent(string.Format("{0}\t: {1}\t({2} match(es))", id, time.ToLocalTime(), count));
|
||||
con.MessageEvent(string.Format("Fileset {0}\t: {1}\t({2} match(es))", id, time.ToLocalTime(), count));
|
||||
}
|
||||
|
||||
con.MessageEvent(string.Format("\t{0} ({1})", path, Library.Utility.Utility.FormatSizeString(size)));
|
||||
|
||||
@@ -63,7 +63,7 @@ WHERE ""BlocksetID"" IS NULL OR ""BlocksetID"" IN
|
||||
");
|
||||
private static readonly string BROKEN_FILE_SETS = FormatInvariant($@"SELECT DISTINCT ""B"".""Timestamp"", ""A"".""FilesetID"", COUNT(""A"".""FileID"") AS ""FileCount"" FROM ""FilesetEntry"" A, ""Fileset"" B WHERE ""A"".""FilesetID"" = ""B"".""ID"" AND ""A"".""FileID"" IN ({BROKEN_FILE_IDS})");
|
||||
|
||||
private static readonly string BROKEN_FILE_NAMES = FormatInvariant($@"SELECT ""A"".""Path"", ""B"".""Length"" FROM ""File"" A, ""Blockset"" B WHERE ""A"".""BlocksetID"" = ""B"".""ID"" AND ""A"".""ID"" IN ({BROKEN_FILE_IDS}) AND ""A"".""ID"" IN (SELECT ""FileID"" FROM ""FilesetEntry"" WHERE ""FilesetID"" = @FilesetId)");
|
||||
private static readonly string BROKEN_FILE_NAMES = FormatInvariant($@"SELECT ""A"".""Path"", ""B"".""Length"" FROM ""File"" A LEFT JOIN ""Blockset"" B ON (""A"".""BlocksetID"" = ""B"".""ID"") WHERE ""A"".""ID"" IN ({BROKEN_FILE_IDS}) AND ""A"".""ID"" IN (SELECT ""FileID"" FROM ""FilesetEntry"" WHERE ""FilesetID"" = @FilesetId)");
|
||||
|
||||
private static string INSERT_BROKEN_IDS(string tablename, string IDfieldname) => FormatInvariant($@"INSERT INTO ""{tablename}"" (""{IDfieldname}"") {BROKEN_FILE_IDS} AND ""ID"" IN (SELECT ""FileID"" FROM ""FilesetEntry"" WHERE ""FilesetID"" = @FilesetId)");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user