aboutsummaryrefslogtreecommitdiff
path: root/odb/connection.txx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2012-10-12 17:24:44 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2012-10-19 11:38:24 +0200
commit5b0430fdf4617b396e462872d438a663b174a3a8 (patch)
treee89e0cc5b1fdff4e3f49c9c7b7607d2b90108c31 /odb/connection.txx
parent5c705a90d348a2a9428d5121a24eb47d0d73eb39 (diff)
Completion of prepared query support
Diffstat (limited to 'odb/connection.txx')
-rw-r--r--odb/connection.txx43
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);
}
}