# HG changeset patch # User Alain Mazy # Date 1730882726 -3600 # Node ID b620bd9d1aab270fd06c053f4fbb639e603bbf50 # Parent 9b93aa0850737c436cf176ae633488df91af8ed7 fix metadata handling diff -r 9b93aa085073 -r b620bd9d1aab Framework/Plugins/IndexBackend.cpp --- a/Framework/Plugins/IndexBackend.cpp Tue Nov 05 11:19:59 2024 +0100 +++ b/Framework/Plugins/IndexBackend.cpp Wed Nov 06 09:45:26 2024 +0100 @@ -3351,7 +3351,7 @@ " " + formatter.FormatNull("TEXT") + " AS c4_string2, " " " + formatter.FormatNull("TEXT") + " AS c5_string3, " " type AS c6_int1, " - " " + formatter.FormatNull("INT") + " AS c7_int2, " + " revision AS c7_int2, " " " + formatter.FormatNull("INT") + " AS c8_int3, " " " + formatter.FormatNull("BIGINT") + " AS c9_big_int1, " " " + formatter.FormatNull("BIGINT") + " AS c10_big_int2 " @@ -3456,7 +3456,7 @@ " " + formatter.FormatNull("TEXT") + " AS c4_string2, " " " + formatter.FormatNull("TEXT") + " AS c5_string3, " " type AS c6_int1, " - " " + formatter.FormatNull("INT") + " AS c7_int2, " + " revision AS c7_int2, " " " + formatter.FormatNull("INT") + " AS c8_int3, " " " + formatter.FormatNull("BIGINT") + " AS c9_big_int1, " " " + formatter.FormatNull("BIGINT") + " AS c10_big_int2 " @@ -3512,7 +3512,7 @@ " " + formatter.FormatNull("TEXT") + " AS c4_string2, " " " + formatter.FormatNull("TEXT") + " AS c5_string3, " " type AS c6_int1, " - " " + formatter.FormatNull("INT") + " AS c7_int2, " + " revision AS c7_int2, " " " + formatter.FormatNull("INT") + " AS c8_int3, " " " + formatter.FormatNull("BIGINT") + " AS c9_big_int1, " " " + formatter.FormatNull("BIGINT") + " AS c10_big_int2 " @@ -3592,7 +3592,7 @@ " " + formatter.FormatNull("TEXT") + " AS c4_string2, " " " + formatter.FormatNull("TEXT") + " AS c5_string3, " " type AS c6_int1, " - " " + formatter.FormatNull("INT") + " AS c7_int2, " + " revision AS c7_int2, " " " + formatter.FormatNull("INT") + " AS c8_int3, " " " + formatter.FormatNull("BIGINT") + " AS c9_big_int1, " " " + formatter.FormatNull("BIGINT") + " AS c10_big_int2 " @@ -3667,7 +3667,7 @@ " " + formatter.FormatNull("TEXT") + " AS c4_string2, " " " + formatter.FormatNull("TEXT") + " AS c5_string3, " " type AS c6_int1, " - " " + formatter.FormatNull("INT") + " AS c7_int2, " + " revision AS c7_int2, " " " + formatter.FormatNull("INT") + " AS c8_int3, " " " + formatter.FormatNull("BIGINT") + " AS c9_big_int1, " " " + formatter.FormatNull("BIGINT") + " AS c10_big_int2 " @@ -3751,7 +3751,7 @@ " " + formatter.FormatNull("TEXT") + " AS c4_string2, " " " + formatter.FormatNull("TEXT") + " AS c5_string3, " " Metadata.type AS c6_int1, " - " " + formatter.FormatNull("INT") + " AS c7_int2, " + " revision AS c7_int2, " " " + formatter.FormatNull("INT") + " AS c8_int3, " " " + formatter.FormatNull("BIGINT") + " AS c9_big_int1, " " " + formatter.FormatNull("BIGINT") + " AS c10_big_int2 " @@ -3930,6 +3930,15 @@ metadata->set_value(statement->ReadString(C3_STRING_1)); metadata->set_key(statement->ReadInteger32(C6_INT_1)); + + if (!statement->IsNull(C7_INT_2)) // revision can be null for metadata that have been created by older Orthanc versions + { + metadata->set_revision(statement->ReadInteger32(C7_INT_2)); + } + else + { + metadata->set_revision(0); + } }; break; case QUERY_PARENT_METADATA: @@ -3939,6 +3948,15 @@ metadata->set_value(statement->ReadString(C3_STRING_1)); metadata->set_key(statement->ReadInteger32(C6_INT_1)); + + if (!statement->IsNull(C7_INT_2)) // revision can be null for metadata that have been created by older Orthanc versions + { + metadata->set_revision(statement->ReadInteger32(C7_INT_2)); + } + else + { + metadata->set_revision(0); + } }; break; case QUERY_GRAND_PARENT_METADATA: @@ -3948,6 +3966,15 @@ metadata->set_value(statement->ReadString(C3_STRING_1)); metadata->set_key(statement->ReadInteger32(C6_INT_1)); + + if (!statement->IsNull(C7_INT_2)) // revision can be null for metadata that have been created by older Orthanc versions + { + metadata->set_revision(statement->ReadInteger32(C7_INT_2)); + } + else + { + metadata->set_revision(0); + } }; break; case QUERY_PARENT_IDENTIFIER: @@ -3965,6 +3992,15 @@ metadata->set_value(statement->ReadString(C3_STRING_1)); metadata->set_key(statement->ReadInteger32(C6_INT_1)); + + if (!statement->IsNull(C7_INT_2)) // revision can be null for metadata that have been created by older Orthanc versions + { + metadata->set_revision(statement->ReadInteger32(C7_INT_2)); + } + else + { + metadata->set_revision(0); + } }; break; case QUERY_ONE_INSTANCE_ATTACHMENTS: {