Mercurial > hg > orthanc-databases
changeset 644:3657d84703b9
opti: left join vs full join
author | Alain Mazy <am@orthanc.team> |
---|---|
date | Thu, 20 Feb 2025 12:39:54 +0100 (3 months ago) |
parents | 77004b16d7fe |
children | ddc98844d931 a3a6f41f4e30 |
files | Framework/Plugins/ISqlLookupFormatter.cpp |
diffstat | 1 files changed, 5 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/Framework/Plugins/ISqlLookupFormatter.cpp Thu Feb 20 11:54:14 2025 +0100 +++ b/Framework/Plugins/ISqlLookupFormatter.cpp Thu Feb 20 12:39:54 2025 +0100 @@ -440,26 +440,26 @@ if (tagLevel == requestLevel) { - target = " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + FormatLevel(requestLevel) + + target = " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + FormatLevel(requestLevel) + ".internalId AND " + tagFilter; } else if (static_cast<int32_t>(requestLevel) - static_cast<int32_t>(tagLevel) == 1) { target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId " - " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "parent.internalId AND " + tagFilter; + " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "parent.internalId AND " + tagFilter; } else if (static_cast<int32_t>(requestLevel) - static_cast<int32_t>(tagLevel) == 2) { target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId " " INNER JOIN Resources " + orderArg + "grandparent ON " + orderArg + "grandparent.internalId = " + orderArg + "parent.parentId " - " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandparent.internalId AND " + tagFilter; + " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandparent.internalId AND " + tagFilter; } else if (static_cast<int32_t>(requestLevel) - static_cast<int32_t>(tagLevel) == 3) { target = " INNER JOIN Resources " + orderArg + "parent ON " + orderArg + "parent.internalId = " + FormatLevel(requestLevel) + ".parentId " " INNER JOIN Resources " + orderArg + "grandparent ON " + orderArg + "grandparent.internalId = " + orderArg + "parent.parentId " " INNER JOIN Resources " + orderArg + "grandgrandparent ON " + orderArg + "grandgrandparent.internalId = " + orderArg + "grandparent.parentId " - " FULL JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter; + " LEFT JOIN " + tagTable + " " + orderArg + " ON " + orderArg + ".id = " + orderArg + "grandgrandparent.internalId AND " + tagFilter; } } #endif @@ -473,7 +473,7 @@ { std::string arg = "order" + boost::lexical_cast<std::string>(index); - target = " FULL JOIN Metadata " + arg + " ON " + arg + ".id = " + FormatLevel(requestLevel) + + target = " LEFT JOIN Metadata " + arg + " ON " + arg + ".id = " + FormatLevel(requestLevel) + ".internalId AND " + arg + ".type = " + boost::lexical_cast<std::string>(metadata); }