diff options
-rw-r--r-- | odb/mssql/connection.hxx | 6 | ||||
-rw-r--r-- | odb/mssql/connection.ixx | 11 | ||||
-rw-r--r-- | odb/mssql/database.hxx | 18 | ||||
-rw-r--r-- | odb/mssql/database.ixx | 51 |
4 files changed, 69 insertions, 17 deletions
diff --git a/odb/mssql/connection.hxx b/odb/mssql/connection.hxx index a1b4541..ee28d4f 100644 --- a/odb/mssql/connection.hxx +++ b/odb/mssql/connection.hxx @@ -73,7 +73,11 @@ namespace odb template <typename T> prepared_query<T> - prepare_query (const char* name, const query<T>&); + prepare_query (const char* name, const mssql::query_base&); + + template <typename T> + prepared_query<T> + prepare_query (const char* name, const odb::query_base&); // SQL statement tracing. // diff --git a/odb/mssql/connection.ixx b/odb/mssql/connection.ixx index c4c13a8..06633af 100644 --- a/odb/mssql/connection.ixx +++ b/odb/mssql/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 mssql::query_base& q) { return query_<T, id_mssql>::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, mssql::query_base (q)); + } } } diff --git a/odb/mssql/database.hxx b/odb/mssql/database.hxx index b64eccc..e73a332 100644 --- a/odb/mssql/database.hxx +++ b/odb/mssql/database.hxx @@ -291,7 +291,11 @@ namespace odb template <typename T> unsigned long long - erase_query (const mssql::query<T>&); + erase_query (const mssql::query_base&); + + template <typename T> + unsigned long long + erase_query (const odb::query_base&); // Query API. // @@ -309,7 +313,11 @@ namespace odb template <typename T> result<T> - query (const mssql::query<T>&); + query (const mssql::query_base&); + + template <typename T> + result<T> + query (const odb::query_base&); // Query preparation. // @@ -323,7 +331,11 @@ namespace odb template <typename T> prepared_query<T> - prepare_query (const char* name, const mssql::query<T>&); + prepare_query (const char* name, const mssql::query_base&); + + template <typename T> + prepared_query<T> + prepare_query (const char* name, const odb::query_base&); // Transactions. // diff --git a/odb/mssql/database.ixx b/odb/mssql/database.ixx index 44ffe00..3582913 100644 --- a/odb/mssql/database.ixx +++ b/odb/mssql/database.ixx @@ -335,7 +335,7 @@ namespace odb { // T is always object_type. // - return erase_query<T> (mssql::query<T> ()); + return erase_query<T> (mssql::query_base ()); } template <typename T> @@ -344,7 +344,7 @@ namespace odb { // T is always object_type. // - return erase_query<T> (mssql::query<T> (q)); + return erase_query<T> (mssql::query_base (q)); } template <typename T> @@ -353,12 +353,12 @@ namespace odb { // T is always object_type. // - return erase_query<T> (mssql::query<T> (q)); + return erase_query<T> (mssql::query_base (q)); } template <typename T> inline unsigned long long database:: - erase_query (const mssql::query<T>& q) + erase_query (const mssql::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> (mssql::query_base (q)); + } + + template <typename T> inline result<T> database:: query () { - return query<T> (mssql::query<T> ()); + return query<T> (mssql::query_base ()); } template <typename T> inline result<T> database:: query (const char* q) { - return query<T> (mssql::query<T> (q)); + return query<T> (mssql::query_base (q)); } template <typename T> inline result<T> database:: query (const std::string& q) { - return query<T> (mssql::query<T> (q)); + return query<T> (mssql::query_base (q)); } template <typename T> inline result<T> database:: - query (const mssql::query<T>& q) + query (const mssql::query_base& q) { // T is always object_type. We also don't need to check for transaction // here; object_traits::query () does this. @@ -397,27 +406,45 @@ namespace odb } template <typename T> + inline result<T> database:: + query (const odb::query_base& q) + { + // Translate to native query. + // + return query<T> (mssql::query_base (q)); + } + + template <typename T> inline prepared_query<T> database:: prepare_query (const char* n, const char* q) { - return prepare_query<T> (n, mssql::query<T> (q)); + return prepare_query<T> (n, mssql::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, mssql::query<T> (q)); + return prepare_query<T> (n, mssql::query_base (q)); } template <typename T> inline prepared_query<T> database:: - prepare_query (const char* n, const mssql::query<T>& q) + prepare_query (const char* n, const mssql::query_base& q) { // Throws if not in transaction. // mssql::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, mssql::query_base (q)); } } } |