diff options
-rw-r--r-- | odb/pgsql/database.cxx | 15 | ||||
-rw-r--r-- | odb/pgsql/database.hxx | 10 |
2 files changed, 15 insertions, 10 deletions
diff --git a/odb/pgsql/database.cxx b/odb/pgsql/database.cxx index 887061b..080b17f 100644 --- a/odb/pgsql/database.cxx +++ b/odb/pgsql/database.cxx @@ -8,6 +8,7 @@ #include <odb/pgsql/database.hxx> #include <odb/pgsql/exceptions.hxx> #include <odb/pgsql/connection-factory.hxx> +#include <odb/pgsql/transaction.hxx> #include <odb/pgsql/details/options.hxx> @@ -214,11 +215,13 @@ namespace odb // { // } - // @@ Implement on completion of supporting code. - // - // transaction_impl* database:: - // begin () - // { - // } + transaction_impl* database:: + begin () + { + if (transaction::has_current ()) + throw already_in_transaction (); + + return new transaction_impl (*this); + } } } diff --git a/odb/pgsql/database.hxx b/odb/pgsql/database.hxx index 833e472..a45fbb0 100644 --- a/odb/pgsql/database.hxx +++ b/odb/pgsql/database.hxx @@ -14,9 +14,13 @@ #include <odb/database.hxx> +#include <odb/details/shared-ptr.hxx> + #include <odb/pgsql/version.hxx> #include <odb/pgsql/forward.hxx> +#include <odb/pgsql/connection.hxx> #include <odb/pgsql/connection-factory.hxx> +#include <odb/pgsql/transaction-impl.hxx> #include <odb/pgsql/details/export.hxx> @@ -86,10 +90,8 @@ namespace odb // execute (const char* statement, std::size_t length); public: - // @@ Implement on completion of supporting code. - // - // virtual transaction_impl* - // begin (); + virtual transaction_impl* + begin (); public: details::shared_ptr<connection_type> |