[odb-users] What is the proper practice in using smart pointer in
querying
Wayne Hackle
hacklew at hotmail.com
Tue Mar 27 07:51:37 EDT 2012
Hi dear all,
I've been digging around with ODB for quite a while now, with great help from Boris and other more experienced users every now and then.
The new question is: what is the proper practice in using shared_ptr as default pointer?
I ran into very annoying errors that indicate memory management fault (destructors especially).
Here is my code:
session s; auto_ptr<odb::database> db(new odb::mysql::database("root","somepassword","somedatabase", "localhost"));
vector<person> v_person; transaction t(db->begin()); result<person> r(db->query<person>());
for (result<person>::iterator i(r.begin()); i != r.end(); ++i) { shared_ptr<person> p(i.load()); v_person.push_back(*p); }
t.commit();
The project builds successfully, but throws this exception when run:> odb::mysql::database::`scalar deleting destructor'() + 0x2e bit C++
looks like it's related to the destructor, but I am totally clueless.
Any help is appreciated, thank you very much.
Hackle
More information about the odb-users
mailing list