From cd852a8be3a75b0be5bba9a7b6b454849231cd27 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Thu, 25 Nov 2010 11:19:03 +0200 Subject: Add support for object pointers in query --- common/relationship/driver.cxx | 15 +++++++++++++++ common/relationship/makefile | 3 ++- 2 files changed, 17 insertions(+), 1 deletion(-) (limited to 'common/relationship') diff --git a/common/relationship/driver.cxx b/common/relationship/driver.cxx index 9266e2b..f7aa79e 100644 --- a/common/relationship/driver.cxx +++ b/common/relationship/driver.cxx @@ -96,6 +96,21 @@ main (int argc, char* argv[]) assert (*a1 == a); } + // query + // + typedef odb::query query; + typedef odb::result result; + + { + transaction t (db->begin ()); + + result r (db->query (query::o1::str == "obj1")); + assert (r.size () == 1); + assert (r.begin ()->o1->id == a.o1->id); + + t.commit (); + } + // test NULL pointer // delete a.o1; diff --git a/common/relationship/makefile b/common/relationship/makefile index a1c0a21..a3857d4 100644 --- a/common/relationship/makefile +++ b/common/relationship/makefile @@ -35,7 +35,8 @@ gen := $(addprefix $(out_base)/,$(genf)) $(gen): $(odb) $(gen): odb := $(odb) -$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema +$(gen) $(dist): export odb_options += --database $(db_id) --generate-schema \ +--generate-query $(gen): cpp_options := -I$(out_base) $(gen): $(common.l.cpp-options) -- cgit v1.1