diff --git a/common/repositories/buyer_buy_lines_repository.h b/common/repositories/buyer_buy_lines_repository.h index bb470cccd..4fa374229 100644 --- a/common/repositories/buyer_buy_lines_repository.h +++ b/common/repositories/buyer_buy_lines_repository.h @@ -236,6 +236,10 @@ public: ) ); + if (buyers.empty()) { + return all_entries; + } + std::vector char_ids{}; for (auto const &bl : buyers) { char_ids.push_back((std::to_string(bl.char_id))); diff --git a/common/repositories/buyer_repository.h b/common/repositories/buyer_repository.h index d20751b0a..382ad9ccf 100644 --- a/common/repositories/buyer_repository.h +++ b/common/repositories/buyer_repository.h @@ -120,6 +120,10 @@ public: } DeleteWhere(db, fmt::format("`char_id` = '{}';", char_id)); + if (buy_line_ids.empty()) { + return false; + } + BaseBuyerBuyLinesRepository::DeleteWhere( db, fmt::format("`id` IN({})", Strings::Implode(", ", buy_line_ids)) diff --git a/common/repositories/trader_repository.h b/common/repositories/trader_repository.h index bee208d13..b85d04e76 100644 --- a/common/repositories/trader_repository.h +++ b/common/repositories/trader_repository.h @@ -217,6 +217,10 @@ public: delete_ids.push_back(std::to_string(e.id)); } + if (delete_ids.empty()) { + return 0; + } + return DeleteWhere(db, fmt::format("`id` IN({})", Strings::Implode(",", delete_ids))); } };