diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-12 13:01:49 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-12 13:01:49 +0200 |
commit | a051c451c178152dc0b37bf955bf60022d226843 (patch) | |
tree | c7efcf5f5a62499c0a39c87bb6cb26690216d5f2 /odb/database.hxx | |
parent | 6d7abb297bf7a4dcef4f90b4dfb3d46b7977e526 (diff) |
Optimize schema version access for default schema
Diffstat (limited to 'odb/database.hxx')
-rw-r--r-- | odb/database.hxx | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/odb/database.hxx b/odb/database.hxx index c7c4598..7ddbecb 100644 --- a/odb/database.hxx +++ b/odb/database.hxx @@ -339,24 +339,29 @@ namespace odb typedef odb::schema_version_migration schema_version_migration_type; schema_version_type - schema_version (const std::string& schema_name = "") const; + schema_version (const std::string& schema_name = std::string ()) const; bool - schema_migration (const std::string& schema_name = "") const; + schema_migration (const std::string& schema_name = std::string ()) const; + // Note that there is code that relies on the returned reference + // being valid until the version is changed or the database instance + // is destroyed. + // const schema_version_migration_type& - schema_version_migration (const std::string& schema_name = "") const; + schema_version_migration ( + const std::string& schema_name = std::string ()) const; // Set schema version and migration state manually. // void schema_version_migration (schema_version_type, bool migration, - const std::string& schema_name = ""); + const std::string& schema_name = std::string ()); void schema_version_migration (const schema_version_migration_type&, - const std::string& schema_name = ""); + const std::string& schema_name = std::string ()); // Set default schema version table for all schema names. The table // name should already be quoted if necessary. @@ -386,6 +391,10 @@ namespace odb virtual const schema_version_info& load_schema_version (const std::string& schema_name) const = 0; + private: + const schema_version_info& + schema_version_migration_ (const std::string& schema_name) const; + // Database id. // public: @@ -478,6 +487,7 @@ namespace odb std::string schema_version_table_; mutable schema_version_map schema_version_map_; + mutable const schema_version_info* default_schema_version_; // Cached. unsigned int schema_version_seq_; }; } |