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 | fb43a4faf5492453c751bbd2d2319c9ca8614a11 (patch) | |
tree | 4b37edc00530856b3ba506d0cd3dd29ae5da8fbf /odb/mssql/section-statements.hxx | |
parent | 771c2ddb82d9f2c7e070f4afc6c679b05b405f87 (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/mssql/section-statements.hxx')
-rw-r--r-- | odb/mssql/section-statements.hxx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/odb/mssql/section-statements.hxx b/odb/mssql/section-statements.hxx index d6ac777..c592dd9 100644 --- a/odb/mssql/section-statements.hxx +++ b/odb/mssql/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/mssql/version.hxx> #include <odb/mssql/mssql-types.hxx> #include <odb/mssql/binding.hxx> #include <odb/mssql/statement.hxx> +#include <odb/mssql/connection.hxx> +#include <odb/mssql/database.hxx> #include <odb/mssql/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_;} @@ -138,6 +150,7 @@ namespace odb protected: connection_type& conn_; + mutable const schema_version_migration* svm_; // These come from object_statements. // |