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 e3592b5 commit d050635
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5
6
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 d050635

Please sign in to comment.