Hi,

I'm trying to update a record using modify() for table with altered primary
key, But the commit fails and exit with error: "constraint failed". When I
checked the query generated I noticed that the primary key is in the fields
list.

The following code demonstrate the problem:

//Definitions
typedef long long DbId;
namespace Wt {
    namespace Dbo {
    template<>
    struct dbo_traits<Client> : public dbo_default_traits {
        static DbId invalidId() { return UUID::generate(); }
        static const char *surrogateIdField() { return 0; }
    };
    }
class Client {
public:
    DbId id;
    template<class Action>
    void persist(Action& a)
    {
        dbo::id(a, id, "id");
    }
};

// This is how I search for record to be modified:
clientPtr = session()->find<Client>().where("name = ?").bind("name");
// Every thing is ok until now, I can obtain the data and there is a result
of this query

//The error pops when I call the following:
clientPtr.modify()->note = "note";

Thanks alot,
Nasser Al-Noimi
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT 
organizations don't have a clear picture of how application performance 
affects their revenue. With AppDynamics, you get 100% visibility into your 
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to