Mercurial > hg > orthanc-databases
comparison MySQL/Plugins/MySQLIndex.cpp @ 263:29d2b76516f6
fix mysql and postgresql builds
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 20 Apr 2021 15:08:09 +0200 |
parents | d663d9e44f8d |
children | 0868500060f3 |
comparison
equal
deleted
inserted
replaced
262:b0c65094b299 | 263:29d2b76516f6 |
---|---|
323 STATEMENT_FROM_HERE, manager, | 323 STATEMENT_FROM_HERE, manager, |
324 "SELECT LAST_INSERT_ID()"); | 324 "SELECT LAST_INSERT_ID()"); |
325 | 325 |
326 statement.Execute(); | 326 statement.Execute(); |
327 | 327 |
328 return ReadInteger64(statement, 0); | 328 return statement.ReadInteger64(0); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 | 332 |
333 void MySQLIndex::DeleteResource(IDatabaseBackendOutput& output, | 333 void MySQLIndex::DeleteResource(IDatabaseBackendOutput& output, |
361 // "id" is a root node | 361 // "id" is a root node |
362 done = true; | 362 done = true; |
363 } | 363 } |
364 else | 364 else |
365 { | 365 { |
366 int64_t parentId = ReadInteger64(lookupSiblings, 0); | 366 int64_t parentId = lookupSiblings.ReadInteger64(0); |
367 lookupSiblings.Next(); | 367 lookupSiblings.Next(); |
368 | 368 |
369 if (lookupSiblings.IsDone()) | 369 if (lookupSiblings.IsDone()) |
370 { | 370 { |
371 // "id" has no sibling node, recursively remove | 371 // "id" has no sibling node, recursively remove |
387 args2.SetIntegerValue("id", parentId); | 387 args2.SetIntegerValue("id", parentId); |
388 | 388 |
389 parent.Execute(args2); | 389 parent.Execute(args2); |
390 | 390 |
391 output.SignalRemainingAncestor( | 391 output.SignalRemainingAncestor( |
392 ReadString(parent, 0), | 392 parent.ReadString(0), |
393 static_cast<OrthancPluginResourceType>(ReadInteger32(parent, 1))); | 393 static_cast<OrthancPluginResourceType>(parent.ReadInteger32(1))); |
394 } | 394 } |
395 } | 395 } |
396 } | 396 } |
397 } | 397 } |
398 | 398 |
420 "SELECT value FROM GlobalIntegers WHERE property = 0"); | 420 "SELECT value FROM GlobalIntegers WHERE property = 0"); |
421 | 421 |
422 statement.SetReadOnly(true); | 422 statement.SetReadOnly(true); |
423 statement.Execute(); | 423 statement.Execute(); |
424 | 424 |
425 return ReadInteger64(statement, 0); | 425 return statement.ReadInteger64(0); |
426 } | 426 } |
427 | 427 |
428 | 428 |
429 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 | 429 #if ORTHANC_PLUGINS_HAS_DATABASE_CONSTRAINT == 1 |
430 void MySQLIndex::CreateInstance(OrthancPluginCreateInstanceResult& result, | 430 void MySQLIndex::CreateInstance(OrthancPluginCreateInstanceResult& result, |
471 for (size_t i = 0; i < 8; i++) | 471 for (size_t i = 0; i < 8; i++) |
472 { | 472 { |
473 statement.SetResultFieldType(i, ValueType_Integer64); | 473 statement.SetResultFieldType(i, ValueType_Integer64); |
474 } | 474 } |
475 | 475 |
476 result.isNewInstance = (ReadInteger64(statement, 3) == 1); | 476 result.isNewInstance = (statement.ReadInteger64(3) == 1); |
477 result.instanceId = ReadInteger64(statement, 7); | 477 result.instanceId = statement.ReadInteger64(7); |
478 | 478 |
479 if (result.isNewInstance) | 479 if (result.isNewInstance) |
480 { | 480 { |
481 result.isNewPatient = (ReadInteger64(statement, 0) == 1); | 481 result.isNewPatient = (statement.ReadInteger64(0) == 1); |
482 result.isNewStudy = (ReadInteger64(statement, 1) == 1); | 482 result.isNewStudy = (statement.ReadInteger64(1) == 1); |
483 result.isNewSeries = (ReadInteger64(statement, 2) == 1); | 483 result.isNewSeries = (statement.ReadInteger64(2) == 1); |
484 result.patientId = ReadInteger64(statement, 4); | 484 result.patientId = statement.ReadInteger64(4); |
485 result.studyId = ReadInteger64(statement, 5); | 485 result.studyId = statement.ReadInteger64(5); |
486 result.seriesId = ReadInteger64(statement, 6); | 486 result.seriesId = statement.ReadInteger64(6); |
487 } | 487 } |
488 } | 488 } |
489 } | 489 } |
490 #endif | 490 #endif |
491 } | 491 } |