[odb-users] How to Modify ODB template by generate code
Justlive
duhai_lee at qq.com
Sun Dec 9 22:36:02 EST 2012
<div>Hi,</div><div> I used odb version is 2.0.1. My compiler is vc2003, OS is windows 7. Generate code by ODB command, compily it, then make a mistake...</div><div><br></div><div>I must modify it like this:</div><div><br></div><div><div> result< access::object_traits< ::OilField >::object_type ></div><div> access::object_traits< ::OilField >::</div><div> query (database&, const query_base_type& q)</div><div> {</div><div> //using namespace mysql; // comment this line..</div><div> using odb::details::shared;</div><div> using odb::details::shared_ptr;</div><div><br></div><div> mysql::connection& conn (</div><div> mysql::transaction::current ().connection ());</div><div><br></div><div> statements_type& sts (</div><div> conn.statement_cache ().find_object<object_type> ());</div><div><br></div><div> image_type& im (sts.image ());</div><div> mysql::binding& imb (sts.select_image_binding ()); // add mysql:: namespace</div><div><br></div><div> if (im.version != sts.select_image_version () ||</div><div> imb.version == 0)</div><div> {</div><div> bind (imb.bind, im, mysql::statement_select); // add mysql:: namespace</div><div> sts.select_image_version (im.version);</div><div> imb.version++;</div><div> }</div><div><br></div><div> shared_ptr<mysql::select_statement> st ( // add mysql:: namespace</div><div> new (shared) mysql::select_statement ( // add mysql:: namespace</div><div> sts.connection (),</div><div> query_statement + q.clause (),</div><div> q.parameters_binding (),</div><div> imb));</div><div><br></div><div> st->execute ();</div><div><br></div><div> shared_ptr< odb::object_result_impl<object_type> > r (</div><div> new (shared) mysql::object_result_impl<object_type> (</div><div> q, st, sts));</div><div><br></div><div> return result<object_type> (r);</div><div> }</div></div><div><br></div><div>then, it works.</div><div>of course, if I would't modify it, it works good on vs2010. </div><div><br></div><div>so, I hope I can modify template of generating code . else I modify it what generated code every time I modify my entity class. </div><div>but I can't found that to change the template. It's just a odb.exe. </div><div><br></div><div>thanks..</div><div><br></div><div><br></div>
More information about the odb-users
mailing list