Mercurial > hg > orthanc-databases
comparison MySQL/Plugins/MySQLIndex.cpp @ 252:33fa478c119a
cppcheck
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Wed, 14 Apr 2021 13:33:48 +0200 |
parents | a063bbf10a3e |
children | d663d9e44f8d |
comparison
equal
deleted
inserted
replaced
251:ed12248ad791 | 252:33fa478c119a |
---|---|
341 | 341 |
342 bool done = false; | 342 bool done = false; |
343 | 343 |
344 while (!done) | 344 while (!done) |
345 { | 345 { |
346 int64_t parentId; | |
347 | |
348 { | 346 { |
349 DatabaseManager::CachedStatement lookupSiblings( | 347 DatabaseManager::CachedStatement lookupSiblings( |
350 STATEMENT_FROM_HERE, manager, | 348 STATEMENT_FROM_HERE, manager, |
351 "SELECT parentId FROM Resources " | 349 "SELECT parentId FROM Resources " |
352 "WHERE parentId = (SELECT parentId FROM Resources WHERE internalId=${id});"); | 350 "WHERE parentId = (SELECT parentId FROM Resources WHERE internalId=${id});"); |
363 // "id" is a root node | 361 // "id" is a root node |
364 done = true; | 362 done = true; |
365 } | 363 } |
366 else | 364 else |
367 { | 365 { |
368 parentId = ReadInteger64(lookupSiblings, 0); | 366 int64_t parentId = ReadInteger64(lookupSiblings, 0); |
369 lookupSiblings.Next(); | 367 lookupSiblings.Next(); |
370 | 368 |
371 if (lookupSiblings.IsDone()) | 369 if (lookupSiblings.IsDone()) |
372 { | 370 { |
373 // "id" has no sibling node, recursively remove | 371 // "id" has no sibling node, recursively remove |
383 STATEMENT_FROM_HERE, manager, | 381 STATEMENT_FROM_HERE, manager, |
384 "SELECT publicId, resourceType FROM Resources WHERE internalId=${id};"); | 382 "SELECT publicId, resourceType FROM Resources WHERE internalId=${id};"); |
385 | 383 |
386 parent.SetParameterType("id", ValueType_Integer64); | 384 parent.SetParameterType("id", ValueType_Integer64); |
387 | 385 |
388 Dictionary args; | 386 Dictionary args2; |
389 args.SetIntegerValue("id", parentId); | 387 args2.SetIntegerValue("id", parentId); |
390 | 388 |
391 parent.Execute(args); | 389 parent.Execute(args2); |
392 | 390 |
393 output.SignalRemainingAncestor( | 391 output.SignalRemainingAncestor( |
394 ReadString(parent, 0), | 392 ReadString(parent, 0), |
395 static_cast<OrthancPluginResourceType>(ReadInteger32(parent, 1))); | 393 static_cast<OrthancPluginResourceType>(ReadInteger32(parent, 1))); |
396 } | 394 } |