diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-28 10:51:12 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-28 10:51:12 +0200 |
commit | e28fe11ef1a582f14261e063f162e6088a6816a0 (patch) | |
tree | 84bc636d15d722f134f5c76cec7429d34e1f4c18 /odb/oracle/section-statements.hxx | |
parent | 2159b67ef61613b365deabcfbb7f224438612a54 (diff) |
Make schema version access (but not modification) thread-safe
Also cache the version in statements so that we don't have to lock
the mutex (slow) every time we need to check the version.
Diffstat (limited to 'odb/oracle/section-statements.hxx')
-rw-r--r-- | odb/oracle/section-statements.hxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/odb/oracle/section-statements.hxx b/odb/oracle/section-statements.hxx index 47e3bb7..ac8672a 100644 --- a/odb/oracle/section-statements.hxx +++ b/odb/oracle/section-statements.hxx @@ -10,12 +10,15 @@ #include <cstddef> // std::size_t #include <odb/forward.hxx> +#include <odb/schema-version.hxx> #include <odb/traits.hxx> #include <odb/oracle/version.hxx> #include <odb/oracle/oracle-types.hxx> #include <odb/oracle/binding.hxx> #include <odb/oracle/statement.hxx> +#include <odb/oracle/connection.hxx> +#include <odb/oracle/database.hxx> #include <odb/oracle/details/export.hxx> namespace odb @@ -46,6 +49,15 @@ namespace odb connection_type& connection () {return conn_;} + const schema_version_migration& + version_migration (const char* name = "") const + { + if (svm_ == 0) + svm_ = &conn_.database ().schema_version_migration (name); + + return *svm_; + } + image_type& image () {return image_;} @@ -136,6 +148,7 @@ namespace odb protected: connection_type& conn_; + mutable const schema_version_migration* svm_; // These come from object_statements. // |