diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-12 17:24:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-19 11:38:24 +0200 |
commit | 5b0430fdf4617b396e462872d438a663b174a3a8 (patch) | |
tree | e89e0cc5b1fdff4e3f49c9c7b7607d2b90108c31 /odb/connection.txx | |
parent | 5c705a90d348a2a9428d5121a24eb47d0d73eb39 (diff) |
Completion of prepared query support
Diffstat (limited to 'odb/connection.txx')
-rw-r--r-- | odb/connection.txx | 43 |
1 files changed, 36 insertions, 7 deletions
diff --git a/odb/connection.txx b/odb/connection.txx index c5662d9..7861851 100644 --- a/odb/connection.txx +++ b/odb/connection.txx @@ -4,13 +4,42 @@ namespace odb { - template <typename T> - prepared_query<T> connection:: - prepare_query (const char* n, const query<T>& q) + template <typename T, database_id DB> + struct connection::query_<T, DB, class_object> { - //@@ Views. Inline? - // - return prepared_query<T> ( - object_traits_impl<T, id_default>::prepare_query (*this, n, q)); + template <typename Q> + static prepared_query<T> + call (connection& c, const char* n, const Q& q) + { + // C++ compiler complaining there is no prepare_query()? Perhaps + // you forgot to specify --generate-prepared when compiling your + // persistent classes. + // + return prepared_query<T> ( + object_traits_impl<T, DB>::prepare_query (c, n, q)); + } + }; + + template <typename T, database_id DB> + struct connection::query_<T, DB, class_view> + { + template <typename Q> + static prepared_query<T> + call (connection& c, const char* n, const Q& q) + { + // C++ compiler complaining there is no prepare_query()? Perhaps + // you forgot to specify --generate-prepared when compiling your + // views. + // + return prepared_query<T> ( + view_traits_impl<T, DB>::prepare_query (c, n, q)); + } + }; + + template <typename P> + void connection:: + params_deleter (void* p) + { + delete static_cast<P*> (p); } } |