diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-02 08:33:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2013-09-02 08:33:25 +0200 |
commit | 9715f388db714fb663b854883e4cad5f2aa3c860 (patch) | |
tree | febbbba7980a6891784440d86911b13befe108a7 /odb/pgsql/statement-cache.txx | |
parent | b5ed13549a87dccb56f756d6fbc5f7bf537e9640 (diff) |
Support for versioning simple value in object
Diffstat (limited to 'odb/pgsql/statement-cache.txx')
-rw-r--r-- | odb/pgsql/statement-cache.txx | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/odb/pgsql/statement-cache.txx b/odb/pgsql/statement-cache.txx index 1a35d38..48bc9da 100644 --- a/odb/pgsql/statement-cache.txx +++ b/odb/pgsql/statement-cache.txx @@ -15,6 +15,16 @@ namespace odb typename object_traits_impl<T, id_pgsql>::statements_type statements_type; + // Clear the cache if the database version has changed. This + // makes sure we don't re-use statements that correspond to + // the old schema. + // + if (version_seq_ != conn_.database ().schema_version_sequence ()) + { + map_.clear (); + version_seq_ = conn_.database ().schema_version_sequence (); + } + map::iterator i (map_.find (&typeid (T))); if (i != map_.end ()) @@ -31,6 +41,9 @@ namespace odb view_statements<T>& statement_cache:: find_view () { + // We don't cache any statements for views so no need to clear + // the cache. + map::iterator i (map_.find (&typeid (T))); if (i != map_.end ()) |