Hi 1. invalidId must return same value each time. This value serves as indicator of invalideness. For example, -1. UUID::generate() returns new value each time.
You may be thinking that somehow the SQL query has the bound values applied into it as text. That is not the case - SQLite works with the query and the bound values as is (separately). Neither Wt::Dbo nor sqlite3 lib provide a way to get final SQL query, with placeholders replaced with bound values. You can write it manually. Start from file Wt/Dbo/backend/Sqlite3.C. Original SQL query is stored in Sqlite3Statement.sql_, but bound values are not saved in query itself. So you can save them in some map, convert them into string using boost::lexical_cast and substitute placeholders in original SQL query. The whole task is not as trivial as it looks like. Regards, Boris Nagaev On Wed, Jan 8, 2014 at 12:35 PM, Muhammad Nasser Al-Noimi <mnno...@gmail.com> wrote: > Hi, > > Thanks for response, > >> 1. why invalidId returns UUID::generate()? > > > I'm using uuid as id for Client table so when error I want my default id is > uuid. > >> 2. Client has no fields "note" and "name". > > > Sorry for that, I was trying to abstract my problem so I missed to add those > fields to my last email. > > When I extracted my dbo classes to a clean project in order to post them > here, I found they work with no problem. So until now I don't know where the > problem is. > Is there any way to view the generated queries with its parameters not the > way setProperty("show-queries", "true") do. > > > On Tue, Jan 7, 2014 at 4:06 PM, Nagaev Boris <bnag...@gmail.com> wrote: >> >> Hello, >> >> 1. why invalidId returns UUID::generate()? >> 2. Client has no fields "note" and "name". >> >> Could you provide complete example as .cpp file? >> >> Regards, >> Boris Nagaev >> >> >> On Tue, Jan 7, 2014 at 11:13 AM, Muhammad Nasser Al-Noimi >> <mnno...@gmail.com> wrote: >> > 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 >> > >> >> >> ------------------------------------------------------------------------------ >> 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 > > > > ------------------------------------------------------------------------------ > 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 > ------------------------------------------------------------------------------ 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