stephb9959
2023-12-11 09:47:33 -08:00
parent e3592b5fe6
commit d050635a99
2 changed files with 7 additions and 2 deletions

2
build
View File

@@ -1 +1 @@
5 6

View File

@@ -576,8 +576,8 @@ namespace ORM {
bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) { bool UpdateRecord(field_name_t FieldName, const T &Value, const RecordType &R) {
try { try {
assert(ValidFieldName(FieldName)); assert(ValidFieldName(FieldName));
Poco::Data::Session Session = Pool_.get(); Poco::Data::Session Session = Pool_.get();
Session.begin();
Poco::Data::Statement Update(Session); Poco::Data::Statement Update(Session);
RecordTuple RT; RecordTuple RT;
@@ -593,6 +593,7 @@ namespace ORM {
Update.execute(); Update.execute();
if (Cache_) if (Cache_)
Cache_->UpdateCache(R); Cache_->UpdateCache(R);
Session.commit();
return true; return true;
} catch (const Poco::Exception &E) { } catch (const Poco::Exception &E) {
Logger_.log(E); Logger_.log(E);
@@ -662,6 +663,7 @@ namespace ORM {
assert(ValidFieldName(FieldName)); assert(ValidFieldName(FieldName));
Poco::Data::Session Session = Pool_.get(); Poco::Data::Session Session = Pool_.get();
Session.begin();
Poco::Data::Statement Delete(Session); Poco::Data::Statement Delete(Session);
std::string St = "delete from " + TableName_ + " where " + FieldName + "=?"; std::string St = "delete from " + TableName_ + " where " + FieldName + "=?";
@@ -671,6 +673,7 @@ namespace ORM {
Delete.execute(); Delete.execute();
if (Cache_) if (Cache_)
Cache_->Delete(FieldName, Value); Cache_->Delete(FieldName, Value);
Session.commit();
return true; return true;
} catch (const Poco::Exception &E) { } catch (const Poco::Exception &E) {
Logger_.log(E); Logger_.log(E);
@@ -682,11 +685,13 @@ namespace ORM {
try { try {
assert(!WhereClause.empty()); assert(!WhereClause.empty());
Poco::Data::Session Session = Pool_.get(); Poco::Data::Session Session = Pool_.get();
Session.begin();
Poco::Data::Statement Delete(Session); Poco::Data::Statement Delete(Session);
std::string St = "delete from " + TableName_ + " where " + WhereClause; std::string St = "delete from " + TableName_ + " where " + WhereClause;
Delete << St; Delete << St;
Delete.execute(); Delete.execute();
Session.commit();
return true; return true;
} catch (const Poco::Exception &E) { } catch (const Poco::Exception &E) {
Logger_.log(E); Logger_.log(E);