Project

General

Profile

Actions

Bug #1522

open

[Wt 3.2.2] [Postgresql] statement not recycled after exception while .remove()

Added by Thomas Saquet over 11 years ago. Updated over 11 years ago.

Status:
Feedback
Priority:
Normal
Assignee:
Target version:
-
Start date:
11/14/2012
Due date:
% Done:

0%

Estimated time:

Description

Hello,

It seems that a previous bug still exists somewhere else. When I use .remove() on a Dbo::ptr, if an exception occurs the statement is not recycled and it is re-executed at the next call to the database. The only way to get rid of it is to refresh the page.

It happens in that case :

try
{
    Wt::Dbo::Transaction transaction(*session);
    Wt::Dbo::ptr<ObjectToFind> ptdObjectToDelete = session->find<ObjectToFind>().where("\"OBJ_ID\" = ?").bind(id);
    ptdObjectToDelete.remove();
    transaction.commit();
}
catch (Wt::Dbo::Exception e)
{
    Wt::log("error") << "[MyClass : ] " << e.what();
}

The same query with .execute() works fine.

Regards,

Thomas

Actions #1

Updated by Koen Deforche over 11 years ago

  • Status changed from New to Feedback
  • Assignee set to Koen Deforche

Hey,

This is something different though. When a transaction is being rolled back, then the objects which required persistence are kept at their 'dirty' state.

If you want to discard changes, then you should use ptr.reread() or session.rereadAll() (although I just now fixed a bug in that function).

Regards,

koen

Actions

Also available in: Atom PDF