aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-11-02 11:04:55 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-11-02 11:04:55 +0200
commit62ef9782b05e7edb8e391232c97c95a0dc9b34c3 (patch)
tree0a07be15d7b737ba62cb092e21cc453b146db1db /common
parent15f718bbf874a77b1079a55f29335447aeba17dd (diff)
Add result_iterator::id() function that returns id without loading object
Diffstat (limited to 'common')
-rw-r--r--common/query/driver.cxx14
-rw-r--r--common/query/test.std1
2 files changed, 15 insertions, 0 deletions
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<person> (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