Mercurial > hg > orthanc-databases
comparison Resources/Orthanc/Databases/ISqlLookupFormatter.cpp @ 404:3cd39c8cade9 db-protobuf
sync
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 11 Apr 2023 20:52:09 +0200 |
parents | a8774581adfc |
children | de6de66d70b2 |
comparison
equal
deleted
inserted
replaced
403:91124cc8a8c7 | 404:3cd39c8cade9 |
---|---|
381 FormatLevel(static_cast<ResourceType>(level - 1)) + ".internalId=" + | 381 FormatLevel(static_cast<ResourceType>(level - 1)) + ".internalId=" + |
382 FormatLevel(static_cast<ResourceType>(level)) + ".parentId"); | 382 FormatLevel(static_cast<ResourceType>(level)) + ".parentId"); |
383 } | 383 } |
384 | 384 |
385 std::list<std::string> where; | 385 std::list<std::string> where; |
386 where.push_back(FormatLevel(queryLevel) + ".resourceType = " + | |
387 formatter.FormatResourceType(queryLevel) + comparisons); | |
386 | 388 |
387 if (!labels.empty()) | 389 if (!labels.empty()) |
388 { | 390 { |
389 /** | 391 /** |
390 * "In SQL Server, NOT EXISTS and NOT IN predicates are the best | 392 * "In SQL Server, NOT EXISTS and NOT IN predicates are the best |
416 | 418 |
417 default: | 419 default: |
418 throw OrthancException(ErrorCode_ParameterOutOfRange); | 420 throw OrthancException(ErrorCode_ParameterOutOfRange); |
419 } | 421 } |
420 | 422 |
421 where.push_back("(SELECT COUNT(1) FROM Labels WHERE internalId = " + FormatLevel(queryLevel) + | 423 where.push_back("(SELECT COUNT(1) FROM Labels AS selectedLabels WHERE selectedLabels.id = " + FormatLevel(queryLevel) + |
422 ".internalId AND label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); | 424 ".internalId AND selectedLabels.label IN (" + Join(formattedLabels, "", ", ") + ")) " + condition); |
423 } | 425 } |
424 | |
425 where.push_back(FormatLevel(queryLevel) + ".resourceType = " + | |
426 formatter.FormatResourceType(queryLevel) + comparisons); | |
427 | 426 |
428 sql += joins + Join(where, " WHERE ", " AND "); | 427 sql += joins + Join(where, " WHERE ", " AND "); |
429 | 428 |
430 if (limit != 0) | 429 if (limit != 0) |
431 { | 430 { |