database.txx | database.txx | |||
---|---|---|---|---|
skipping to change at line 118 | skipping to change at line 118 | |||
return view_traits<T>::query (db, q); | return view_traits<T>::query (db, q); | |||
} | } | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
result<T> database:: | result<T> database:: | |||
query (const odb::query<T>& q, bool cache) | query (const odb::query<T>& q, bool cache) | |||
{ | { | |||
// T is always object_type. | // T is always object_type. | |||
// | // | |||
if (!transaction::has_current ()) | ||||
throw not_in_transaction (); | // We don't need to check for transaction here; | |||
// object_traits::query () does this. | ||||
result<T> r (query_<T, class_traits<T>::kind>::call (*this, q)); | result<T> r (query_<T, class_traits<T>::kind>::call (*this, q)); | |||
if (cache) | if (cache) | |||
r.cache (); | r.cache (); | |||
return r; | return r; | |||
} | } | |||
} | } | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
lazy-pointer-traits.hxx | lazy-pointer-traits.hxx | |||
---|---|---|---|---|
skipping to change at line 37 | skipping to change at line 37 | |||
static bool | static bool | |||
null_ptr (const pointer_type& p) | null_ptr (const pointer_type& p) | |||
{ | { | |||
return !p; | return !p; | |||
} | } | |||
template <class O /* = T */> | template <class O /* = T */> | |||
static typename object_traits<O>::id_type | static typename object_traits<O>::id_type | |||
object_id (const pointer_type& p) | object_id (const pointer_type& p) | |||
{ | { | |||
return p.object_id<O> (); | return p.template object_id<O> (); | |||
} | } | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
class pointer_traits< lazy_auto_ptr<T> > | class pointer_traits< lazy_auto_ptr<T> > | |||
{ | { | |||
public: | public: | |||
static const pointer_kind kind = pk_unique; | static const pointer_kind kind = pk_unique; | |||
static const bool lazy = true; | static const bool lazy = true; | |||
skipping to change at line 62 | skipping to change at line 62 | |||
static bool | static bool | |||
null_ptr (const pointer_type& p) | null_ptr (const pointer_type& p) | |||
{ | { | |||
return !p; | return !p; | |||
} | } | |||
template <class O /* = T */> | template <class O /* = T */> | |||
static typename object_traits<O>::id_type | static typename object_traits<O>::id_type | |||
object_id (const pointer_type& p) | object_id (const pointer_type& p) | |||
{ | { | |||
return p.object_id<O> (); | return p.template object_id<O> (); | |||
} | } | |||
}; | }; | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
template <typename T, typename D> | template <typename T, typename D> | |||
class pointer_traits<lazy_unique_ptr<T, D>> | class pointer_traits<lazy_unique_ptr<T, D>> | |||
{ | { | |||
public: | public: | |||
static const pointer_kind kind = pk_unique; | static const pointer_kind kind = pk_unique; | |||
static const bool lazy = true; | static const bool lazy = true; | |||
skipping to change at line 88 | skipping to change at line 88 | |||
static bool | static bool | |||
null_ptr (const pointer_type& p) | null_ptr (const pointer_type& p) | |||
{ | { | |||
return !p; | return !p; | |||
} | } | |||
template <class O /* = T */> | template <class O /* = T */> | |||
static typename object_traits<O>::id_type | static typename object_traits<O>::id_type | |||
object_id (const pointer_type& p) | object_id (const pointer_type& p) | |||
{ | { | |||
return p.object_id<O> (); | return p.template object_id<O> (); | |||
} | } | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
class pointer_traits<lazy_shared_ptr<T>> | class pointer_traits<lazy_shared_ptr<T>> | |||
{ | { | |||
public: | public: | |||
static const pointer_kind kind = pk_shared; | static const pointer_kind kind = pk_shared; | |||
static const bool lazy = true; | static const bool lazy = true; | |||
skipping to change at line 113 | skipping to change at line 113 | |||
static bool | static bool | |||
null_ptr (const pointer_type& p) | null_ptr (const pointer_type& p) | |||
{ | { | |||
return !p; | return !p; | |||
} | } | |||
template <class O /* = T */> | template <class O /* = T */> | |||
static typename object_traits<O>::id_type | static typename object_traits<O>::id_type | |||
object_id (const pointer_type& p) | object_id (const pointer_type& p) | |||
{ | { | |||
return p.object_id<O> (); | return p.template object_id<O> (); | |||
} | } | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
class pointer_traits<lazy_weak_ptr<T>> | class pointer_traits<lazy_weak_ptr<T>> | |||
{ | { | |||
public: | public: | |||
static const pointer_kind kind = pk_weak; | static const pointer_kind kind = pk_weak; | |||
static const bool lazy = true; | static const bool lazy = true; | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
lazy-ptr.ixx | lazy-ptr.ixx | |||
---|---|---|---|---|
skipping to change at line 183 | skipping to change at line 183 | |||
i_.reset (); | i_.reset (); | |||
} | } | |||
template <class T> | template <class T> | |||
template <class O> | template <class O> | |||
inline typename object_traits<O>::id_type lazy_ptr<T>:: | inline typename object_traits<O>::id_type lazy_ptr<T>:: | |||
object_id () const | object_id () const | |||
{ | { | |||
typedef typename object_traits<T>::object_type object_type; | typedef typename object_traits<T>::object_type object_type; | |||
return p_ ? object_traits<object_type>::id (*p_) : i_.object_id<O> (); | return p_ | |||
? object_traits<object_type>::id (*p_) | ||||
: i_.template object_id<O> (); | ||||
} | } | |||
template <class T> | template <class T> | |||
inline typename lazy_ptr<T>::database_type& lazy_ptr<T>:: | inline typename lazy_ptr<T>::database_type& lazy_ptr<T>:: | |||
database () const | database () const | |||
{ | { | |||
return *i_.database (); | return *i_.database (); | |||
} | } | |||
template <class T, class Y> | template <class T, class Y> | |||
skipping to change at line 463 | skipping to change at line 465 | |||
template <class T> | template <class T> | |||
template <class O> | template <class O> | |||
inline typename object_traits<O>::id_type lazy_auto_ptr<T>:: | inline typename object_traits<O>::id_type lazy_auto_ptr<T>:: | |||
object_id () const | object_id () const | |||
{ | { | |||
typedef typename object_traits<T>::object_type object_type; | typedef typename object_traits<T>::object_type object_type; | |||
return p_.get () != 0 | return p_.get () != 0 | |||
? object_traits<object_type>::id (*p_) | ? object_traits<object_type>::id (*p_) | |||
: i_.object_id<O> (); | : i_.template object_id<O> (); | |||
} | } | |||
template <class T> | template <class T> | |||
inline typename lazy_auto_ptr<T>::database_type& lazy_auto_ptr<T>:: | inline typename lazy_auto_ptr<T>::database_type& lazy_auto_ptr<T>:: | |||
database () const | database () const | |||
{ | { | |||
return *i_.database (); | return *i_.database (); | |||
} | } | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
skipping to change at line 771 | skipping to change at line 773 | |||
i_.reset (); | i_.reset (); | |||
} | } | |||
template <class T, class D> | template <class T, class D> | |||
template <class O> | template <class O> | |||
inline typename object_traits<O>::id_type lazy_unique_ptr<T, D>:: | inline typename object_traits<O>::id_type lazy_unique_ptr<T, D>:: | |||
object_id () const | object_id () const | |||
{ | { | |||
typedef typename object_traits<T>::object_type object_type; | typedef typename object_traits<T>::object_type object_type; | |||
return p_ ? object_traits<object_type>::id (*p_) : i_.object_id<O> (); | return p_ | |||
? object_traits<object_type>::id (*p_) | ||||
: i_.template object_id<O> (); | ||||
} | } | |||
template <class T, class D> | template <class T, class D> | |||
inline typename lazy_unique_ptr<T, D>::database_type& lazy_unique_ptr<T, D>:: | inline typename lazy_unique_ptr<T, D>::database_type& lazy_unique_ptr<T, D>:: | |||
database () const | database () const | |||
{ | { | |||
return *i_.database (); | return *i_.database (); | |||
} | } | |||
template <class T> | template <class T> | |||
skipping to change at line 1311 | skipping to change at line 1315 | |||
i_.reset (); | i_.reset (); | |||
} | } | |||
template <class T> | template <class T> | |||
template <class O> | template <class O> | |||
inline typename object_traits<O>::id_type lazy_shared_ptr<T>:: | inline typename object_traits<O>::id_type lazy_shared_ptr<T>:: | |||
object_id () const | object_id () const | |||
{ | { | |||
typedef typename object_traits<T>::object_type object_type; | typedef typename object_traits<T>::object_type object_type; | |||
return p_ ? object_traits<object_type>::id (*p_) : i_.object_id<O> (); | return p_ | |||
? object_traits<object_type>::id (*p_) | ||||
: i_.template object_id<O> (); | ||||
} | } | |||
template <class T> | template <class T> | |||
inline typename lazy_shared_ptr<T>::database_type& lazy_shared_ptr<T>:: | inline typename lazy_shared_ptr<T>::database_type& lazy_shared_ptr<T>:: | |||
database () const | database () const | |||
{ | { | |||
return *i_.database (); | return *i_.database (); | |||
} | } | |||
template <class T, class Y> | template <class T, class Y> | |||
skipping to change at line 1604 | skipping to change at line 1610 | |||
} | } | |||
template <class T> | template <class T> | |||
template <class O> | template <class O> | |||
inline typename object_traits<O>::id_type lazy_weak_ptr<T>:: | inline typename object_traits<O>::id_type lazy_weak_ptr<T>:: | |||
object_id () const | object_id () const | |||
{ | { | |||
typedef typename object_traits<T>::object_type object_type; | typedef typename object_traits<T>::object_type object_type; | |||
std::shared_ptr<T> sp (p_.lock ()); | std::shared_ptr<T> sp (p_.lock ()); | |||
return sp ? object_traits<object_type>::id (*sp) : i_.object_id<O> (); | return sp | |||
? object_traits<object_type>::id (*sp) | ||||
: i_.template object_id<O> (); | ||||
} | } | |||
template <class T> | template <class T> | |||
inline typename lazy_weak_ptr<T>::database_type& lazy_weak_ptr<T>:: | inline typename lazy_weak_ptr<T>::database_type& lazy_weak_ptr<T>:: | |||
database () const | database () const | |||
{ | { | |||
return *i_.database (); | return *i_.database (); | |||
} | } | |||
template <class T> | template <class T> | |||
End of changes. 5 change blocks. | ||||
5 lines changed or deleted | 13 lines changed or added | |||
lazy-ptr.txx | lazy-ptr.txx | |||
---|---|---|---|---|
skipping to change at line 39 | skipping to change at line 39 | |||
if (t1 || t2) | if (t1 || t2) | |||
return p_ == r.p_ && p_ != 0; | return p_ == r.p_ && p_ != 0; | |||
// If both objects are persistent, then we compare databases and | // If both objects are persistent, then we compare databases and | |||
// object ids. | // object ids. | |||
// | // | |||
typedef typename object_traits<T>::object_type object_type1; | typedef typename object_traits<T>::object_type object_type1; | |||
typedef typename object_traits<Y>::object_type object_type2; | typedef typename object_traits<Y>::object_type object_type2; | |||
return i_.database () == r.i_.database () && | return i_.database () == r.i_.database () && | |||
object_id<object_type1> () == r.object_id<object_type2> (); | object_id<object_type1> () == r.template object_id<object_type2> (); | |||
} | } | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
// | // | |||
// lazy_unique_ptr | // lazy_unique_ptr | |||
// | // | |||
template <class T, class D> | template <class T, class D> | |||
template <class T1, class D1> | template <class T1, class D1> | |||
skipping to change at line 76 | skipping to change at line 76 | |||
if (t1 || t2) | if (t1 || t2) | |||
return p_ == r.p_ && p_; | return p_ == r.p_ && p_; | |||
// If both objects are persistent, then we compare databases and | // If both objects are persistent, then we compare databases and | |||
// object ids. | // object ids. | |||
// | // | |||
typedef typename object_traits<T>::object_type object_type1; | typedef typename object_traits<T>::object_type object_type1; | |||
typedef typename object_traits<T1>::object_type object_type2; | typedef typename object_traits<T1>::object_type object_type2; | |||
return i_.database () == r.i_.database () && | return i_.database () == r.i_.database () && | |||
object_id<object_type1> () == r.object_id<object_type2> (); | object_id<object_type1> () == r.template object_id<object_type2> (); | |||
} | } | |||
// | // | |||
// lazy_shared_ptr | // lazy_shared_ptr | |||
// | // | |||
template <class T> | template <class T> | |||
template <class Y> | template <class Y> | |||
bool lazy_shared_ptr<T>:: | bool lazy_shared_ptr<T>:: | |||
equal (const lazy_shared_ptr<Y>& r) const | equal (const lazy_shared_ptr<Y>& r) const | |||
skipping to change at line 111 | skipping to change at line 111 | |||
if (t1 || t2) | if (t1 || t2) | |||
return p_ == r.p_ && p_; | return p_ == r.p_ && p_; | |||
// If both objects are persistent, then we compare databases and | // If both objects are persistent, then we compare databases and | |||
// object ids. | // object ids. | |||
// | // | |||
typedef typename object_traits<T>::object_type object_type1; | typedef typename object_traits<T>::object_type object_type1; | |||
typedef typename object_traits<Y>::object_type object_type2; | typedef typename object_traits<Y>::object_type object_type2; | |||
return i_.database () == r.i_.database () && | return i_.database () == r.i_.database () && | |||
object_id<object_type1> () == r.object_id<object_type2> (); | object_id<object_type1> () == r.template object_id<object_type2> (); | |||
} | } | |||
// | // | |||
// lazy_weak_ptr | // lazy_weak_ptr | |||
// | // | |||
template <class T> | template <class T> | |||
lazy_shared_ptr<T> lazy_weak_ptr<T>:: | lazy_shared_ptr<T> lazy_weak_ptr<T>:: | |||
lock () const | lock () const | |||
{ | { | |||
skipping to change at line 134 | skipping to change at line 134 | |||
if (sp) | if (sp) | |||
{ | { | |||
if (database_type* db = i_.database ()) | if (database_type* db = i_.database ()) | |||
return lazy_shared_ptr<T> (*db, sp); | return lazy_shared_ptr<T> (*db, sp); | |||
else | else | |||
return lazy_shared_ptr<T> (sp); | return lazy_shared_ptr<T> (sp); | |||
} | } | |||
else | else | |||
{ | { | |||
if (i_) | if (i_) | |||
return lazy_shared_ptr<T> (*i_.database (), i_.object_id<T> ()); | return lazy_shared_ptr<T> ( | |||
*i_.database (), i_.template object_id<T> ()); | ||||
else | else | |||
return lazy_shared_ptr<T> (); | return lazy_shared_ptr<T> (); | |||
} | } | |||
} | } | |||
#endif // ODB_CXX11 | #endif // ODB_CXX11 | |||
} | } | |||
End of changes. 4 change blocks. | ||||
4 lines changed or deleted | 5 lines changed or added | |||
query.hxx | query.hxx | |||
---|---|---|---|---|
skipping to change at line 66 | skipping to change at line 66 | |||
// we have to use the impl trick below instead of simply having kind | // we have to use the impl trick below instead of simply having kind | |||
// as a second template argument with a default value. | // as a second template argument with a default value. | |||
// | // | |||
template <typename T, class_kind kind> | template <typename T, class_kind kind> | |||
struct query_selector_impl; | struct query_selector_impl; | |||
template <typename T> | template <typename T> | |||
struct query_selector_impl<T, class_object> | struct query_selector_impl<T, class_object> | |||
{ | { | |||
typedef typename object_traits<T>::query_base_type base_type; | typedef typename object_traits<T>::query_base_type base_type; | |||
typedef typename object_traits<T>::query_type type; | typedef query_columns<T, access::object_traits<T> > columns_type; | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
struct query_selector_impl<T, class_view> | struct query_selector_impl<T, class_view> | |||
{ | { | |||
typedef typename view_traits<T>::query_base_type base_type; | typedef typename view_traits<T>::query_base_type base_type; | |||
typedef typename view_traits<T>::query_type type; | typedef typename view_traits<T>::query_columns columns_type; | |||
}; | }; | |||
template <typename T> | template <typename T> | |||
struct query_selector: query_selector_impl<T, class_traits<T>::kind> | struct query_selector: query_selector_impl<T, class_traits<T>::kind> | |||
{ | { | |||
}; | }; | |||
template <typename T, typename Q = typename query_selector<T>::base_type> | template <typename T, typename Q = typename query_selector<T>::base_type> | |||
class query; | class query; | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
session.hxx | session.hxx | |||
---|---|---|---|---|
skipping to change at line 28 | skipping to change at line 28 | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
class LIBODB_EXPORT session | class LIBODB_EXPORT session | |||
{ | { | |||
public: | public: | |||
typedef odb::database database_type; | typedef odb::database database_type; | |||
// Set the current thread's session to this session. If another | // If the make_current argument is true, then set the current thread's | |||
// session is already in effect, throw the already_in_session | // session to this session. If another session is already in effect, | |||
// exception. | // throw the already_in_session exception. | |||
// | // | |||
session (); | session (bool make_current = true); | |||
// Reset the current thread's session if it is this session. | // Reset the current thread's session if it is this session. | |||
// | // | |||
~session (); | ~session (); | |||
// Current session. | // Current session. | |||
// | // | |||
public: | public: | |||
// Return true if there is a session in effect in the current | // Return true if there is a session in effect in the current | |||
// thread. | // thread. | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||
session.txx | session.txx | |||
---|---|---|---|---|
skipping to change at line 16 | skipping to change at line 16 | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T> | template <typename T> | |||
typename session::object_position<T> session:: | typename session::object_position<T> session:: | |||
insert (database_type& db, | insert (database_type& db, | |||
const typename object_traits<T>::id_type& id, | const typename object_traits<T>::id_type& id, | |||
const typename object_traits<T>::pointer_type& obj) | const typename object_traits<T>::pointer_type& obj) | |||
{ | { | |||
typedef odb::object_traits<T> object_traits; | typedef odb::object_traits<T> object_traits; | |||
typedef typename object_traits::pointer_type pointer_type; | ||||
typedef odb::pointer_traits<pointer_type> pointer_traits; | ||||
type_map& tm (db_map_[&db]); | type_map& tm (db_map_[&db]); | |||
details::shared_ptr<object_map_base>& pom (tm[&typeid (T)]); | details::shared_ptr<object_map_base>& pom (tm[&typeid (T)]); | |||
if (!pom) | if (!pom) | |||
pom.reset (new (details::shared) object_map<T>); | pom.reset (new (details::shared) object_map<T>); | |||
object_map<T>& om (static_cast<object_map<T>&> (*pom)); | object_map<T>& om (static_cast<object_map<T>&> (*pom)); | |||
typename object_map<T>::value_type vt (id, obj); | typename object_map<T>::value_type vt (id, obj); | |||
End of changes. 1 change blocks. | ||||
2 lines changed or deleted | 0 lines changed or added | |||
version.hxx | version.hxx | |||
---|---|---|---|---|
skipping to change at line 29 | skipping to change at line 29 | |||
// Version AABBCCDD | // Version AABBCCDD | |||
// 2.0.0 02000000 | // 2.0.0 02000000 | |||
// 2.1.0 02010000 | // 2.1.0 02010000 | |||
// 2.1.1 02010100 | // 2.1.1 02010100 | |||
// 2.2.0.a1 02019901 | // 2.2.0.a1 02019901 | |||
// 3.0.0.b2 02999952 | // 3.0.0.b2 02999952 | |||
// | // | |||
// ODB interface version: minor, major, and alpha/beta versions. | // ODB interface version: minor, major, and alpha/beta versions. | |||
// | // | |||
#define ODB_VERSION 20000 | #define ODB_VERSION 20100 | |||
#define ODB_VERSION_STR "2.0" | #define ODB_VERSION_STR "2.1" | |||
// libodb version: interface version plus the bugfix version. | // libodb version: interface version plus the bugfix version. | |||
// | // | |||
#define LIBODB_VERSION 2000100 | #define LIBODB_VERSION 2010000 | |||
#define LIBODB_VERSION_STR "2.0.1" | #define LIBODB_VERSION_STR "2.1.0" | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#endif // ODB_VERSION_HXX | #endif // ODB_VERSION_HXX | |||
End of changes. 2 change blocks. | ||||
4 lines changed or deleted | 4 lines changed or added | |||