diff options
-rw-r--r-- | odb/database.hxx | 13 | ||||
-rw-r--r-- | odb/database.ixx | 14 |
2 files changed, 27 insertions, 0 deletions
diff --git a/odb/database.hxx b/odb/database.hxx index e007a56..bc7a10b 100644 --- a/odb/database.hxx +++ b/odb/database.hxx @@ -9,6 +9,7 @@ #include <odb/pre.hxx> #include <string> +#include <cstddef> // std::size_t #include <odb/traits.hxx> #include <odb/forward.hxx> @@ -142,6 +143,18 @@ namespace odb query (const odb::query<typename object_traits<T>::object_type>&, bool cache = true); + // Native database statement execution. + // + public: + unsigned long long + execute (const char* statement); + + unsigned long long + execute (const std::string& statement); + + virtual unsigned long long + execute (const char* statement, std::size_t length) = 0; + // Transaction API. // public: diff --git a/odb/database.ixx b/odb/database.ixx index 42e8ac7..252f866 100644 --- a/odb/database.ixx +++ b/odb/database.ixx @@ -3,6 +3,8 @@ // copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC // license : GNU GPL v2; see accompanying LICENSE file +#include <cstring> // std::string + namespace odb { inline database:: @@ -204,4 +206,16 @@ namespace odb return query<T> (odb::query<object_type> (q), cache); } + + inline unsigned long long database:: + execute (const char* statement) + { + return execute (statement, std::strlen (statement)); + } + + inline unsigned long long database:: + execute (const std::string& statement) + { + return execute (statement.c_str (), statement.size ()); + } } |