aboutsummaryrefslogtreecommitdiff
path: root/common/relationship-query
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2011-09-20 11:53:04 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2011-09-20 11:53:04 +0200
commit18a040773c389de7be48111efc0f3cf7252ffc68 (patch)
treee68e5edde6a7f321e03172ecd5684d26644978c9 /common/relationship-query
parentf70b64e2c4f9861d7013492b609212ed78e840f5 (diff)
Change query syntax to use . for composite and -> for object pointer access
Also make non-inverse query columns act as both an object pointer and a normal column. The latter allows us to use natural expressions such as query<employee>::employer.is_null ().
Diffstat (limited to 'common/relationship-query')
-rw-r--r--common/relationship-query/driver.cxx14
1 files changed, 7 insertions, 7 deletions
diff --git a/common/relationship-query/driver.cxx b/common/relationship-query/driver.cxx
index 57a6215..2e0068e 100644
--- a/common/relationship-query/driver.cxx
+++ b/common/relationship-query/driver.cxx
@@ -109,11 +109,11 @@ main (int argc, char* argv[])
transaction t (db->begin ());
p_result pr (db->query<person> (
- p_query::residence::location::code == "ZA"));
+ p_query::residence.location->code == "ZA"));
assert (size (pr) == 1);
e_result er (db->query<employee> (
- e_query::residence::location::code == "ZA"));
+ e_query::residence.location->code == "ZA"));
assert (size (er) == 1);
t.commit ();
@@ -125,10 +125,10 @@ main (int argc, char* argv[])
session s;
transaction t (db->begin ());
- p_result pr (db->query<person> (p_query::husband::last_name == "Doe"));
+ p_result pr (db->query<person> (p_query::husband->last_name == "Doe"));
assert (size (pr) == 1);
- e_result er (db->query<employee> (e_query::husband::last_name == "Doe"));
+ e_result er (db->query<employee> (e_query::husband->last_name == "Doe"));
assert (size (er) == 1);
t.commit ();
@@ -142,8 +142,8 @@ main (int argc, char* argv[])
e_result r (
db->query<employee> (
- e_query::employed_by::name == "Simple Tech, Inc" &&
- e_query::nationality::code == "US"));
+ e_query::employed_by->name == "Simple Tech, Inc" &&
+ e_query::nationality->code == "US"));
assert (size (r) == 1);
@@ -158,7 +158,7 @@ main (int argc, char* argv[])
p_result r (
db->query<person> (
- p_query::husband::residence::location == "CA"));
+ p_query::husband->residence.location == "CA"));
assert (size (r) == 1);