aboutsummaryrefslogtreecommitdiff
path: root/odb/pgsql/database.ixx
diff options
context:
space:
mode:
Diffstat (limited to 'odb/pgsql/database.ixx')
-rw-r--r--odb/pgsql/database.ixx26
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);
+ }
}
}