aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--odb/mysql/connection.hxx6
-rw-r--r--odb/mysql/connection.ixx11
-rw-r--r--odb/mysql/database.hxx18
-rw-r--r--odb/mysql/database.ixx51
4 files changed, 69 insertions, 17 deletions
diff --git a/odb/mysql/connection.hxx b/odb/mysql/connection.hxx
index 8316386..3329bb6 100644
--- a/odb/mysql/connection.hxx
+++ b/odb/mysql/connection.hxx
@@ -74,7 +74,11 @@ namespace odb
template <typename T>
prepared_query<T>
- prepare_query (const char* name, const query<T>&);
+ prepare_query (const char* name, const mysql::query_base&);
+
+ template <typename T>
+ prepared_query<T>
+ prepare_query (const char* name, const odb::query_base&);
// SQL statement tracing.
//
diff --git a/odb/mysql/connection.ixx b/odb/mysql/connection.ixx
index 3a3c975..5bbb251 100644
--- a/odb/mysql/connection.ixx
+++ b/odb/mysql/connection.ixx
@@ -22,9 +22,18 @@ namespace odb
template <typename T>
inline prepared_query<T> connection::
- prepare_query (const char* n, const query<T>& q)
+ prepare_query (const char* n, const mysql::query_base& q)
{
return query_<T, id_mysql>::call (*this, n, q);
}
+
+ template <typename T>
+ inline prepared_query<T> connection::
+ prepare_query (const char* n, const odb::query_base& q)
+ {
+ // Translate to native query.
+ //
+ return prepare_query<T> (n, mysql::query_base (q));
+ }
}
}
diff --git a/odb/mysql/database.hxx b/odb/mysql/database.hxx
index cc26a6e..537a0e3 100644
--- a/odb/mysql/database.hxx
+++ b/odb/mysql/database.hxx
@@ -333,7 +333,11 @@ namespace odb
template <typename T>
unsigned long long
- erase_query (const mysql::query<T>&);
+ erase_query (const mysql::query_base&);
+
+ template <typename T>
+ unsigned long long
+ erase_query (const odb::query_base&);
// Query API.
//
@@ -351,7 +355,11 @@ namespace odb
template <typename T>
result<T>
- query (const mysql::query<T>&, bool cache = true);
+ query (const mysql::query_base&, bool cache = true);
+
+ template <typename T>
+ result<T>
+ query (const odb::query_base&, bool cache = true);
// Query preparation.
//
@@ -365,7 +373,11 @@ namespace odb
template <typename T>
prepared_query<T>
- prepare_query (const char* name, const mysql::query<T>&);
+ prepare_query (const char* name, const mysql::query_base&);
+
+ template <typename T>
+ prepared_query<T>
+ prepare_query (const char* name, const odb::query_base&);
// Transactions.
//
diff --git a/odb/mysql/database.ixx b/odb/mysql/database.ixx
index 5f3854a..9d12ddf 100644
--- a/odb/mysql/database.ixx
+++ b/odb/mysql/database.ixx
@@ -335,7 +335,7 @@ namespace odb
{
// T is always object_type.
//
- return erase_query<T> (mysql::query<T> ());
+ return erase_query<T> (mysql::query_base ());
}
template <typename T>
@@ -344,7 +344,7 @@ namespace odb
{
// T is always object_type.
//
- return erase_query<T> (mysql::query<T> (q));
+ return erase_query<T> (mysql::query_base (q));
}
template <typename T>
@@ -353,12 +353,12 @@ namespace odb
{
// T is always object_type.
//
- return erase_query<T> (mysql::query<T> (q));
+ return erase_query<T> (mysql::query_base (q));
}
template <typename T>
inline unsigned long long database::
- erase_query (const mysql::query<T>& q)
+ erase_query (const mysql::query_base& q)
{
// T is always object_type.
//
@@ -366,29 +366,38 @@ namespace odb
}
template <typename T>
+ inline unsigned long long database::
+ erase_query (const odb::query_base& q)
+ {
+ // Translate to native query.
+ //
+ return erase_query<T> (mysql::query_base (q));
+ }
+
+ template <typename T>
inline result<T> database::
query (bool cache)
{
- return query<T> (mysql::query<T> (), cache);
+ return query<T> (mysql::query_base (), cache);
}
template <typename T>
inline result<T> database::
query (const char* q, bool cache)
{
- return query<T> (mysql::query<T> (q), cache);
+ return query<T> (mysql::query_base (q), cache);
}
template <typename T>
inline result<T> database::
query (const std::string& q, bool cache)
{
- return query<T> (mysql::query<T> (q), cache);
+ return query<T> (mysql::query_base (q), cache);
}
template <typename T>
inline result<T> database::
- query (const mysql::query<T>& q, bool cache)
+ query (const mysql::query_base& q, bool cache)
{
// T is always object_type. We also don't need to check for transaction
// here; object_traits::query () does this.
@@ -402,27 +411,45 @@ namespace odb
}
template <typename T>
+ inline result<T> database::
+ query (const odb::query_base& q, bool cache)
+ {
+ // Translate to native query.
+ //
+ return query<T> (mysql::query_base (q), cache);
+ }
+
+ template <typename T>
inline prepared_query<T> database::
prepare_query (const char* n, const char* q)
{
- return prepare_query<T> (n, mysql::query<T> (q));
+ return prepare_query<T> (n, mysql::query_base (q));
}
template <typename T>
inline prepared_query<T> database::
prepare_query (const char* n, const std::string& q)
{
- return prepare_query<T> (n, mysql::query<T> (q));
+ return prepare_query<T> (n, mysql::query_base (q));
}
template <typename T>
inline prepared_query<T> database::
- prepare_query (const char* n, const mysql::query<T>& q)
+ prepare_query (const char* n, const mysql::query_base& q)
{
// Throws if not in transaction.
//
mysql::connection& c (transaction::current ().connection ());
- return c.prepare_query (n, q);
+ return c.prepare_query<T> (n, q);
+ }
+
+ template <typename T>
+ inline prepared_query<T> database::
+ prepare_query (const char* n, const odb::query_base& q)
+ {
+ // Translate to native query.
+ //
+ return prepare_query<T> (n, mysql::query_base (q));
}
}
}