Skip to content

Commit

Permalink
https://telecominfraproject.atlassian.net/browse/WIFI-13172
Browse files Browse the repository at this point in the history
Signed-off-by: stephb9959 <[email protected]>
  • Loading branch information
stephb9959 committed Dec 11, 2023
1 parent 7e72cc7 commit c020e70
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/framework/orm.h
Original file line number Diff line number Diff line change
Expand Up @@ -576,8 +576,8 @@ namespace ORM {
bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) {
try {
assert(ValidFieldName(FieldName));

Poco::Data::Session Session = Pool_.get();
Session.begin();
Poco::Data::Statement Update(Session);

RecordTuple RT;
Expand All @@ -593,6 +593,7 @@ namespace ORM {
Update.execute();
if (Cache_)
Cache_->UpdateCache(R);
Session.commit();
return true;
} catch (const Poco::Exception &E) {
Logger_.log(E);
Expand Down Expand Up @@ -662,6 +663,7 @@ namespace ORM {
assert(ValidFieldName(FieldName));

Poco::Data::Session Session = Pool_.get();
Session.begin();
Poco::Data::Statement Delete(Session);

std::string St = "delete from " + TableName_ + " where " + FieldName + "=?";
Expand All @@ -671,6 +673,7 @@ namespace ORM {
Delete.execute();
if (Cache_)
Cache_->Delete(FieldName, Value);
Session.commit();
return true;
} catch (const Poco::Exception &E) {
Logger_.log(E);
Expand All @@ -682,11 +685,13 @@ namespace ORM {
try {
assert(!WhereClause.empty());
Poco::Data::Session Session = Pool_.get();
Session.begin();
Poco::Data::Statement Delete(Session);

std::string St = "delete from " + TableName_ + " where " + WhereClause;
Delete << St;
Delete.execute();
Session.commit();
return true;
} catch (const Poco::Exception &E) {
Logger_.log(E);
Expand Down

0 comments on commit c020e70

Please sign in to comment.