From 62ef9782b05e7edb8e391232c97c95a0dc9b34c3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Wed, 2 Nov 2011 11:04:55 +0200 Subject: Add result_iterator::id() function that returns id without loading object --- common/query/driver.cxx | 14 ++++++++++++++ common/query/test.std | 1 + 2 files changed, 15 insertions(+) diff --git a/common/query/driver.cxx b/common/query/driver.cxx index 45392b8..e019fe5 100644 --- a/common/query/driver.cxx +++ b/common/query/driver.cxx @@ -493,6 +493,20 @@ main (int argc, char* argv[]) t.commit (); } + + // Test iterator::id(). + // + cout << "test 017" << endl; + { + transaction t (db->begin ()); + result r (db->query (query::last_name == "Dirt")); + + result::iterator i (r.begin ()); + assert (i != r.end ()); + assert (i.id () == 3); + + t.commit (); + } } catch (const odb::exception& e) { diff --git a/common/query/test.std b/common/query/test.std index 23f9029..58a2aa0 100644 --- a/common/query/test.std +++ b/common/query/test.std @@ -97,3 +97,4 @@ John Doe 30 married Jane Doe 29 married test 016 +test 017 -- cgit v1.1