comparison Framework/Common/DatabaseManager.cpp @ 452:6780dd8b0a66 pg-transactions

fix latency measure for ODBC
author Alain Mazy <am@osimis.io>
date Thu, 18 Jan 2024 10:04:43 +0100
parents cec6a0cd399f
children f0976163dbe1
comparison
equal deleted inserted replaced
451:392ac133a491 452:6780dd8b0a66
639 } 639 }
640 640
641 641
642 void DatabaseManager::StandaloneStatement::Execute(const Dictionary& parameters) 642 void DatabaseManager::StandaloneStatement::Execute(const Dictionary& parameters)
643 { 643 {
644 ExecuteInternal(parameters, true);
645 }
646
647 void DatabaseManager::StandaloneStatement::ExecuteWithoutResult(const Dictionary& parameters)
648 {
649 ExecuteInternal(parameters, false);
650 }
651
652 void DatabaseManager::StandaloneStatement::ExecuteInternal(const Dictionary& parameters, bool withResults)
653 {
644 try 654 try
645 { 655 {
646 std::unique_ptr<Query> query(ReleaseQuery()); 656 std::unique_ptr<Query> query(ReleaseQuery());
647 assert(query.get() != NULL); 657 assert(query.get() != NULL);
648 658
650 // is not destroyed, as the "IResult" can make calls to the 660 // is not destroyed, as the "IResult" can make calls to the
651 // statement (this is the case for SQLite and MySQL) - (*) 661 // statement (this is the case for SQLite and MySQL) - (*)
652 statement_.reset(GetManager().GetDatabase().Compile(*query)); 662 statement_.reset(GetManager().GetDatabase().Compile(*query));
653 assert(statement_.get() != NULL); 663 assert(statement_.get() != NULL);
654 664
655 SetResult(GetTransaction().Execute(*statement_, parameters)); 665 if (withResults)
666 {
667 SetResult(GetTransaction().Execute(*statement_, parameters));
668 }
669 else
670 {
671 GetTransaction().Execute(*statement_, parameters);
672 }
656 } 673 }
657 catch (Orthanc::OrthancException& e) 674 catch (Orthanc::OrthancException& e)
658 { 675 {
659 GetManager().CloseIfUnavailable(e.GetErrorCode()); 676 GetManager().CloseIfUnavailable(e.GetErrorCode());
660 throw; 677 throw;