diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2011-11-17 11:31:00 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2011-11-17 11:31:00 +0200 |
commit | 61e6f0fded93f1e2105d7f4734b280712afe0c59 (patch) | |
tree | b462d0b4e27456300c6c21afad21a6d0afa4341e /odb/mssql/transaction-impl.cxx | |
parent | 00d972abb9dcbe7c99cd9b94cefc725024cfb4bc (diff) |
Add connection, connection-factory implementations
Diffstat (limited to 'odb/mssql/transaction-impl.cxx')
-rw-r--r-- | odb/mssql/transaction-impl.cxx | 99 |
1 files changed, 99 insertions, 0 deletions
diff --git a/odb/mssql/transaction-impl.cxx b/odb/mssql/transaction-impl.cxx new file mode 100644 index 0000000..4d0d77f --- /dev/null +++ b/odb/mssql/transaction-impl.cxx @@ -0,0 +1,99 @@ +// file : odb/mssql/transaction-impl.cxx +// author : Boris Kolpackov <boris@codesynthesis.com> +// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC +// license : GNU GPL v2; see accompanying LICENSE file + +#include <odb/tracer.hxx> + +#include <odb/mssql/database.hxx> +#include <odb/mssql/connection.hxx> +#include <odb/mssql/transaction-impl.hxx> +#include <odb/mssql/error.hxx> + +namespace odb +{ + namespace mssql + { + transaction_impl:: + transaction_impl (database_type& db) + : odb::transaction_impl (db) + { + } + + transaction_impl:: + transaction_impl (connection_ptr c) + : odb::transaction_impl (c->database (), *c), connection_ (c) + { + } + + transaction_impl:: + ~transaction_impl () + { + } + + void transaction_impl:: + start () + { + /* + // Grab a connection if we don't already have one. + // + if (connection_ == 0) + { + connection_ = static_cast<database_type&> (database_).connection (); + odb::transaction_impl::connection_ = connection_.get (); + } + + { + odb::tracer* t; + if ((t = connection_->tracer ()) || (t = database_.tracer ())) + t->execute (*connection_, "BEGIN"); + } + + if (mssql_real_query (connection_->handle (), "begin", 5) != 0) + translate_error (*connection_); + */ + } + + void transaction_impl:: + commit () + { + /* + connection_->clear (); + + { + odb::tracer* t; + if ((t = connection_->tracer ()) || (t = database_.tracer ())) + t->execute (*connection_, "COMMIT"); + } + + if (mssql_real_query (connection_->handle (), "commit", 6) != 0) + translate_error (*connection_); + + // Release the connection. + // + //connection_.reset (); + */ + } + + void transaction_impl:: + rollback () + { + /* + connection_->clear (); + + { + odb::tracer* t; + if ((t = connection_->tracer ()) || (t = database_.tracer ())) + t->execute (*connection_, "ROLLBACK"); + } + + if (mssql_real_query (connection_->handle (), "rollback", 8) != 0) + translate_error (*connection_); + + // Release the connection. + // + //connection_.reset (); + */ + } + } +} |