diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-07 10:21:09 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-03-07 10:21:09 +0200 |
commit | 382d0972301fb575f36eb2e5d442d735d7da3da4 (patch) | |
tree | f6fe9c80389c85e72bf849e8527f09e207cece0e /common/query/driver.cxx | |
parent | 58f14a5a500b92f6ed34fe20a896ae9c2d777071 (diff) |
Use RAII to free select statement results
Diffstat (limited to 'common/query/driver.cxx')
-rw-r--r-- | common/query/driver.cxx | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/common/query/driver.cxx b/common/query/driver.cxx index 6afd82d..c207955 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -513,6 +513,25 @@ main (int argc, char* argv[]) t.commit (); } + + // Test empty result set. + // + cout << "test 018" << endl; + { + { + transaction t (db->begin ()); + result r (db->query<person> (query::last_name == "None")); + assert (r.empty ()); + t.commit (); + } + + { + transaction t (db->begin ()); + result r (db->query<person> (query::last_name == "None")); + assert (r.begin () == r.end ()); + t.commit (); + } + } } catch (const odb::exception& e) { |