diff options
Diffstat (limited to 'odb/database.txx')
-rw-r--r-- | odb/database.txx | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/odb/database.txx b/odb/database.txx index f5449b6..a94f471 100644 --- a/odb/database.txx +++ b/odb/database.txx @@ -10,6 +10,19 @@ namespace odb { template <typename T> typename object_traits<T>::id_type database:: + persist (const T& obj) + { + typedef object_traits<T> traits; + + if (!transaction::has_current ()) + throw not_in_transaction (); + + traits::persist (*this, obj); + return traits::id (obj); + } + + template <typename T> + typename object_traits<T>::id_type database:: persist (T& obj) { typedef object_traits<T> traits; @@ -64,7 +77,7 @@ namespace odb template <typename T> void database:: - update (T& obj) + update (const T& obj) { if (!transaction::has_current ()) throw not_in_transaction (); |