diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-12 17:24:44 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2012-10-12 17:24:44 +0200 |
commit | fef380f6c9a5fb9904d551478fe180a9c5d24b37 (patch) | |
tree | 06cd811ee093e0e52cb5e029f0705b8e6323a334 /odb/pgsql/database.ixx | |
parent | 9f994010f871ce0ea1aea58482ddef503cfc81c3 (diff) |
Completion of prepared query support
Diffstat (limited to 'odb/pgsql/database.ixx')
-rw-r--r-- | odb/pgsql/database.ixx | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/odb/pgsql/database.ixx b/odb/pgsql/database.ixx index bdd4390..7ad92be 100644 --- a/odb/pgsql/database.ixx +++ b/odb/pgsql/database.ixx @@ -2,6 +2,8 @@ // copyright : Copyright (c) 2009-2012 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file +#include <odb/pgsql/transaction.hxx> + namespace odb { namespace pgsql @@ -393,5 +395,29 @@ namespace odb // return query_<T, id_pgsql>::call (*this, q); } + + template <typename T> + inline prepared_query<T> database:: + prepare_query (const char* n, const char* q) + { + return prepare_query<T> (n, pgsql::query<T> (q)); + } + + template <typename T> + inline prepared_query<T> database:: + prepare_query (const char* n, const std::string& q) + { + return prepare_query<T> (n, pgsql::query<T> (q)); + } + + template <typename T> + inline prepared_query<T> database:: + prepare_query (const char* n, const pgsql::query<T>& q) + { + // Throws if not in transaction. + // + pgsql::connection& c (transaction::current ().connection ()); + return c.prepare_query (n, q); + } } } |