mirror of
https://github.com/Telecominfraproject/wlan-cloud-ucentralsec.git
synced 2025-10-30 02:12:32 +00:00
Signed-off-by: stephb9959 <stephane.bourque@gmail.com>
This commit is contained in:
@@ -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);
|
||||||
|
|||||||
Reference in New Issue
Block a user