From 25feb0393f8c8a1e9e0e0edf369b10b318a60599 Mon Sep 17 00:00:00 2001 From: Constantin Michael Date: Thu, 27 Oct 2011 15:54:35 +0200 Subject: Implement query image change callback machinery --- odb/relational/header.hxx | 7 +++++++ odb/relational/oracle/header.cxx | 13 +++++++++++++ odb/relational/oracle/source.cxx | 8 ++++++++ odb/relational/source.hxx | 7 +++++++ 4 files changed, 35 insertions(+) diff --git a/odb/relational/header.hxx b/odb/relational/header.hxx index a331b3f..53ff93a 100644 --- a/odb/relational/header.hxx +++ b/odb/relational/header.hxx @@ -88,6 +88,11 @@ namespace relational } virtual void + image_extra (type&) + { + } + + virtual void traverse (type& c) { os << "struct image_type"; @@ -106,6 +111,8 @@ namespace relational if (!composite (c)) os << "std::size_t version;"; + image_extra (c); + os << "};"; } diff --git a/odb/relational/oracle/header.cxx b/odb/relational/oracle/header.cxx index 1e9e850..acbefef 100644 --- a/odb/relational/oracle/header.cxx +++ b/odb/relational/oracle/header.cxx @@ -16,6 +16,19 @@ namespace relational { namespace relational = relational::header; + struct image_type: relational::image_type, context + { + image_type (base const& x): base (x) {}; + + virtual void + image_extra (type& c) + { + if (options.generate_query () && !composite (c)) + os << "oracle::change_callback change_callback;"; + } + }; + entry image_type_; + struct image_member: relational::image_member, member_base { image_member (base const& x) diff --git a/odb/relational/oracle/source.cxx b/odb/relational/oracle/source.cxx index a22c235..3383b6f 100644 --- a/odb/relational/oracle/source.cxx +++ b/odb/relational/oracle/source.cxx @@ -866,6 +866,14 @@ namespace relational } virtual void + init_image_pre (type& c) + { + if (options.generate_query () && !composite (c)) + os << "if (i.change_callback.callback != 0)" + << "(i.change_callback.callback) (i.change_callback.context);"; + } + + virtual void init_value_extra () { os << "sts.find_statement ().stream_result ();"; diff --git a/odb/relational/source.hxx b/odb/relational/source.hxx index a82fe6a..6296f74 100644 --- a/odb/relational/source.hxx +++ b/odb/relational/source.hxx @@ -2182,6 +2182,11 @@ namespace relational } virtual void + init_image_pre (type&) + { + } + + virtual void init_value_extra () { } @@ -2413,6 +2418,8 @@ namespace relational os << "assert (sk != statement_update);" << endl; + init_image_pre (c); + os << "bool grew (false);" << endl; -- cgit v1.1