Hey Sean, 2009/7/7 Sean Chittenden <[email protected]>: > Almost. What I'd like is the following: > > > void MyApp::foo() { > MyApp::instance()->req_resource<soci_conn> = MyApp::instance()- > >soci_conn(); > soci::session *sql = MyApp::instance()->req_resource<soci_conn>; > > sql.begin(); > > MyModel obj; > obj.do_something(); > > sql.commit(); > } > > > and in MyModel: > > > void MyModel::do_something() { > soci::session *sql = MyApp::instance()->req_resounrce<soci_conn>; > > sql << "SELECT foo, bar FROM baz", into(foo_), into(bar_); > } > > > Because of the call to begin()/commit(), it is very important that I > preserve the exact same SQL session as I descend from the controller > to the model. Because of the state-hiding nature of Wt, I don't know > how to ensure that my database connection gets handed back to the > connection pool at the end of the HTTP request. Thoughts on how best > to achieve this? -sc
You are right. I think the appropriate solution would be to add a virtual method to WApplication (I am still thinking of a good name) that marks the end of a request (after event propagation _and_ rendering) ? Regards, koen ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
