[odb-users] Query problem
Boris Kolpackov
boris at codesynthesis.com
Mon Oct 1 04:48:01 EDT 2012
Hi Davide,
[CC'ed odb-users in case someone else runs into this problem.]
Davide Anastasia <Davide.Anastasia at qualitycapital.com> writes:
> odb::transaction t(m_db->begin());
>
> m_quoteResult = m_db->query<QCM::ODB::Quote>(
> buildQuery(d.m_day)));
>
> t.commit();
>
> // update iterators
> m_quoteCurr = m_quoteResult.begin();
> m_quoteEnd = m_quoteResult.end();
The query result is only valid within the transaction where it was
created. Quoting the manual (Section 4.4, "Query Result", second
paragraph):
"The result instance is only usable within the transaction it was
created in. Trying to manipulate the result after the transaction
has terminated leads to undefined behavior."
Boris
More information about the odb-users
mailing list