answer.hxx | answer.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/answer.hxx | // file : odb/details/meta/answer.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_ANSWER_HXX | #ifndef ODB_DETAILS_META_ANSWER_HXX | |||
#define ODB_DETAILS_META_ANSWER_HXX | #define ODB_DETAILS_META_ANSWER_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
base.hxx | base.hxx | |||
---|---|---|---|---|
// file : odb/details/shared-ptr/base.hxx | // file : odb/details/shared-ptr/base.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_SHARED_PTR_BASE_HXX | #ifndef ODB_DETAILS_SHARED_PTR_BASE_HXX | |||
#define ODB_DETAILS_SHARED_PTR_BASE_HXX | #define ODB_DETAILS_SHARED_PTR_BASE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <new> | #include <new> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <odb/exception.hxx> | ||||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
#include <odb/details/shared-ptr/counter-type.hxx> | #include <odb/details/shared-ptr/counter-type.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
struct LIBODB_EXPORT share | struct LIBODB_EXPORT share | |||
{ | { | |||
explicit | explicit | |||
skipping to change at line 48 | skipping to change at line 47 | |||
LIBODB_EXPORT void* | LIBODB_EXPORT void* | |||
operator new (std::size_t, odb::details::share) throw (std::bad_alloc); | operator new (std::size_t, odb::details::share) throw (std::bad_alloc); | |||
LIBODB_EXPORT void | LIBODB_EXPORT void | |||
operator delete (void*, odb::details::share) throw (); | operator delete (void*, odb::details::share) throw (); | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
struct LIBODB_EXPORT not_shared: exception | ||||
{ | ||||
virtual const char* | ||||
what () const throw (); | ||||
}; | ||||
class LIBODB_EXPORT shared_base | class LIBODB_EXPORT shared_base | |||
{ | { | |||
public: | public: | |||
shared_base (); | shared_base (); | |||
shared_base (const shared_base&); | shared_base (const shared_base&); | |||
shared_base& | shared_base& | |||
operator= (const shared_base&); | operator= (const shared_base&); | |||
void | void | |||
_inc_ref (); | _inc_ref (); | |||
bool | bool | |||
_dec_ref (); | _dec_ref (); | |||
std::size_t | std::size_t | |||
_ref_count () const; | _ref_count () const; | |||
void* | void* | |||
operator new (std::size_t) throw (std::bad_alloc); | ||||
void* | ||||
operator new (std::size_t, share) throw (std::bad_alloc); | operator new (std::size_t, share) throw (std::bad_alloc); | |||
void | void | |||
operator delete (void*, share) throw (); | operator delete (void*, share) throw (); | |||
void | void | |||
operator delete (void*) throw (); | operator delete (void*) throw (); | |||
struct refcount_callback | struct refcount_callback | |||
{ | { | |||
End of changes. 4 change blocks. | ||||
8 lines changed or deleted | 4 lines changed or added | |||
base.ixx | base.ixx | |||
---|---|---|---|---|
// file : odb/details/shared-ptr/base.ixx | // file : odb/details/shared-ptr/base.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
// share | // share | |||
// | // | |||
inline share:: | inline share:: | |||
skipping to change at line 67 | skipping to change at line 67 | |||
return _dec_ref_callback (); | return _dec_ref_callback (); | |||
} | } | |||
inline std::size_t shared_base:: | inline std::size_t shared_base:: | |||
_ref_count () const | _ref_count () const | |||
{ | { | |||
return counter_; | return counter_; | |||
} | } | |||
inline void* shared_base:: | inline void* shared_base:: | |||
operator new (std::size_t n) throw (std::bad_alloc) | ||||
{ | ||||
return ::operator new (n); | ||||
} | ||||
inline void* shared_base:: | ||||
operator new (std::size_t n, share) throw (std::bad_alloc) | operator new (std::size_t n, share) throw (std::bad_alloc) | |||
{ | { | |||
return ::operator new (n); | return ::operator new (n); | |||
} | } | |||
inline void shared_base:: | inline void shared_base:: | |||
operator delete (void* p, share) throw () | operator delete (void* p, share) throw () | |||
{ | { | |||
::operator delete (p); | ::operator delete (p); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 7 lines changed or added | |||
base.txx | base.txx | |||
---|---|---|---|---|
// file : odb/details/shared-ptr/base.txx | // file : odb/details/shared-ptr/base.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/details/meta/answer.hxx> | #include <odb/details/meta/answer.hxx> | |||
#include <odb/details/meta/polymorphic-p.hxx> | #include <odb/details/meta/polymorphic-p.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
namespace bits | namespace bits | |||
{ | { | |||
// Support for locating the counter in the memory block. | // Support for locating the counter in the memory block. | |||
// | // | |||
struct LIBODB_EXPORT locator_common | ||||
{ | ||||
static std::size_t* | ||||
counter (void*); | ||||
}; | ||||
template <typename X, bool poly = meta::polymorphic_p<X>::result> | template <typename X, bool poly = meta::polymorphic_p<X>::result> | |||
struct locator; | struct locator; | |||
template <typename X> | template <typename X> | |||
struct locator<X, false> | struct locator<X, false>: locator_common | |||
{ | { | |||
static std::size_t* | static std::size_t* | |||
counter (X* x) | counter (X* x) | |||
{ | { | |||
std::size_t* p (reinterpret_cast<std::size_t*> (x)); | return locator_common::counter (x); | |||
if (*(--p) != 0xDEADBEEF) | ||||
throw not_shared (); | ||||
return --p; | ||||
} | } | |||
}; | }; | |||
template <typename X> | template <typename X> | |||
struct locator<X, true> | struct locator<X, true>: locator_common | |||
{ | { | |||
static std::size_t* | static std::size_t* | |||
counter (X* x) | counter (X* x) | |||
{ | { | |||
std::size_t* p ( | return locator_common::counter (dynamic_cast<void*> (x)); | |||
static_cast<std::size_t*> ( | ||||
dynamic_cast<void*> (x))); | ||||
if (*(--p) != 0xDEADBEEF) | ||||
throw not_shared (); | ||||
return --p; | ||||
} | } | |||
}; | }; | |||
template <typename X> | template <typename X> | |||
std::size_t* | std::size_t* | |||
counter (const X* p) | counter (const X* p) | |||
{ | { | |||
return bits::locator<X>::counter (const_cast<X*> (p)); | return bits::locator<X>::counter (const_cast<X*> (p)); | |||
} | } | |||
End of changes. 6 change blocks. | ||||
17 lines changed or deleted | 11 lines changed or added | |||
buffer.hxx | buffer.hxx | |||
---|---|---|---|---|
// file : odb/details/buffer.hxx | // file : odb/details/buffer.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_BUFFER_DETAILS_HXX | #ifndef ODB_BUFFER_DETAILS_HXX | |||
#define ODB_BUFFER_DETAILS_HXX | #define ODB_BUFFER_DETAILS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <new> | #include <new> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
c-string.hxx | c-string.hxx | |||
---|---|---|---|---|
// file : odb/details/c-string.hxx | // file : odb/details/c-string.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_C_STRING_HXX | #ifndef ODB_DETAILS_C_STRING_HXX | |||
#define ODB_DETAILS_C_STRING_HXX | #define ODB_DETAILS_C_STRING_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstring> | #include <cstring> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
cache-traits.hxx | cache-traits.hxx | |||
---|---|---|---|---|
// file : odb/cache-traits.hxx | // file : odb/cache-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_CACHE_TRAITS_HXX | #ifndef ODB_CACHE_TRAITS_HXX | |||
#define ODB_CACHE_TRAITS_HXX | #define ODB_CACHE_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/traits.hxx> | #include <odb/traits.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/session.hxx> | #include <odb/session.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
callback.hxx | callback.hxx | |||
---|---|---|---|---|
// file : odb/callback.hxx | // file : odb/callback.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_CALLBACK_HXX | #ifndef ODB_CALLBACK_HXX | |||
#define ODB_CALLBACK_HXX | #define ODB_CALLBACK_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> // odb::core | #include <odb/forward.hxx> // odb::core | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
class-p.hxx | class-p.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/class-p.hxx | // file : odb/details/meta/class-p.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_CLASS_HXX | #ifndef ODB_DETAILS_META_CLASS_HXX | |||
#define ODB_DETAILS_META_CLASS_HXX | #define ODB_DETAILS_META_CLASS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/meta/answer.hxx> | #include <odb/details/meta/answer.hxx> | |||
namespace odb | namespace odb | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
condition.hxx | condition.hxx | |||
---|---|---|---|---|
// file : odb/details/condition.hxx | // file : odb/details/condition.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_CONDITION_HXX | #ifndef ODB_DETAILS_CONDITION_HXX | |||
#define ODB_DETAILS_CONDITION_HXX | #define ODB_DETAILS_CONDITION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> | #include <odb/details/config.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
condition.ixx | condition.ixx | |||
---|---|---|---|---|
// file : odb/details/posix/condition.ixx | // file : odb/details/posix/condition.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/details/posix/exceptions.hxx> | #include <odb/details/posix/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
inline condition:: | inline condition:: | |||
~condition () | ~condition () | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
config.h | config.h | |||
---|---|---|---|---|
/* odb/details/config.h. Generated from config.h.in by configure. */ | /* odb/details/config.h. Generated from config.h.in by configure. */ | |||
/* file : odb/details/config.h.in | /* file : odb/details/config.h.in | |||
* copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | * copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
* license : GNU GPL v2; see accompanying LICENSE file | * license : GNU GPL v2; see accompanying LICENSE file | |||
*/ | */ | |||
/* This file is automatically processed by configure. */ | /* This file is automatically processed by configure. */ | |||
#ifndef ODB_DETAILS_CONFIG_H | #ifndef ODB_DETAILS_CONFIG_H | |||
#define ODB_DETAILS_CONFIG_H | #define ODB_DETAILS_CONFIG_H | |||
/* #undef ODB_THREADS_NONE */ | /* #undef ODB_THREADS_NONE */ | |||
#define ODB_THREADS_POSIX 1 | #define ODB_THREADS_POSIX 1 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
config.hxx | config.hxx | |||
---|---|---|---|---|
// file : odb/details/config.hxx | // file : odb/details/config.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_CONFIG_HXX | #ifndef ODB_DETAILS_CONFIG_HXX | |||
#define ODB_DETAILS_CONFIG_HXX | #define ODB_DETAILS_CONFIG_HXX | |||
// no pre | // no pre | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# include <odb/details/config-vc.h> | # include <odb/details/config-vc.h> | |||
#elif defined(ODB_COMPILER) | #elif defined(ODB_COMPILER) | |||
# define ODB_THREADS_NONE | # define ODB_THREADS_NONE | |||
# define LIBODB_STATIC_LIB | # define LIBODB_STATIC_LIB | |||
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | |||
# define ODB_CXX11 | # define ODB_CXX11 | |||
# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 | # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 | |||
# define ODB_CXX_NULLPTR | # define ODB_CXX11_NULLPTR | |||
# endif | # endif | |||
# define ODB_CXX11_DELETED_FUNCTION | # define ODB_CXX11_DELETED_FUNCTION | |||
# define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR | # define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR | |||
# define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT | # define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT | |||
# define ODB_CXX11_VARIADIC_TEMPLATE | # define ODB_CXX11_VARIADIC_TEMPLATE | |||
# define ODB_CXX11_INITIALIZER_LIST | # define ODB_CXX11_INITIALIZER_LIST | |||
# endif | # endif | |||
#else | #else | |||
# include <odb/details/config.h> | # include <odb/details/config.h> | |||
# if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | # if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L | |||
# define ODB_CXX11 | # define ODB_CXX11 | |||
# ifdef __GNUC__ | # ifdef __GNUC__ | |||
# if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6 | # if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4 | |||
# define ODB_CXX_NULLPTR | # define ODB_CXX11_NULLPTR | |||
# endif | # endif | |||
# else | # else | |||
# define ODB_CXX_NULLPTR | # define ODB_CXX11_NULLPTR | |||
# endif | # endif | |||
# define ODB_CXX11_DELETED_FUNCTION | # define ODB_CXX11_DELETED_FUNCTION | |||
# define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR | # define ODB_CXX11_EXPLICIT_CONVERSION_OPERATOR | |||
# define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT | # define ODB_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGUMENT | |||
# define ODB_CXX11_VARIADIC_TEMPLATE | # define ODB_CXX11_VARIADIC_TEMPLATE | |||
# define ODB_CXX11_INITIALIZER_LIST | # define ODB_CXX11_INITIALIZER_LIST | |||
// GCC supports strongly typed enums from 4.4 (forward -- 4.6), | // GCC supports strongly typed enums from 4.4 (forward -- 4.6), | |||
// Clang -- 2.9 (3.1). | // Clang -- 2.9 (3.1). | |||
// | // | |||
# define ODB_CXX11_ENUM | # define ODB_CXX11_ENUM | |||
End of changes. 4 change blocks. | ||||
6 lines changed or deleted | 6 lines changed or added | |||
connection.hxx | connection.hxx | |||
---|---|---|---|---|
// file : odb/connection.hxx | // file : odb/connection.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_CONNECTION_HXX | #ifndef ODB_CONNECTION_HXX | |||
#define ODB_CONNECTION_HXX | #define ODB_CONNECTION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include <memory> // std::auto_ptr, std::unique_ptr | #include <memory> // std::auto_ptr, std::unique_ptr | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
connection.ixx | connection.ixx | |||
---|---|---|---|---|
// file : odb/connection.ixx | // file : odb/connection.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <cstring> // std::string | #include <cstring> // std::string | |||
#include <cassert> | #include <cassert> | |||
namespace odb | namespace odb | |||
{ | { | |||
inline connection:: | inline connection:: | |||
connection (database_type& database) | connection (database_type& database) | |||
: database_ (database), | : database_ (database), | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
connection.txx | connection.txx | |||
---|---|---|---|---|
// file : odb/connection.txx | // file : odb/connection.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
struct connection::query_<T, DB, class_object> | struct connection::query_<T, DB, class_object> | |||
{ | { | |||
template <typename Q> | template <typename Q> | |||
static prepared_query<T> | static prepared_query<T> | |||
call (connection& c, const char* n, const Q& q) | call (connection& c, const char* n, const Q& q) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
container-traits.hxx | container-traits.hxx | |||
---|---|---|---|---|
// file : odb/container-traits.hxx | // file : odb/container-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_CONTAINER_TRAITS_HXX | #ifndef ODB_CONTAINER_TRAITS_HXX | |||
#define ODB_CONTAINER_TRAITS_HXX | #define ODB_CONTAINER_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
skipping to change at line 211 | skipping to change at line 211 | |||
void (*delete__) (void*); | void (*delete__) (void*); | |||
}; | }; | |||
} | } | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#include <odb/std-map-traits.hxx> | #include <odb/std-map-traits.hxx> | |||
#include <odb/std-set-traits.hxx> | #include <odb/std-set-traits.hxx> | |||
#include <odb/std-list-traits.hxx> | #include <odb/std-list-traits.hxx> | |||
#include <odb/std-vector-traits.hxx> | #include <odb/std-vector-traits.hxx> | |||
#include <odb/std-deque-traits.hxx> | ||||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
# include <odb/std-array-traits.hxx> | # include <odb/std-array-traits.hxx> | |||
# include <odb/std-forward-list-traits.hxx> | # include <odb/std-forward-list-traits.hxx> | |||
# include <odb/std-unordered-map-traits.hxx> | # include <odb/std-unordered-map-traits.hxx> | |||
# include <odb/std-unordered-set-traits.hxx> | # include <odb/std-unordered-set-traits.hxx> | |||
#endif | #endif | |||
#endif // ODB_CONTAINER_TRAITS_HXX | #endif // ODB_CONTAINER_TRAITS_HXX | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added | |||
core.hxx | core.hxx | |||
---|---|---|---|---|
// file : odb/core.hxx | // file : odb/core.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_CORE_HXX | #ifndef ODB_CORE_HXX | |||
#define ODB_CORE_HXX | #define ODB_CORE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#ifdef ODB_COMPILER | #ifdef ODB_COMPILER | |||
# define PRAGMA_DB_IMPL(x) _Pragma (#x) | # define PRAGMA_DB_IMPL(x) _Pragma (#x) | |||
# define PRAGMA_DB(x) PRAGMA_DB_IMPL (db x) | # define PRAGMA_DB(x) PRAGMA_DB_IMPL (db x) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
counter-type.hxx | counter-type.hxx | |||
---|---|---|---|---|
// file : odb/details/shared-ptr/counter-type.hxx | // file : odb/details/shared-ptr/counter-type.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_SHARED_PTR_COUNTER_TYPE_HXX | #ifndef ODB_DETAILS_SHARED_PTR_COUNTER_TYPE_HXX | |||
#define ODB_DETAILS_SHARED_PTR_COUNTER_TYPE_HXX | #define ODB_DETAILS_SHARED_PTR_COUNTER_TYPE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
database.hxx | database.hxx | |||
---|---|---|---|---|
// file : odb/database.hxx | // file : odb/database.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DATABASE_HXX | #ifndef ODB_DATABASE_HXX | |||
#define ODB_DATABASE_HXX | #define ODB_DATABASE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
#include <map> | #include <map> | |||
#include <string> | #include <string> | |||
#include <memory> // std::auto_ptr, std::unique_ptr | #include <memory> // std::auto_ptr, std::unique_ptr | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
# include <functional> // std::function | # include <utility> // std::move | |||
# include <functional> // std::function | ||||
# include <type_traits> // std::enable_if, std::is_convertible | ||||
#endif | #endif | |||
#include <odb/traits.hxx> | #include <odb/traits.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/schema-version.hxx> | #include <odb/schema-version.hxx> | |||
#include <odb/query.hxx> | #include <odb/query.hxx> | |||
#include <odb/prepared-query.hxx> | #include <odb/prepared-query.hxx> | |||
#include <odb/result.hxx> | #include <odb/result.hxx> | |||
#include <odb/connection.hxx> | #include <odb/connection.hxx> | |||
#include <odb/exceptions.hxx> | #include <odb/exceptions.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
#include <odb/details/mutex.hxx> | #include <odb/details/mutex.hxx> | |||
#include <odb/details/c-string.hxx> | #include <odb/details/c-string.hxx> | |||
#include <odb/details/function-wrapper.hxx> | ||||
#include <odb/details/meta/answer.hxx> | ||||
namespace odb | namespace odb | |||
{ | { | |||
class transaction_impl; | class transaction_impl; | |||
class LIBODB_EXPORT database | class LIBODB_EXPORT database | |||
{ | { | |||
public: | public: | |||
virtual | virtual | |||
~database (); | ~database (); | |||
// Object persistence API. | // Object persistence API. | |||
// | // | |||
public: | public: | |||
// Make the object persistent. | // Make the object persistent. | |||
// | // | |||
template <typename T> | template <typename T> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist (T& object); | persist (T& object); | |||
template <typename T> | template <typename T> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist (const T& object); | ||||
template <typename T> | ||||
typename object_traits<T>::id_type | ||||
persist (T* obj_ptr); | persist (T* obj_ptr); | |||
template <typename T, template <typename> class P> | template <typename T, template <typename> class P> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist (const P<T>& obj_ptr); | persist (const P<T>& obj_ptr); | |||
template <typename T, typename A1, template <typename, typename> class P> | template <typename T, typename A1, template <typename, typename> class P> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist (const P<T, A1>& obj_ptr); | persist (const P<T, A1>& obj_ptr); | |||
skipping to change at line 78 | skipping to change at line 85 | |||
persist (P<T>& obj_ptr); | persist (P<T>& obj_ptr); | |||
template <typename T, typename A1, template <typename, typename> class P> | template <typename T, typename A1, template <typename, typename> class P> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist (P<T, A1>& obj_ptr); | persist (P<T, A1>& obj_ptr); | |||
template <typename T> | template <typename T> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist (const typename object_traits<T>::pointer_type& obj_ptr); | persist (const typename object_traits<T>::pointer_type& obj_ptr); | |||
// Bulk persist. Can be a range of references or pointers (including | ||||
// smart pointers) to objects. | ||||
// | ||||
template <typename I> | ||||
void | ||||
persist (I begin, I end, bool continue_failed = true); | ||||
// Load an object. Throw object_not_persistent if not found. | // Load an object. Throw object_not_persistent if not found. | |||
// | // | |||
template <typename T> | template <typename T> | |||
typename object_traits<T>::pointer_type | typename object_traits<T>::pointer_type | |||
load (const typename object_traits<T>::id_type& id); | load (const typename object_traits<T>::id_type& id); | |||
template <typename T> | template <typename T> | |||
void | void | |||
load (const typename object_traits<T>::id_type& id, T& object); | load (const typename object_traits<T>::id_type& id, T& object); | |||
skipping to change at line 164 | skipping to change at line 178 | |||
update (P<T>& obj_ptr); | update (P<T>& obj_ptr); | |||
template <typename T, typename A1, template <typename, typename> class P> | template <typename T, typename A1, template <typename, typename> class P> | |||
void | void | |||
update (P<T, A1>& obj_ptr); | update (P<T, A1>& obj_ptr); | |||
template <typename T> | template <typename T> | |||
void | void | |||
update (const typename object_traits<T>::pointer_type& obj_ptr); | update (const typename object_traits<T>::pointer_type& obj_ptr); | |||
// Bulk update. Can be a range of references or pointers (including | ||||
// smart pointers) to objects. | ||||
// | ||||
template <typename I> | ||||
void | ||||
update (I begin, I end, bool continue_failed = true); | ||||
// Update a section of an object. Throws section_not_loaded exception | // Update a section of an object. Throws section_not_loaded exception | |||
// if section is not loaded. Note also that this function does not | // if section is not loaded. Note also that this function does not | |||
// clear the changed flag if it is set. | // clear the changed flag if it is set. | |||
// | // | |||
template <typename T> | template <typename T> | |||
void | void | |||
update (const T& object, const section&); | update (const T& object, const section&); | |||
// Make the object transient. Throw object_not_persistent if not | // Make the object transient. Throw object_not_persistent if not | |||
// found. | // found. | |||
skipping to change at line 207 | skipping to change at line 228 | |||
erase (P<T>& obj_ptr); | erase (P<T>& obj_ptr); | |||
template <typename T, typename A1, template <typename, typename> class P> | template <typename T, typename A1, template <typename, typename> class P> | |||
void | void | |||
erase (P<T, A1>& obj_ptr); | erase (P<T, A1>& obj_ptr); | |||
template <typename T> | template <typename T> | |||
void | void | |||
erase (const typename object_traits<T>::pointer_type& obj_ptr); | erase (const typename object_traits<T>::pointer_type& obj_ptr); | |||
// Bulk erase. | ||||
// | ||||
template <typename T, typename I> | ||||
void | ||||
erase (I id_begin, I id_end, bool continue_failed = true); | ||||
// Can be a range of references or pointers (including smart pointers) | ||||
// to objects. | ||||
// | ||||
template <typename I> | ||||
void | ||||
erase (I obj_begin, I obj_end, bool continue_failed = true); | ||||
// Erase multiple objects matching a query predicate. | // Erase multiple objects matching a query predicate. | |||
// | // | |||
template <typename T> | template <typename T> | |||
unsigned long long | unsigned long long | |||
erase_query (); | erase_query (); | |||
template <typename T> | template <typename T> | |||
unsigned long long | unsigned long long | |||
erase_query (const char*); | erase_query (const char*); | |||
skipping to change at line 243 | skipping to change at line 277 | |||
query (const char*, bool cache = true); | query (const char*, bool cache = true); | |||
template <typename T> | template <typename T> | |||
result<T> | result<T> | |||
query (const std::string&, bool cache = true); | query (const std::string&, bool cache = true); | |||
template <typename T> | template <typename T> | |||
result<T> | result<T> | |||
query (const odb::query<T>&, bool cache = true); | query (const odb::query<T>&, bool cache = true); | |||
// Query one API. | ||||
// | ||||
template <typename T> | ||||
typename object_traits<T>::pointer_type | ||||
query_one (); | ||||
template <typename T> | ||||
bool | ||||
query_one (T& object); | ||||
template <typename T> | ||||
T | ||||
query_value (); | ||||
template <typename T> | ||||
typename object_traits<T>::pointer_type | ||||
query_one (const char*); | ||||
template <typename T> | ||||
bool | ||||
query_one (const char*, T& object); | ||||
template <typename T> | ||||
T | ||||
query_value (const char*); | ||||
template <typename T> | ||||
typename object_traits<T>::pointer_type | ||||
query_one (const std::string&); | ||||
template <typename T> | ||||
bool | ||||
query_one (const std::string&, T& object); | ||||
template <typename T> | ||||
T | ||||
query_value (const std::string&); | ||||
template <typename T> | ||||
typename object_traits<T>::pointer_type | ||||
query_one (const odb::query<T>&); | ||||
template <typename T> | ||||
bool | ||||
query_one (const odb::query<T>&, T& object); | ||||
template <typename T> | ||||
T | ||||
query_value (const odb::query<T>&); | ||||
// Query preparation. | // Query preparation. | |||
// | // | |||
template <typename T> | template <typename T> | |||
prepared_query<T> | prepared_query<T> | |||
prepare_query (const char* name, const char*); | prepare_query (const char* name, const char*); | |||
template <typename T> | template <typename T> | |||
prepared_query<T> | prepared_query<T> | |||
prepare_query (const char* name, const std::string&); | prepare_query (const char* name, const std::string&); | |||
skipping to change at line 284 | skipping to change at line 368 | |||
template <typename T, typename P> | template <typename T, typename P> | |||
prepared_query<T> | prepared_query<T> | |||
lookup_query (const char* name, P*& params) const; | lookup_query (const char* name, P*& params) const; | |||
// Prepared query factory. | // Prepared query factory. | |||
// | // | |||
public: | public: | |||
typedef odb::connection connection_type; | typedef odb::connection connection_type; | |||
#ifdef ODB_CXX11 | typedef void query_factory_type (const char* name, connection_type&); | |||
typedef | typedef query_factory_type* query_factory_ptr; | |||
std::function<void (const char*, connection_type&)> | typedef details::function_wrapper< | |||
query_factory_type; | query_factory_type> query_factory_wrapper; | |||
#ifndef ODB_CXX11 | ||||
void | ||||
query_factory (const char* name, query_factory_ptr); | ||||
#else | #else | |||
typedef void (*query_factory_type) (const char*, connection_type&); | template <typename F> | |||
typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<query_factory_type>>::value, void>::type | ||||
query_factory (const char* name, F f) | ||||
{ | ||||
query_factory (name, query_factory_wrapper (std::move (f))); | ||||
} | ||||
#endif | #endif | |||
void | bool | |||
query_factory (const char* name, query_factory_type); | call_query_factory (const char* name, connection_type&) const; | |||
query_factory_type | private: | |||
lookup_query_factory (const char* name) const; | void | |||
query_factory (const char* name, query_factory_wrapper); | ||||
// Native database statement execution. | // Native database statement execution. | |||
// | // | |||
public: | public: | |||
unsigned long long | unsigned long long | |||
execute (const char* statement); | execute (const char* statement); | |||
unsigned long long | unsigned long long | |||
execute (const std::string& statement); | execute (const std::string& statement); | |||
skipping to change at line 428 | skipping to change at line 524 | |||
protected: | protected: | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist_ (T&); | persist_ (T&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
typename object_traits<T>::id_type | typename object_traits<T>::id_type | |||
persist_ (const typename object_traits<T>::pointer_type&); | persist_ (const typename object_traits<T>::pointer_type&); | |||
template <typename I, database_id DB> | ||||
void | ||||
persist_ (I, I, bool); | ||||
template <typename I, typename T, database_id DB> | ||||
void | ||||
persist_ (I, I, bool, details::meta::no ptr); | ||||
template <typename I, typename T, database_id DB> | ||||
void | ||||
persist_ (I, I, bool, details::meta::yes ptr); | ||||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
typename object_traits<T>::pointer_type | typename object_traits<T>::pointer_type | |||
load_ (const typename object_traits<T>::id_type&); | load_ (const typename object_traits<T>::id_type&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
load_ (const typename object_traits<T>::id_type&, T&); | load_ (const typename object_traits<T>::id_type&, T&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
skipping to change at line 460 | skipping to change at line 568 | |||
find_ (const typename object_traits<T>::id_type&, T&); | find_ (const typename object_traits<T>::id_type&, T&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
update_ (T&); | update_ (T&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
update_ (const typename object_traits<T>::pointer_type&); | update_ (const typename object_traits<T>::pointer_type&); | |||
template <typename I, database_id DB> | ||||
void | ||||
update_ (I, I, bool); | ||||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
update_ (const T&, const section&); | update_ (const T&, const section&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
erase_ (const typename object_traits<T>::id_type&); | erase_ (const typename object_traits<T>::id_type&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
erase_ (T&); | erase_ (T&); | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void | void | |||
erase_ (const typename object_traits<T>::pointer_type&); | erase_ (const typename object_traits<T>::pointer_type&); | |||
template <typename I, typename T, database_id DB> | ||||
void | ||||
erase_id_ (I, I, bool); | ||||
template <typename I, database_id DB> | ||||
void | ||||
erase_object_ (I, I, bool); | ||||
template <typename T, database_id DB, typename Q> | ||||
typename object_traits<T>::pointer_type | ||||
query_one_ (const Q&); | ||||
template <typename T, database_id DB, typename Q> | ||||
bool | ||||
query_one_ (const Q&, T&); | ||||
template <typename T, database_id DB, typename Q> | ||||
T | ||||
query_value_ (const Q&); | ||||
template <typename T, | template <typename T, | |||
database_id DB, | database_id DB, | |||
class_kind kind = class_traits<T>::kind> | class_kind kind = class_traits<T>::kind> | |||
struct query_; | struct query_; | |||
protected: | protected: | |||
typedef | typedef | |||
std::map<const char*, query_factory_type, details::c_string_comparator> | std::map<const char*, query_factory_wrapper, details::c_string_comparat or> | |||
query_factory_map; | query_factory_map; | |||
typedef std::map<std::string, schema_version_info> schema_version_map; | typedef std::map<std::string, schema_version_info> schema_version_map; | |||
database_id id_; | database_id id_; | |||
tracer_type* tracer_; | tracer_type* tracer_; | |||
query_factory_map query_factory_map_; | query_factory_map query_factory_map_; | |||
mutable details::mutex mutex_; | mutable details::mutex mutex_; | |||
mutable schema_version_map schema_version_map_; | mutable schema_version_map schema_version_map_; | |||
End of changes. 17 change blocks. | ||||
13 lines changed or deleted | 145 lines changed or added | |||
database.ixx | database.ixx | |||
---|---|---|---|---|
// file : odb/database.ixx | // file : odb/database.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <cstring> // std::strlen() | #include <cstring> // std::strlen() | |||
#include <utility> // std::move | #include <utility> // std::move | |||
#include <iterator> | ||||
#include <odb/transaction.hxx> | #include <odb/transaction.hxx> | |||
#include <odb/pointer-traits.hxx> | ||||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T> | ||||
struct object_pointer_traits | ||||
{ | ||||
typedef details::meta::no result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const T& x) {return x;} | ||||
}; | ||||
template <typename T> | ||||
struct object_pointer_traits<T*> | ||||
{ | ||||
typedef details::meta::yes result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const T* p) {return *p;} | ||||
}; | ||||
template <typename T> | ||||
struct object_pointer_traits<T* const> | ||||
{ | ||||
typedef details::meta::yes result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const T* p) {return *p;} | ||||
}; | ||||
template <typename T, template <typename> class P> | ||||
struct object_pointer_traits<P<T> > | ||||
{ | ||||
typedef details::meta::yes result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const P<T>& p) { | ||||
return pointer_traits<P<T> >::get_ref (p);} | ||||
}; | ||||
template <typename T, typename A1, template <typename, typename> class P> | ||||
struct object_pointer_traits<P<T, A1> > | ||||
{ | ||||
typedef details::meta::yes result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const P<T, A1>& p) { | ||||
return pointer_traits<P<T, A1> >::get_ref (p);} | ||||
}; | ||||
template <typename T, template <typename> class P> | ||||
struct object_pointer_traits<const P<T> > | ||||
{ | ||||
typedef details::meta::yes result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const P<T>& p) { | ||||
return pointer_traits<P<T> >::get_ref (p);} | ||||
}; | ||||
template <typename T, typename A1, template <typename, typename> class P> | ||||
struct object_pointer_traits<const P<T, A1> > | ||||
{ | ||||
typedef details::meta::yes result_type; | ||||
typedef T object_type; | ||||
static const T& get_ref (const P<T, A1>& p) { | ||||
return pointer_traits<P<T, A1> >::get_ref (p);} | ||||
}; | ||||
inline database:: | inline database:: | |||
database (database_id id) | database (database_id id) | |||
: id_ (id), tracer_ (0), schema_version_seq_ (1) | : id_ (id), tracer_ (0), schema_version_seq_ (1) | |||
{ | { | |||
} | } | |||
inline database_id database:: | inline database_id database:: | |||
id () const | id () const | |||
{ | { | |||
return id_; | return id_; | |||
skipping to change at line 68 | skipping to change at line 130 | |||
{ | { | |||
return schema_version_seq_; | return schema_version_seq_; | |||
} | } | |||
inline connection_ptr database:: | inline connection_ptr database:: | |||
connection () | connection () | |||
{ | { | |||
return connection_ptr (connection_ ()); | return connection_ptr (connection_ ()); | |||
} | } | |||
#ifndef ODB_CXX11 | ||||
inline void database:: | inline void database:: | |||
query_factory (const char* name, query_factory_type f) | query_factory (const char* name, query_factory_ptr f) | |||
{ | { | |||
if (f) | query_factory (name, query_factory_wrapper (f)); | |||
#ifdef ODB_CXX11 | ||||
query_factory_map_[name] = std::move (f); | ||||
#else | ||||
query_factory_map_[name] = f; | ||||
#endif | ||||
else | ||||
query_factory_map_.erase (name); | ||||
} | ||||
inline database::query_factory_type database:: | ||||
lookup_query_factory (const char* name) const | ||||
{ | ||||
query_factory_map::const_iterator i (query_factory_map_.find (name)); | ||||
if (i == query_factory_map_.end ()) | ||||
i = query_factory_map_.find (""); // Wildcard factory. | ||||
return i != query_factory_map_.end () | ||||
? i->second | ||||
: database::query_factory_type (); | ||||
} | } | |||
#endif | ||||
inline void database:: | inline void database:: | |||
tracer (tracer_type& t) | tracer (tracer_type& t) | |||
{ | { | |||
tracer_ = &t; | tracer_ = &t; | |||
} | } | |||
inline void database:: | inline void database:: | |||
tracer (tracer_type* t) | tracer (tracer_type* t) | |||
{ | { | |||
skipping to change at line 121 | skipping to change at line 165 | |||
template <typename T> | template <typename T> | |||
inline typename object_traits<T>::id_type database:: | inline typename object_traits<T>::id_type database:: | |||
persist (T& obj) | persist (T& obj) | |||
{ | { | |||
return persist_<T, id_common> (obj); | return persist_<T, id_common> (obj); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline typename object_traits<T>::id_type database:: | inline typename object_traits<T>::id_type database:: | |||
persist (const T& obj) | ||||
{ | ||||
return persist_<const T, id_common> (obj); | ||||
} | ||||
template <typename T> | ||||
inline typename object_traits<T>::id_type database:: | ||||
persist (T* p) | persist (T* p) | |||
{ | { | |||
typedef typename object_traits<T>::pointer_type object_pointer; | typedef typename object_traits<T>::pointer_type object_pointer; | |||
// The passed pointer should be the same or implicit-convertible | // The passed pointer should be the same or implicit-convertible | |||
// to the object pointer. This way we make sure the object pointer | // to the object pointer. This way we make sure the object pointer | |||
// does not assume ownership of the passed object. | // does not assume ownership of the passed object. | |||
// | // | |||
const object_pointer& pobj (p); | const object_pointer& pobj (p); | |||
skipping to change at line 187 | skipping to change at line 238 | |||
return persist<T, A1, P> (cr); | return persist<T, A1, P> (cr); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline typename object_traits<T>::id_type database:: | inline typename object_traits<T>::id_type database:: | |||
persist (const typename object_traits<T>::pointer_type& pobj) | persist (const typename object_traits<T>::pointer_type& pobj) | |||
{ | { | |||
return persist_<T, id_common> (pobj); | return persist_<T, id_common> (pobj); | |||
} | } | |||
template <typename I> | ||||
inline void database:: | ||||
persist (I b, I e, bool cont) | ||||
{ | ||||
persist_<I, id_common> (b, e, cont); | ||||
} | ||||
template <typename T> | template <typename T> | |||
inline typename object_traits<T>::pointer_type database:: | inline typename object_traits<T>::pointer_type database:: | |||
load (const typename object_traits<T>::id_type& id) | load (const typename object_traits<T>::id_type& id) | |||
{ | { | |||
return load_<T, id_common> (id); | return load_<T, id_common> (id); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline void database:: | inline void database:: | |||
load (const typename object_traits<T>::id_type& id, T& obj) | load (const typename object_traits<T>::id_type& id, T& obj) | |||
skipping to change at line 348 | skipping to change at line 406 | |||
update<T, A1, P> (cr); | update<T, A1, P> (cr); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline void database:: | inline void database:: | |||
update (const typename object_traits<T>::pointer_type& pobj) | update (const typename object_traits<T>::pointer_type& pobj) | |||
{ | { | |||
update_<T, id_common> (pobj); | update_<T, id_common> (pobj); | |||
} | } | |||
template <typename I> | ||||
inline void database:: | ||||
update (I b, I e, bool cont) | ||||
{ | ||||
update_<I, id_common> (b, e, cont); | ||||
} | ||||
template <typename T> | template <typename T> | |||
inline void database:: | inline void database:: | |||
update (const T& obj, const section& s) | update (const T& obj, const section& s) | |||
{ | { | |||
update_<T, id_common> (obj, s); | update_<T, id_common> (obj, s); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline void database:: | inline void database:: | |||
erase (const typename object_traits<T>::id_type& id) | erase (const typename object_traits<T>::id_type& id) | |||
skipping to change at line 437 | skipping to change at line 502 | |||
erase<T, A1, P> (cr); | erase<T, A1, P> (cr); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline void database:: | inline void database:: | |||
erase (const typename object_traits<T>::pointer_type& pobj) | erase (const typename object_traits<T>::pointer_type& pobj) | |||
{ | { | |||
erase_<T, id_common> (pobj); | erase_<T, id_common> (pobj); | |||
} | } | |||
template <typename T, typename I> | ||||
inline void database:: | ||||
erase (I idb, I ide, bool cont) | ||||
{ | ||||
erase_id_<I, T, id_common> (idb, ide, cont); | ||||
} | ||||
template <typename I> | ||||
inline void database:: | ||||
erase (I ob, I oe, bool cont) | ||||
{ | ||||
erase_object_<I, id_common> (ob, oe, cont); | ||||
} | ||||
template <typename T> | template <typename T> | |||
inline unsigned long long database:: | inline unsigned long long database:: | |||
erase_query () | erase_query () | |||
{ | { | |||
// T is always object_type. | // T is always object_type. | |||
// | // | |||
return erase_query<T> (odb::query<T> ()); | return erase_query<T> (odb::query<T> ()); | |||
} | } | |||
template <typename T> | template <typename T> | |||
skipping to change at line 495 | skipping to change at line 574 | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline result<T> database:: | inline result<T> database:: | |||
query (const std::string& q, bool cache) | query (const std::string& q, bool cache) | |||
{ | { | |||
return query<T> (odb::query<T> (q), cache); | return query<T> (odb::query<T> (q), cache); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline typename object_traits<T>::pointer_type database:: | ||||
query_one () | ||||
{ | ||||
return query_one<T> (odb::query<T> ()); | ||||
} | ||||
template <typename T> | ||||
inline bool database:: | ||||
query_one (T& o) | ||||
{ | ||||
return query_one<T> (odb::query<T> (), o); | ||||
} | ||||
template <typename T> | ||||
inline T database:: | ||||
query_value () | ||||
{ | ||||
return query_value<T> (odb::query<T> ()); | ||||
} | ||||
template <typename T> | ||||
inline typename object_traits<T>::pointer_type database:: | ||||
query_one (const char* q) | ||||
{ | ||||
return query_one<T> (odb::query<T> (q)); | ||||
} | ||||
template <typename T> | ||||
inline bool database:: | ||||
query_one (const char* q, T& o) | ||||
{ | ||||
return query_one<T> (odb::query<T> (q), o); | ||||
} | ||||
template <typename T> | ||||
inline T database:: | ||||
query_value (const char* q) | ||||
{ | ||||
return query_value<T> (odb::query<T> (q)); | ||||
} | ||||
template <typename T> | ||||
inline typename object_traits<T>::pointer_type database:: | ||||
query_one (const std::string& q) | ||||
{ | ||||
return query_one<T> (odb::query<T> (q)); | ||||
} | ||||
template <typename T> | ||||
inline bool database:: | ||||
query_one (const std::string& q, T& o) | ||||
{ | ||||
return query_one<T> (odb::query<T> (q), o); | ||||
} | ||||
template <typename T> | ||||
inline T database:: | ||||
query_value (const std::string& q) | ||||
{ | ||||
return query_value<T> (odb::query<T> (q)); | ||||
} | ||||
template <typename T> | ||||
inline bool database:: | ||||
query_one (const odb::query<T>& q, T& o) | ||||
{ | ||||
return query_one_<T, id_common> (q, o); | ||||
} | ||||
template <typename T> | ||||
inline typename object_traits<T>::pointer_type database:: | ||||
query_one (const odb::query<T>& q) | ||||
{ | ||||
return query_one_<T, id_common> (q); | ||||
} | ||||
template <typename T> | ||||
inline T database:: | ||||
query_value (const odb::query<T>& q) | ||||
{ | ||||
return query_value_<T, id_common> (q); | ||||
} | ||||
template <typename T> | ||||
inline prepared_query<T> database:: | inline prepared_query<T> database:: | |||
prepare_query (const char* n, const char* q) | prepare_query (const char* n, const char* q) | |||
{ | { | |||
return prepare_query<T> (n, odb::query<T> (q)); | return prepare_query<T> (n, odb::query<T> (q)); | |||
} | } | |||
template <typename T> | template <typename T> | |||
inline prepared_query<T> database:: | inline prepared_query<T> database:: | |||
prepare_query (const char* n, const std::string& q) | prepare_query (const char* n, const std::string& q) | |||
{ | { | |||
skipping to change at line 560 | skipping to change at line 723 | |||
template <typename T, typename P> | template <typename T, typename P> | |||
inline prepared_query<T> database:: | inline prepared_query<T> database:: | |||
lookup_query (const char* name, P*& params) const | lookup_query (const char* name, P*& params) const | |||
{ | { | |||
connection_type& c (transaction::current ().connection ()); | connection_type& c (transaction::current ().connection ()); | |||
return c.lookup_query<T, P> (name, params); | return c.lookup_query<T, P> (name, params); | |||
} | } | |||
// Implementations (i.e., the *_() functions). | // Implementations (i.e., the *_() functions). | |||
// | // | |||
template <typename I, database_id DB> | ||||
inline void database:: | ||||
persist_ (I b, I e, bool cont) | ||||
{ | ||||
// Sun CC with non-standard STL does not have iterator_traits. | ||||
// | ||||
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC | ||||
typedef typename std::iterator_traits<I>::value_type value_type; | ||||
#else | ||||
// Assume iterator is just a pointer. | ||||
// | ||||
typedef typename object_pointer_traits<I>::object_type value_type; | ||||
#endif | ||||
typedef object_pointer_traits<value_type> opt; | ||||
persist_<I, typename opt::object_type, id_common> ( | ||||
b, e, cont, typename opt::result_type ()); | ||||
} | ||||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
inline typename object_traits<T>::pointer_type database:: | inline typename object_traits<T>::pointer_type database:: | |||
find_ (const typename object_traits<T>::id_type& id) | find_ (const typename object_traits<T>::id_type& id) | |||
{ | { | |||
// T is always object_type. | // T is always object_type. | |||
// | // | |||
// Compiler error pointing here? Perhaps the object doesn't have the | // Compiler error pointing here? Perhaps the object doesn't have the | |||
// default constructor? | // default constructor? | |||
// | // | |||
skipping to change at line 642 | skipping to change at line 825 | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
inline void database:: | inline void database:: | |||
erase_ (const typename object_traits<T>::pointer_type& pobj) | erase_ (const typename object_traits<T>::pointer_type& pobj) | |||
{ | { | |||
typedef typename object_traits<T>::pointer_type pointer_type; | typedef typename object_traits<T>::pointer_type pointer_type; | |||
erase_<T, DB> (pointer_traits<pointer_type>::get_ref (pobj)); | erase_<T, DB> (pointer_traits<pointer_type>::get_ref (pobj)); | |||
} | } | |||
template <typename T, database_id DB, typename Q> | ||||
inline typename object_traits<T>::pointer_type database:: | ||||
query_one_ (const Q& q) | ||||
{ | ||||
result<T> r (query_<T, DB>::call (*this, q)); | ||||
// We still have to cache the result since loading the object | ||||
// may result in loading of it's related objects and that would | ||||
// invalidate the result even for just getting the 'end' status. | ||||
// | ||||
r.cache (); | ||||
return r.one (); | ||||
} | ||||
template <typename T, database_id DB, typename Q> | ||||
inline bool database:: | ||||
query_one_ (const Q& q, T& o) | ||||
{ | ||||
result<T> r (query_<T, DB>::call (*this, q)); | ||||
r.cache (); // See above. | ||||
return r.one (o); | ||||
} | ||||
template <typename T, database_id DB, typename Q> | ||||
inline T database:: | ||||
query_value_ (const Q& q) | ||||
{ | ||||
result<T> r (query_<T, DB>::call (*this, q)); | ||||
r.cache (); // See above. | ||||
// Compiler error pointing here? The object must be default-constructib | ||||
le | ||||
// in order to use the return-by-value API. | ||||
// | ||||
T o; | ||||
r.value (o); | ||||
return o; | ||||
} | ||||
// execute() | // execute() | |||
// | // | |||
inline unsigned long long database:: | inline unsigned long long database:: | |||
execute (const char* statement) | execute (const char* statement) | |||
{ | { | |||
return execute (statement, std::strlen (statement)); | return execute (statement, std::strlen (statement)); | |||
} | } | |||
inline unsigned long long database:: | inline unsigned long long database:: | |||
execute (const std::string& statement) | execute (const std::string& statement) | |||
End of changes. 15 change blocks. | ||||
23 lines changed or deleted | 246 lines changed or added | |||
database.txx | database.txx | |||
---|---|---|---|---|
// file : odb/database.txx | // file : odb/database.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/section.hxx> | #include <odb/section.hxx> | |||
#include <odb/exceptions.hxx> | #include <odb/exceptions.hxx> | |||
#include <odb/no-op-cache-traits.hxx> | #include <odb/no-op-cache-traits.hxx> | |||
#include <odb/pointer-traits.hxx> | #include <odb/pointer-traits.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T> | template <typename T> | |||
skipping to change at line 74 | skipping to change at line 74 | |||
// | // | |||
typename object_traits::pointer_cache_traits::position_type p ( | typename object_traits::pointer_cache_traits::position_type p ( | |||
object_traits::pointer_cache_traits::insert ( | object_traits::pointer_cache_traits::insert ( | |||
*this, pointer_cache_type<pointer_type>::convert (pobj))); | *this, pointer_cache_type<pointer_type>::convert (pobj))); | |||
object_traits::pointer_cache_traits::persist (p); | object_traits::pointer_cache_traits::persist (p); | |||
return object_traits::id (obj); | return object_traits::id (obj); | |||
} | } | |||
template <typename T, bool = object_traits<T>::auto_id> struct persist_ty | ||||
pe; | ||||
template <typename T> struct persist_type<T, true> {typedef T type;}; | ||||
template <typename T> struct persist_type<T, false> {typedef const T type | ||||
;}; | ||||
template <typename I, typename T, database_id DB> | ||||
void database:: | ||||
persist_ (I b, I e, bool cont, details::meta::no /*ptr*/) | ||||
{ | ||||
// T can be const T while object_type will always be T. | ||||
// | ||||
typedef typename object_traits<T>::object_type object_type; | ||||
typedef object_traits_impl<object_type, DB> object_traits; | ||||
multiple_exceptions mex (typeid (object_already_persistent)); | ||||
try | ||||
{ | ||||
while (b != e && (cont || mex.empty ())) | ||||
{ | ||||
std::size_t n (0); | ||||
T* a[object_traits::batch]; // T instead of persist_type for cache. | ||||
for (; b != e && n < object_traits::batch; ++n) | ||||
{ | ||||
// Compiler error pointing here? Perhaps the passed range is | ||||
// of const objects? | ||||
// | ||||
typename persist_type<object_type>::type* p (&(*b++)); | ||||
a[n] = const_cast<T*> (p); | ||||
} | ||||
// Compiler error pointing here? Perhaps the object or the | ||||
// database does not support bulk operations? | ||||
// | ||||
object_traits::persist ( | ||||
*this, | ||||
const_cast<typename persist_type<object_type>::type**> (a), | ||||
n, | ||||
mex); | ||||
if (mex.fatal ()) | ||||
break; | ||||
for (std::size_t i (0); i < n; ++i) | ||||
{ | ||||
if (mex[i] != 0) // Don't cache objects that have failed. | ||||
continue; | ||||
mex.current (i); // Set position in case the below code throws. | ||||
typename object_traits::reference_cache_traits::position_type p ( | ||||
object_traits::reference_cache_traits::insert ( | ||||
*this, reference_cache_type<T>::convert (*a[i]))); | ||||
object_traits::reference_cache_traits::persist (p); | ||||
} | ||||
mex.delta (n); | ||||
} | ||||
} | ||||
catch (const odb::exception& ex) | ||||
{ | ||||
mex.insert (ex, true); | ||||
} | ||||
if (!mex.empty ()) | ||||
{ | ||||
mex.prepare (); | ||||
throw mex; | ||||
} | ||||
} | ||||
template <typename P> | ||||
struct pointer_copy | ||||
{ | ||||
const P* ref; | ||||
P copy; | ||||
void assign (const P& p) {ref = &p;} | ||||
template <typename P1> void assign (const P1& p1) | ||||
{ | ||||
// The passed pointer should be the same or implicit-convertible | ||||
// to the object pointer. This way we make sure the object pointer | ||||
// does not assume ownership of the passed object. | ||||
// | ||||
const P& p (p1); | ||||
copy = p; | ||||
ref = © | ||||
} | ||||
}; | ||||
template <typename I, typename T, database_id DB> | ||||
void database:: | ||||
persist_ (I b, I e, bool cont, details::meta::yes /*ptr*/) | ||||
{ | ||||
// T can be const T while object_type will always be T. | ||||
// | ||||
typedef typename object_traits<T>::object_type object_type; | ||||
typedef typename object_traits<T>::pointer_type pointer_type; | ||||
typedef object_traits_impl<object_type, DB> object_traits; | ||||
multiple_exceptions mex (typeid (object_already_persistent)); | ||||
try | ||||
{ | ||||
while (b != e && (cont || mex.empty ())) | ||||
{ | ||||
std::size_t n (0); | ||||
typename persist_type<object_type>::type* a[object_traits::batch]; | ||||
pointer_copy<pointer_type> p[object_traits::batch]; | ||||
for (; b != e && n < object_traits::batch; ++n) | ||||
{ | ||||
p[n].assign (*b++); | ||||
a[n] = &pointer_traits<pointer_type>::get_ref (*p[n].ref); | ||||
} | ||||
// Compiler error pointing here? Perhaps the object or the | ||||
// database does not support bulk operations? | ||||
// | ||||
object_traits::persist (*this, a, n, mex); | ||||
if (mex.fatal ()) | ||||
break; | ||||
for (std::size_t i (0); i < n; ++i) | ||||
{ | ||||
if (mex[i] != 0) // Don't cache objects that have failed. | ||||
continue; | ||||
mex.current (i); // Set position in case the below code throws. | ||||
// Get the canonical object pointer and insert it into object cac | ||||
he. | ||||
// | ||||
typename object_traits::pointer_cache_traits::position_type pos ( | ||||
object_traits::pointer_cache_traits::insert ( | ||||
*this, pointer_cache_type<pointer_type>::convert (*p[i].ref)) | ||||
); | ||||
object_traits::pointer_cache_traits::persist (pos); | ||||
} | ||||
mex.delta (n); | ||||
} | ||||
} | ||||
catch (const odb::exception& ex) | ||||
{ | ||||
mex.insert (ex, true); | ||||
} | ||||
if (!mex.empty ()) | ||||
{ | ||||
mex.prepare (); | ||||
throw mex; | ||||
} | ||||
} | ||||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
typename object_traits<T>::pointer_type database:: | typename object_traits<T>::pointer_type database:: | |||
load_ (const typename object_traits<T>::id_type& id) | load_ (const typename object_traits<T>::id_type& id) | |||
{ | { | |||
// T is always object_type. | // T is always object_type. | |||
// | // | |||
typedef typename object_traits<T>::pointer_type pointer_type; | typedef typename object_traits<T>::pointer_type pointer_type; | |||
pointer_type r (find_<T, DB> (id)); | pointer_type r (find_<T, DB> (id)); | |||
skipping to change at line 123 | skipping to change at line 280 | |||
void database:: | void database:: | |||
reload_ (T& obj) | reload_ (T& obj) | |||
{ | { | |||
// T should be object_type (cannot be const). We also don't need to | // T should be object_type (cannot be const). We also don't need to | |||
// check for transaction here; object_traits::reload () does this. | // check for transaction here; object_traits::reload () does this. | |||
// | // | |||
if (!object_traits_impl<T, DB>::reload (*this, obj)) | if (!object_traits_impl<T, DB>::reload (*this, obj)) | |||
throw object_not_persistent (); | throw object_not_persistent (); | |||
} | } | |||
template <typename I, database_id DB> | ||||
void database:: | ||||
update_ (I b, I e, bool cont) | ||||
{ | ||||
// Sun CC with non-standard STL does not have iterator_traits. | ||||
// | ||||
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC | ||||
typedef typename std::iterator_traits<I>::value_type value_type; | ||||
#else | ||||
// Assume iterator is just a pointer. | ||||
// | ||||
typedef typename object_pointer_traits<I>::object_type value_type; | ||||
#endif | ||||
// object_pointer_traits<T>::object_type can be const. | ||||
// | ||||
typedef object_pointer_traits<value_type> opt; | ||||
typedef | ||||
typename object_traits<typename opt::object_type>::object_type | ||||
object_type; | ||||
typedef object_traits_impl<object_type, DB> object_traits; | ||||
multiple_exceptions mex ( | ||||
object_traits::managed_optimistic_column_count == 0 | ||||
? typeid (object_not_persistent) | ||||
: typeid (object_changed)); | ||||
try | ||||
{ | ||||
while (b != e && (cont || mex.empty ())) | ||||
{ | ||||
std::size_t n (0); | ||||
const object_type* a[object_traits::batch]; | ||||
for (; b != e && n < object_traits::batch; ++n) | ||||
a[n] = &opt::get_ref (*b++); | ||||
// Compiler error pointing here? Perhaps the object or the | ||||
// database does not support bulk operations? | ||||
// | ||||
object_traits::update (*this, a, n, mex); | ||||
if (mex.fatal ()) | ||||
break; | ||||
mex.delta (n); | ||||
} | ||||
} | ||||
catch (const odb::exception& ex) | ||||
{ | ||||
mex.insert (ex, true); | ||||
} | ||||
if (!mex.empty ()) | ||||
{ | ||||
mex.prepare (); | ||||
throw mex; | ||||
} | ||||
} | ||||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
void database:: | void database:: | |||
update_ (const T& obj, const section& s) | update_ (const T& obj, const section& s) | |||
{ | { | |||
if (!s.loaded ()) | if (!s.loaded ()) | |||
throw section_not_loaded (); | throw section_not_loaded (); | |||
transaction& t (transaction::current ()); | transaction& t (transaction::current ()); | |||
// T is always object_type. | // T is always object_type. | |||
// | // | |||
if (object_traits_impl<T, DB>::update (t.connection (), obj, s)) | if (object_traits_impl<T, DB>::update (t.connection (), obj, s)) | |||
{ | { | |||
if (s.changed ()) | if (s.changed ()) | |||
s.reset (true, false, &t); // Clear the change flag. | s.reset (true, false, &t); // Clear the change flag. | |||
} | } | |||
else | else | |||
throw section_not_in_object (); | throw section_not_in_object (); | |||
} | } | |||
template <typename I, typename T, database_id DB> | ||||
void database:: | ||||
erase_id_ (I b, I e, bool cont) | ||||
{ | ||||
// T is explicitly specified by the caller, so assume it is object type | ||||
. | ||||
// | ||||
typedef T object_type; | ||||
typedef object_traits_impl<object_type, DB> object_traits; | ||||
typedef typename object_traits::id_type id_type; | ||||
multiple_exceptions mex (typeid (object_not_persistent)); | ||||
try | ||||
{ | ||||
while (b != e && (cont || mex.empty ())) | ||||
{ | ||||
std::size_t n (0); | ||||
const id_type* a[object_traits::batch]; | ||||
for (; b != e && n < object_traits::batch; ++n) | ||||
// Compiler error pointing here? Perhaps the object id type | ||||
// and the range element type don't match? | ||||
// | ||||
a[n] = &(*b++); | ||||
// Compiler error pointing here? Perhaps the object or the | ||||
// database does not support bulk operations? | ||||
// | ||||
object_traits::erase (*this, a, n, mex); | ||||
if (mex.fatal ()) | ||||
break; | ||||
mex.delta (n); | ||||
} | ||||
} | ||||
catch (const odb::exception& ex) | ||||
{ | ||||
mex.insert (ex, true); | ||||
} | ||||
if (!mex.empty ()) | ||||
{ | ||||
mex.prepare (); | ||||
throw mex; | ||||
} | ||||
} | ||||
template <typename I, database_id DB> | ||||
void database:: | ||||
erase_object_ (I b, I e, bool cont) | ||||
{ | ||||
// Sun CC with non-standard STL does not have iterator_traits. | ||||
// | ||||
#ifndef _RWSTD_NO_CLASS_PARTIAL_SPEC | ||||
typedef typename std::iterator_traits<I>::value_type value_type; | ||||
#else | ||||
// Assume iterator is just a pointer. | ||||
// | ||||
typedef typename object_pointer_traits<I>::object_type value_type; | ||||
#endif | ||||
// object_pointer_traits<T>::object_type can be const. | ||||
// | ||||
typedef object_pointer_traits<value_type> opt; | ||||
typedef | ||||
typename object_traits<typename opt::object_type>::object_type | ||||
object_type; | ||||
typedef object_traits_impl<object_type, DB> object_traits; | ||||
multiple_exceptions mex ( | ||||
object_traits::managed_optimistic_column_count == 0 | ||||
? typeid (object_not_persistent) | ||||
: typeid (object_changed)); | ||||
try | ||||
{ | ||||
while (b != e && (cont || mex.empty ())) | ||||
{ | ||||
std::size_t n (0); | ||||
const object_type* a[object_traits::batch]; | ||||
for (; b != e && n < object_traits::batch; ++n) | ||||
a[n] = &opt::get_ref (*b++); | ||||
// Compiler error pointing here? Perhaps the object or the | ||||
// database does not support bulk operations? | ||||
// | ||||
object_traits::erase (*this, a, n, mex); | ||||
if (mex.fatal ()) | ||||
break; | ||||
mex.delta (n); | ||||
} | ||||
} | ||||
catch (const odb::exception& ex) | ||||
{ | ||||
mex.insert (ex, true); | ||||
} | ||||
if (!mex.empty ()) | ||||
{ | ||||
mex.prepare (); | ||||
throw mex; | ||||
} | ||||
} | ||||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
struct database::query_<T, DB, class_object> | struct database::query_<T, DB, class_object> | |||
{ | { | |||
template <typename Q> | template <typename Q> | |||
static result<T> | static result<T> | |||
call (database& db, const Q& q) | call (database& db, const Q& q) | |||
{ | { | |||
return object_traits_impl<T, DB>::query (db, q); | return object_traits_impl<T, DB>::query (db, q); | |||
} | } | |||
}; | }; | |||
End of changes. 4 change blocks. | ||||
1 lines changed or deleted | 334 lines changed or added | |||
exception.hxx | exception.hxx | |||
---|---|---|---|---|
// file : odb/exception.hxx | // file : odb/exception.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_EXCEPTION_HXX | #ifndef ODB_EXCEPTION_HXX | |||
#define ODB_EXCEPTION_HXX | #define ODB_EXCEPTION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <exception> | #include <exception> | |||
#include <odb/forward.hxx> // odb::core | #include <odb/forward.hxx> // odb::core | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
#include <odb/details/shared-ptr/base.hxx> | ||||
namespace odb | namespace odb | |||
{ | { | |||
struct LIBODB_EXPORT exception: std::exception | struct LIBODB_EXPORT exception: std::exception, details::shared_base | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw () = 0; | what () const throw () = 0; | |||
virtual exception* | ||||
clone () const = 0; | ||||
}; | }; | |||
namespace common | namespace common | |||
{ | { | |||
using odb::exception; | using odb::exception; | |||
} | } | |||
} | } | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
End of changes. 5 change blocks. | ||||
2 lines changed or deleted | 7 lines changed or added | |||
exceptions.hxx | exceptions.hxx | |||
---|---|---|---|---|
// file : odb/exceptions.hxx | // file : odb/exceptions.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_EXCEPTIONS_HXX | #ifndef ODB_EXCEPTIONS_HXX | |||
#define ODB_EXCEPTIONS_HXX | #define ODB_EXCEPTIONS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <set> | ||||
#include <string> | #include <string> | |||
#include <cstddef> // std::size_t | ||||
#include <typeinfo> | ||||
#include <odb/forward.hxx> // schema_version, odb::core | #include <odb/forward.hxx> // schema_version, odb::core | |||
#include <odb/exception.hxx> | #include <odb/exception.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
#include <odb/details/shared-ptr.hxx> | ||||
namespace odb | namespace odb | |||
{ | { | |||
struct LIBODB_EXPORT null_pointer: odb::exception | struct LIBODB_EXPORT null_pointer: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual null_pointer* | ||||
clone () const; | ||||
}; | }; | |||
// Transaction exceptions. | // Transaction exceptions. | |||
// | // | |||
struct LIBODB_EXPORT already_in_transaction: odb::exception | struct LIBODB_EXPORT already_in_transaction: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual already_in_transaction* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT not_in_transaction: odb::exception | struct LIBODB_EXPORT not_in_transaction: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual not_in_transaction* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT transaction_already_finalized: odb::exception | struct LIBODB_EXPORT transaction_already_finalized: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual transaction_already_finalized* | ||||
clone () const; | ||||
}; | }; | |||
// Session exceptions. | // Session exceptions. | |||
// | // | |||
struct LIBODB_EXPORT already_in_session: odb::exception | struct LIBODB_EXPORT already_in_session: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual already_in_session* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT not_in_session: odb::exception | struct LIBODB_EXPORT not_in_session: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual not_in_session* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT session_required: odb::exception | struct LIBODB_EXPORT session_required: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual session_required* | ||||
clone () const; | ||||
}; | }; | |||
// Database operations exceptions. | // Database operations exceptions. | |||
// | // | |||
struct LIBODB_EXPORT recoverable: odb::exception | struct LIBODB_EXPORT recoverable: odb::exception | |||
{ | { | |||
// Abstract. | ||||
}; | }; | |||
struct LIBODB_EXPORT connection_lost: recoverable | struct LIBODB_EXPORT connection_lost: recoverable | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual connection_lost* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT timeout: recoverable | struct LIBODB_EXPORT timeout: recoverable | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual timeout* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT deadlock: recoverable | struct LIBODB_EXPORT deadlock: recoverable | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual deadlock* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT object_not_persistent: odb::exception | struct LIBODB_EXPORT object_not_persistent: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual object_not_persistent* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT object_already_persistent: odb::exception | struct LIBODB_EXPORT object_already_persistent: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual object_already_persistent* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT object_changed: odb::exception | struct LIBODB_EXPORT object_changed: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual object_changed* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT result_not_cached: odb::exception | struct LIBODB_EXPORT result_not_cached: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual result_not_cached* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT database_exception: odb::exception | struct LIBODB_EXPORT database_exception: odb::exception | |||
{ | { | |||
// Abstract. | ||||
}; | }; | |||
// Polymorphism support exceptions. | // Polymorphism support exceptions. | |||
// | // | |||
struct LIBODB_EXPORT abstract_class: odb::exception | struct LIBODB_EXPORT abstract_class: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual abstract_class* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT no_type_info: odb::exception | struct LIBODB_EXPORT no_type_info: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual no_type_info* | ||||
clone () const; | ||||
}; | }; | |||
// Prepared query support exceptions. | // Prepared query support exceptions. | |||
// | // | |||
struct LIBODB_EXPORT prepared_already_cached: odb::exception | struct LIBODB_EXPORT prepared_already_cached: odb::exception | |||
{ | { | |||
prepared_already_cached (const char* name); | prepared_already_cached (const char* name); | |||
~prepared_already_cached () throw (); | ~prepared_already_cached () throw (); | |||
const char* | const char* | |||
name () const | name () const | |||
{ | { | |||
return name_; | return name_; | |||
} | } | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual prepared_already_cached* | ||||
clone () const; | ||||
private: | private: | |||
const char* name_; | const char* name_; | |||
std::string what_; | std::string what_; | |||
}; | }; | |||
struct LIBODB_EXPORT prepared_type_mismatch: odb::exception | struct LIBODB_EXPORT prepared_type_mismatch: odb::exception | |||
{ | { | |||
prepared_type_mismatch (const char* name); | prepared_type_mismatch (const char* name); | |||
~prepared_type_mismatch () throw (); | ~prepared_type_mismatch () throw (); | |||
const char* | const char* | |||
name () const | name () const {return name_;} | |||
{ | ||||
return name_; | ||||
} | ||||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual prepared_type_mismatch* | ||||
clone () const; | ||||
private: | private: | |||
const char* name_; | const char* name_; | |||
std::string what_; | std::string what_; | |||
}; | }; | |||
// Schema catalog exceptions. | // Schema catalog exceptions. | |||
// | // | |||
struct LIBODB_EXPORT unknown_schema: odb::exception | struct LIBODB_EXPORT unknown_schema: odb::exception | |||
{ | { | |||
unknown_schema (const std::string& name); | unknown_schema (const std::string& name); | |||
~unknown_schema () throw (); | ~unknown_schema () throw (); | |||
const std::string& | const std::string& | |||
name () const | name () const {return name_;} | |||
{ | ||||
return name_; | ||||
} | ||||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual unknown_schema* | ||||
clone () const; | ||||
private: | private: | |||
std::string name_; | std::string name_; | |||
std::string what_; | std::string what_; | |||
}; | }; | |||
struct LIBODB_EXPORT unknown_schema_version: odb::exception | struct LIBODB_EXPORT unknown_schema_version: odb::exception | |||
{ | { | |||
unknown_schema_version (schema_version); | unknown_schema_version (schema_version); | |||
~unknown_schema_version () throw (); | ~unknown_schema_version () throw (); | |||
schema_version | schema_version | |||
version () const | version () const {return version_;} | |||
{ | ||||
return version_; | ||||
} | ||||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual unknown_schema_version* | ||||
clone () const; | ||||
private: | private: | |||
schema_version version_; | schema_version version_; | |||
std::string what_; | std::string what_; | |||
}; | }; | |||
// Section exceptions. | // Section exceptions. | |||
// | // | |||
struct LIBODB_EXPORT section_not_loaded: odb::exception | struct LIBODB_EXPORT section_not_loaded: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual section_not_loaded* | ||||
clone () const; | ||||
}; | }; | |||
struct LIBODB_EXPORT section_not_in_object: odb::exception | struct LIBODB_EXPORT section_not_in_object: odb::exception | |||
{ | { | |||
virtual const char* | virtual const char* | |||
what () const throw (); | what () const throw (); | |||
virtual section_not_in_object* | ||||
clone () const; | ||||
}; | ||||
// Bulk operation exceptions. | ||||
// | ||||
struct LIBODB_EXPORT multiple_exceptions: odb::exception | ||||
{ | ||||
struct LIBODB_EXPORT value_type | ||||
{ | ||||
std::size_t | ||||
position () const {return p_;} | ||||
// If true, then this means that some positions in the batch have | ||||
// triggered the exception but it is not possible, due to the | ||||
// limitations of the underlying database API, to discern exactly | ||||
// which ones. As a result, all the positions in the batch are | ||||
// marked as "maybe failed". | ||||
// | ||||
bool | ||||
maybe () const {return m_;} | ||||
const odb::exception& | ||||
exception () const {return *e_;} | ||||
// Implementation details. | ||||
// | ||||
public: | ||||
value_type (std::size_t p, | ||||
bool maybe, | ||||
details::shared_ptr<odb::exception> e) | ||||
: m_ (maybe), p_ (p), e_ (e) {} | ||||
value_type (std::size_t p): p_ (p) {} // "Key" for set lookup. | ||||
private: | ||||
bool m_; | ||||
std::size_t p_; | ||||
details::shared_ptr<odb::exception> e_; | ||||
}; | ||||
struct LIBODB_EXPORT comparator_type | ||||
{ | ||||
bool | ||||
operator() (const value_type& x, const value_type& y) const | ||||
{ | ||||
return x.position () < y.position (); | ||||
} | ||||
}; | ||||
typedef std::set<value_type, comparator_type> set_type; | ||||
// Iteration. | ||||
// | ||||
public: | ||||
typedef set_type::const_iterator iterator; | ||||
typedef set_type::const_iterator const_iterator; // For pedantic types. | ||||
iterator | ||||
begin () const {return set_.begin ();} | ||||
iterator | ||||
end () const {return set_.end ();} | ||||
// Lookup. | ||||
// | ||||
public: | ||||
// Return NULL if the element at this position has no exception. Note | ||||
// that the returned value is value_type* and not odb::exception* in | ||||
// order to provide access to maybe(); see value_type::maybe() for | ||||
// details. | ||||
// | ||||
const value_type* | ||||
operator[] (std::size_t p) const | ||||
{ | ||||
return set_.empty () ? 0 : lookup (p); | ||||
} | ||||
// Severity, failed and attempt counts. | ||||
// | ||||
public: | ||||
// Return the number of elements for which the operation has been | ||||
// attempted. | ||||
// | ||||
std::size_t | ||||
attempted () const {return attempted_;} | ||||
// Return the number of positions for which the operation has failed. | ||||
// Note that this count includes the maybe failed positions. | ||||
// | ||||
std::size_t | ||||
failed () const {return set_.size ();} | ||||
// If fatal() returns true, then (some of) the exceptions were fatal. | ||||
// In this case, even for elements that were processed but did not | ||||
// cause the exception, no attempts were made to complete the bulk | ||||
// operation and the transaction must be aborted. | ||||
// | ||||
// If fatal() returns false, then the operation on the elements that | ||||
// don't have an exception has succeeded. The application can try to | ||||
// correct the errors and re-attempt the operation on the elements | ||||
// that did cause an exception. In either case, the transaction can | ||||
// be committed. | ||||
// | ||||
bool | ||||
fatal () const {return fatal_;} | ||||
// Normally you shouldn't need to do this explicitly but you can | ||||
// "upgrade" an exception to fatal, for example, for specific | ||||
// database error codes. | ||||
// | ||||
void | ||||
fatal (bool f) {fatal_ = fatal_ || f;} | ||||
// odb::exception interface. | ||||
// | ||||
public: | ||||
virtual const char* | ||||
what () const throw (); | ||||
virtual multiple_exceptions* | ||||
clone () const; | ||||
// Direct set access. | ||||
// | ||||
public: | ||||
const set_type& | ||||
set () const {return set_;} | ||||
// Implementation details. | ||||
// | ||||
public: | ||||
~multiple_exceptions () throw (); | ||||
// All instances of the common exception must be equal since we are | ||||
// going to create and share just one. | ||||
// | ||||
multiple_exceptions (const std::type_info& common_exception_ti) | ||||
: common_exception_ti_ (common_exception_ti), | ||||
fatal_ (false), | ||||
delta_ (0), | ||||
current_ (0) {} | ||||
// Set the attempted count as (delta + n). | ||||
// | ||||
void | ||||
attempted (std::size_t n) {attempted_ = delta_ + n;} | ||||
// Increment the position of the current batch. Also resets the | ||||
// current position in the batch. | ||||
// | ||||
void | ||||
delta (std::size_t d) {delta_ += d; current_ = 0;} | ||||
// Current position in the batch. | ||||
// | ||||
std::size_t | ||||
current () const {return current_;} | ||||
void | ||||
current (std::size_t c) {current_ = c;} | ||||
void | ||||
insert (std::size_t p, | ||||
bool maybe, | ||||
const odb::exception& e, | ||||
bool fatal = false); | ||||
void | ||||
insert (std::size_t p, const odb::exception& e, bool fatal = false) | ||||
{ | ||||
insert (p, false, e, fatal); | ||||
} | ||||
void | ||||
insert (const odb::exception& e, bool fatal = false) | ||||
{ | ||||
insert (current_, e, fatal); | ||||
} | ||||
bool | ||||
empty () const {return set_.empty ();} | ||||
void | ||||
prepare (); | ||||
private: | ||||
const value_type* | ||||
lookup (std::size_t p) const; | ||||
private: | ||||
const std::type_info& common_exception_ti_; | ||||
details::shared_ptr<odb::exception> common_exception_; | ||||
set_type set_; | ||||
bool fatal_; | ||||
std::size_t attempted_; | ||||
std::size_t delta_; // Position of the batch. | ||||
std::size_t current_; // Position in the batch. | ||||
std::string what_; | ||||
}; | }; | |||
namespace common | namespace common | |||
{ | { | |||
using odb::null_pointer; | using odb::null_pointer; | |||
using odb::already_in_transaction; | using odb::already_in_transaction; | |||
using odb::not_in_transaction; | using odb::not_in_transaction; | |||
using odb::transaction_already_finalized; | using odb::transaction_already_finalized; | |||
skipping to change at line 255 | skipping to change at line 516 | |||
using odb::database_exception; | using odb::database_exception; | |||
using odb::abstract_class; | using odb::abstract_class; | |||
using odb::no_type_info; | using odb::no_type_info; | |||
using odb::unknown_schema; | using odb::unknown_schema; | |||
using odb::unknown_schema_version; | using odb::unknown_schema_version; | |||
using odb::section_not_loaded; | using odb::section_not_loaded; | |||
using odb::section_not_in_object; | using odb::section_not_in_object; | |||
using odb::multiple_exceptions; | ||||
} | } | |||
} | } | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#endif // ODB_EXCEPTIONS_HXX | #endif // ODB_EXCEPTIONS_HXX | |||
End of changes. 32 change blocks. | ||||
13 lines changed or deleted | 276 lines changed or added | |||
export.hxx | export.hxx | |||
---|---|---|---|---|
// file : odb/details/export.hxx | // file : odb/details/export.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_EXPORT_HXX | #ifndef ODB_DETAILS_EXPORT_HXX | |||
#define ODB_DETAILS_EXPORT_HXX | #define ODB_DETAILS_EXPORT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> | #include <odb/details/config.hxx> | |||
#ifdef LIBODB_STATIC_LIB | #ifdef LIBODB_STATIC_LIB | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
forward.hxx | forward.hxx | |||
---|---|---|---|---|
// file : odb/forward.hxx | // file : odb/forward.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_FORWARD_HXX | #ifndef ODB_FORWARD_HXX | |||
#define ODB_FORWARD_HXX | #define ODB_FORWARD_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
skipping to change at line 62 | skipping to change at line 62 | |||
using odb::connection; | using odb::connection; | |||
using odb::connection_ptr; | using odb::connection_ptr; | |||
using odb::transaction; | using odb::transaction; | |||
using odb::statement; | using odb::statement; | |||
} | } | |||
// Tracing. | // Tracing. | |||
// | // | |||
class tracer; // Not in core. | class tracer; // Not in core. | |||
extern LIBODB_EXPORT tracer& stderr_tracer; | extern LIBODB_EXPORT tracer& stderr_tracer; | |||
extern LIBODB_EXPORT tracer& stderr_full_tracer; | ||||
namespace common | namespace common | |||
{ | { | |||
using odb::stderr_tracer; | using odb::stderr_tracer; | |||
} | } | |||
// Implementation details. | // Implementation details. | |||
// | // | |||
// Keep real databases first since their enumerators are used as array | // Keep real databases first since their enumerators are used as array | |||
skipping to change at line 155 | skipping to change at line 156 | |||
class query_base; | class query_base; | |||
template <typename T> | template <typename T> | |||
struct query_column; | struct query_column; | |||
// | // | |||
// | // | |||
class result_impl; | class result_impl; | |||
class prepared_query_impl; | class prepared_query_impl; | |||
// | ||||
// | ||||
struct multiple_exceptions; | ||||
// Polymorphism support. | // Polymorphism support. | |||
// | // | |||
template <typename R> | template <typename R> | |||
struct polymorphic_map; | struct polymorphic_map; | |||
namespace details | namespace details | |||
{ | { | |||
template <> | template <> | |||
struct counter_type<connection> | struct counter_type<connection> | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 6 lines changed or added | |||
function-table.hxx | function-table.hxx | |||
---|---|---|---|---|
// file : odb/function-table.hxx | // file : odb/function-table.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_FUNCTION_TABLE_HXX | #ifndef ODB_FUNCTION_TABLE_HXX | |||
#define ODB_FUNCTION_TABLE_HXX | #define ODB_FUNCTION_TABLE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
namespace odb | namespace odb | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lazy-pointer-traits.hxx | lazy-pointer-traits.hxx | |||
---|---|---|---|---|
// file : odb/lazy-pointer-traits.hxx | // file : odb/lazy-pointer-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_LAZY_POINTER_TRAITS_HXX | #ifndef ODB_LAZY_POINTER_TRAITS_HXX | |||
#define ODB_LAZY_POINTER_TRAITS_HXX | #define ODB_LAZY_POINTER_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/pointer-traits.hxx> | #include <odb/pointer-traits.hxx> | |||
#include <odb/lazy-ptr.hxx> | #include <odb/lazy-ptr.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lazy-ptr-impl.hxx | lazy-ptr-impl.hxx | |||
---|---|---|---|---|
// file : odb/lazy-ptr-impl.hxx | // file : odb/lazy-ptr-impl.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_LAZY_PTR_IMPL_HXX | #ifndef ODB_LAZY_PTR_IMPL_HXX | |||
#define ODB_LAZY_PTR_IMPL_HXX | #define ODB_LAZY_PTR_IMPL_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <utility> // std::move | #include <utility> // std::move | |||
#include <odb/forward.hxx> // odb::database | #include <odb/forward.hxx> // odb::database | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lazy-ptr-impl.ixx | lazy-ptr-impl.ixx | |||
---|---|---|---|---|
// file : odb/lazy-ptr-impl.ixx | // file : odb/lazy-ptr-impl.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// lazy_ptr_base | // lazy_ptr_base | |||
// | // | |||
inline lazy_ptr_base:: | inline lazy_ptr_base:: | |||
lazy_ptr_base () | lazy_ptr_base () | |||
skipping to change at line 41 | skipping to change at line 41 | |||
} | } | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
inline lazy_ptr_base:: | inline lazy_ptr_base:: | |||
lazy_ptr_base (lazy_ptr_base&& r) | lazy_ptr_base (lazy_ptr_base&& r) | |||
: id_ (r.id_), db_ (r.db_), loader_ (r.loader_), | : id_ (r.id_), db_ (r.db_), loader_ (r.loader_), | |||
free_ (r.free_), copy_ (r.copy_) | free_ (r.free_), copy_ (r.copy_) | |||
{ | { | |||
r.id_ = 0; | r.id_ = 0; | |||
} | } | |||
#endif | ||||
inline lazy_ptr_base& lazy_ptr_base:: | inline void lazy_ptr_base:: | |||
operator= (lazy_ptr_base&& r) | reset_id () | |||
{ | { | |||
if (id_ != r.id_) | if (id_) | |||
{ | free_ (id_); | |||
reset_id (); | ||||
id_ = r.id_; | ||||
db_ = r.db_; | ||||
loader_ = r.loader_; | ||||
free_ = r.free_; | ||||
copy_ = r.copy_; | ||||
r.id_ = 0; | ||||
} | ||||
return *this; | id_ = 0; | |||
} | } | |||
#endif | ||||
inline void lazy_ptr_base:: | inline void lazy_ptr_base:: | |||
reset_ (database_type* db, | reset_ (database_type* db, | |||
void* loader, | void* loader, | |||
const void* id, | const void* id, | |||
free_func free, | free_func free, | |||
copy_func copy) | copy_func copy) | |||
{ | { | |||
void* idc (id ? copy (id) : 0); | void* idc (id ? copy (id) : 0); | |||
skipping to change at line 89 | skipping to change at line 80 | |||
} | } | |||
inline void lazy_ptr_base:: | inline void lazy_ptr_base:: | |||
reset () | reset () | |||
{ | { | |||
reset_id (); | reset_id (); | |||
db_ = 0; | db_ = 0; | |||
loader_ = 0; | loader_ = 0; | |||
} | } | |||
inline void lazy_ptr_base:: | #ifdef ODB_CXX11 | |||
reset_id () | inline lazy_ptr_base& lazy_ptr_base:: | |||
operator= (lazy_ptr_base&& r) | ||||
{ | { | |||
if (id_) | if (id_ != r.id_) | |||
free_ (id_); | { | |||
reset_id (); | ||||
id_ = r.id_; | ||||
db_ = r.db_; | ||||
loader_ = r.loader_; | ||||
free_ = r.free_; | ||||
copy_ = r.copy_; | ||||
id_ = 0; | r.id_ = 0; | |||
} | ||||
return *this; | ||||
} | } | |||
#endif | ||||
inline lazy_ptr_base& lazy_ptr_base:: | inline lazy_ptr_base& lazy_ptr_base:: | |||
operator= (const lazy_ptr_base& r) | operator= (const lazy_ptr_base& r) | |||
{ | { | |||
if (id_ != r.id_) | if (id_ != r.id_) | |||
reset_ (r.db_, r.loader_, r.id_, r.free_, r.copy_); | reset_ (r.db_, r.loader_, r.id_, r.free_, r.copy_); | |||
else | else | |||
{ | { | |||
db_ = r.db_; | db_ = r.db_; | |||
loader_ = r.loader_; | loader_ = r.loader_; | |||
End of changes. 10 change blocks. | ||||
21 lines changed or deleted | 23 lines changed or added | |||
lazy-ptr-impl.txx | lazy-ptr-impl.txx | |||
---|---|---|---|---|
// file : odb/lazy-ptr-impl.txx | // file : odb/lazy-ptr-impl.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/database.hxx> | #include <odb/database.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// lazy_ptr_base | // lazy_ptr_base | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lazy-ptr.hxx | lazy-ptr.hxx | |||
---|---|---|---|---|
// file : odb/lazy-ptr.hxx | // file : odb/lazy-ptr.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_LAZY_PTR_HXX | #ifndef ODB_LAZY_PTR_HXX | |||
#define ODB_LAZY_PTR_HXX | #define ODB_LAZY_PTR_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <memory> // std::auto_ptr, std::shared_ptr/weak_ptr | #include <memory> // std::auto_ptr, std::shared_ptr/weak_ptr | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lazy-ptr.ixx | lazy-ptr.ixx | |||
---|---|---|---|---|
// file : odb/lazy-ptr.ixx | // file : odb/lazy-ptr.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// lazy_ptr | // lazy_ptr | |||
// | // | |||
template <class T> | template <class T> | |||
inline lazy_ptr<T>:: | inline lazy_ptr<T>:: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lazy-ptr.txx | lazy-ptr.txx | |||
---|---|---|---|---|
// file : odb/lazy-ptr.txx | // file : odb/lazy-ptr.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// lazy_ptr | // lazy_ptr | |||
// | // | |||
template <class T> | template <class T> | |||
template <class Y> | template <class Y> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
lock.hxx | lock.hxx | |||
---|---|---|---|---|
// file : odb/details/lock.hxx | // file : odb/details/lock.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_LOCK_HXX | #ifndef ODB_DETAILS_LOCK_HXX | |||
#define ODB_DETAILS_LOCK_HXX | #define ODB_DETAILS_LOCK_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
#include <odb/details/mutex.hxx> | #include <odb/details/mutex.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
memory.hxx | memory.hxx | |||
---|---|---|---|---|
// file : odb/tr1/memory.hxx | // file : odb/tr1/memory.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_TR1_MEMORY_HXX | #ifndef ODB_TR1_MEMORY_HXX | |||
#define ODB_TR1_MEMORY_HXX | #define ODB_TR1_MEMORY_HXX | |||
// | // | |||
// Try to include TR1 <memory> in a compiler-specific manner. Fall back | // Try to include TR1 <memory> in a compiler-specific manner. Fall back | |||
// on the Boost TR1 implementation if the compiler does not support TR1. | // on the Boost TR1 implementation if the compiler does not support TR1. | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mutex.hxx | mutex.hxx | |||
---|---|---|---|---|
// file : odb/details/mutex.hxx | // file : odb/details/mutex.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_MUTEX_HXX | #ifndef ODB_DETAILS_MUTEX_HXX | |||
#define ODB_DETAILS_MUTEX_HXX | #define ODB_DETAILS_MUTEX_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> | #include <odb/details/config.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
mutex.ixx | mutex.ixx | |||
---|---|---|---|---|
// file : odb/details/posix/mutex.ixx | // file : odb/details/posix/mutex.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/details/posix/exceptions.hxx> | #include <odb/details/posix/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
inline mutex:: | inline mutex:: | |||
~mutex () | ~mutex () | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
no-id-object-result.hxx | no-id-object-result.hxx | |||
---|---|---|---|---|
// file : odb/no-id-object-result.hxx | // file : odb/no-id-object-result.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_NO_ID_OBJECT_RESULT_HXX | #ifndef ODB_NO_ID_OBJECT_RESULT_HXX | |||
#define ODB_NO_ID_OBJECT_RESULT_HXX | #define ODB_NO_ID_OBJECT_RESULT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
no-id-object-result.txx | no-id-object-result.txx | |||
---|---|---|---|---|
// file : odb/no-id-object-result.txx | // file : odb/no-id-object-result.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// object_result_impl | // object_result_impl | |||
// | // | |||
template <typename T> | template <typename T> | |||
void no_id_object_result_impl<T>:: | void no_id_object_result_impl<T>:: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
no-op-cache-traits.hxx | no-op-cache-traits.hxx | |||
---|---|---|---|---|
// file : odb/no-op-cache-traits.hxx | // file : odb/no-op-cache-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_NO_OP_CACHE_TRAITS_HXX | #ifndef ODB_NO_OP_CACHE_TRAITS_HXX | |||
#define ODB_NO_OP_CACHE_TRAITS_HXX | #define ODB_NO_OP_CACHE_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/traits.hxx> | #include <odb/traits.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/pointer-traits.hxx> | #include <odb/pointer-traits.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
nullable.hxx | nullable.hxx | |||
---|---|---|---|---|
// file : odb/nullable.hxx | // file : odb/nullable.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_NULLABLE_HXX | #ifndef ODB_NULLABLE_HXX | |||
#define ODB_NULLABLE_HXX | #define ODB_NULLABLE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> // odb::core | #include <odb/forward.hxx> // odb::core | |||
namespace odb | namespace odb | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
object-result.hxx | object-result.hxx | |||
---|---|---|---|---|
// file : odb/object-result.hxx | // file : odb/object-result.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_OBJECT_RESULT_HXX | #ifndef ODB_OBJECT_RESULT_HXX | |||
#define ODB_OBJECT_RESULT_HXX | #define ODB_OBJECT_RESULT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::ptrdiff_t | #include <cstddef> // std::ptrdiff_t | |||
#include <iterator> // iterator categories | #include <iterator> // iterator categories | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
pointer-traits.hxx | pointer-traits.hxx | |||
---|---|---|---|---|
// file : odb/pointer-traits.hxx | // file : odb/pointer-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_POINTER_TRAITS_HXX | #ifndef ODB_POINTER_TRAITS_HXX | |||
#define ODB_POINTER_TRAITS_HXX | #define ODB_POINTER_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <new> // operators new/delete | #include <new> // operators new/delete | |||
#include <memory> // std::auto_ptr, std::unique_ptr, std::shared_ptr/weak_ ptr | #include <memory> // std::auto_ptr, std::unique_ptr, std::shared_ptr/weak_ ptr | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-info.hxx | polymorphic-info.hxx | |||
---|---|---|---|---|
// file : odb/polymorphic-info.hxx | // file : odb/polymorphic-info.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_POLYMORPHIC_INFO_HXX | #ifndef ODB_POLYMORPHIC_INFO_HXX | |||
#define ODB_POLYMORPHIC_INFO_HXX | #define ODB_POLYMORPHIC_INFO_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <typeinfo> | #include <typeinfo> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-map.hxx | polymorphic-map.hxx | |||
---|---|---|---|---|
// file : odb/polymorphic-map.hxx | // file : odb/polymorphic-map.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_POLYMORPHIC_MAP_HXX | #ifndef ODB_POLYMORPHIC_MAP_HXX | |||
#define ODB_POLYMORPHIC_MAP_HXX | #define ODB_POLYMORPHIC_MAP_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <map> | #include <map> | |||
#include <utility> // std::move | #include <utility> // std::move | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-map.ixx | polymorphic-map.ixx | |||
---|---|---|---|---|
// file : odb/polymorphic-map.ixx | // file : odb/polymorphic-map.ixx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
inline polymorphic_entry<T, DB>:: | inline polymorphic_entry<T, DB>:: | |||
polymorphic_entry () | polymorphic_entry () | |||
{ | { | |||
polymorphic_entry_impl<root_type, DB>::insert (object_traits::info); | polymorphic_entry_impl<root_type, DB>::insert (object_traits::info); | |||
} | } | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-map.txx | polymorphic-map.txx | |||
---|---|---|---|---|
// file : odb/polymorphic-map.txx | // file : odb/polymorphic-map.txx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/exceptions.hxx> // no_type_info | #include <odb/exceptions.hxx> // no_type_info | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// polymorphic_map | // polymorphic_map | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-object-result.hxx | polymorphic-object-result.hxx | |||
---|---|---|---|---|
// file : odb/polymorphic-object-result.hxx | // file : odb/polymorphic-object-result.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_POLYMORPHIC_OBJECT_RESULT_HXX | #ifndef ODB_POLYMORPHIC_OBJECT_RESULT_HXX | |||
#define ODB_POLYMORPHIC_OBJECT_RESULT_HXX | #define ODB_POLYMORPHIC_OBJECT_RESULT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-object-result.txx | polymorphic-object-result.txx | |||
---|---|---|---|---|
// file : odb/polymorphic-object-result.txx | // file : odb/polymorphic-object-result.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/exceptions.hxx> | #include <odb/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// polymorphic_object_result_impl | // polymorphic_object_result_impl | |||
// | // | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
polymorphic-p.hxx | polymorphic-p.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/polymorphic-p.hxx | // file : odb/details/meta/polymorphic-p.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_POLYMORPHIC_HXX | #ifndef ODB_DETAILS_META_POLYMORPHIC_HXX | |||
#define ODB_DETAILS_META_POLYMORPHIC_HXX | #define ODB_DETAILS_META_POLYMORPHIC_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/meta/class-p.hxx> | #include <odb/details/meta/class-p.hxx> | |||
#include <odb/details/meta/remove-const-volatile.hxx> | #include <odb/details/meta/remove-const-volatile.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
post.hxx | post.hxx | |||
---|---|---|---|---|
// file : odb/post.hxx | // file : odb/post.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# include <odb/compilers/vc/post.hxx> | # include <odb/compilers/vc/post.hxx> | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
pre.hxx | pre.hxx | |||
---|---|---|---|---|
// file : odb/pre.hxx | // file : odb/pre.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifdef _MSC_VER | #ifdef _MSC_VER | |||
# include <odb/compilers/vc/pre.hxx> | # include <odb/compilers/vc/pre.hxx> | |||
#endif | #endif | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
prepared-query.hxx | prepared-query.hxx | |||
---|---|---|---|---|
// file : odb/prepared-query.hxx | // file : odb/prepared-query.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_PREPARED_QUERY_HXX | #ifndef ODB_PREPARED_QUERY_HXX | |||
#define ODB_PREPARED_QUERY_HXX | #define ODB_PREPARED_QUERY_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> // odb::core | #include <odb/forward.hxx> // odb::core | |||
#include <odb/traits.hxx> | #include <odb/traits.hxx> | |||
#include <odb/result.hxx> | #include <odb/result.hxx> | |||
skipping to change at line 89 | skipping to change at line 89 | |||
result<T> r ( | result<T> r ( | |||
details::shared_ptr<derived_type> ( | details::shared_ptr<derived_type> ( | |||
static_cast<derived_type*> (ri.release ()))); | static_cast<derived_type*> (ri.release ()))); | |||
if (cache) | if (cache) | |||
r.cache (); | r.cache (); | |||
return r; | return r; | |||
} | } | |||
typename object_traits<T>::pointer_type | ||||
execute_one () | ||||
{ | ||||
return execute (false).one (); | ||||
} | ||||
bool | ||||
execute_one (T& object) | ||||
{ | ||||
return execute (false).one (object); | ||||
} | ||||
T | ||||
execute_value () | ||||
{ | ||||
// Compiler error pointing here? The object must be default- | ||||
// constructible in order to use the return-by-value API. | ||||
// | ||||
T o; | ||||
execute (false).value (o); | ||||
return o; | ||||
} | ||||
const char* | const char* | |||
name () const | name () const | |||
{ | { | |||
return impl_->name; | return impl_->name; | |||
} | } | |||
typedef odb::statement statement_type; | typedef odb::statement statement_type; | |||
statement_type& | statement_type& | |||
statement () const | statement () const | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 24 lines changed or added | |||
query-dynamic.hxx | query-dynamic.hxx | |||
---|---|---|---|---|
// file : odb/query-dynamic.hxx | // file : odb/query-dynamic.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_QUERY_DYNAMIC_HXX | #ifndef ODB_QUERY_DYNAMIC_HXX | |||
#define ODB_QUERY_DYNAMIC_HXX | #define ODB_QUERY_DYNAMIC_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <string> | #include <string> | |||
#include <vector> | #include <vector> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
query-dynamic.ixx | query-dynamic.ixx | |||
---|---|---|---|---|
// file : odb/query-dynamic.ixx | // file : odb/query-dynamic.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// query_base | // query_base | |||
// | // | |||
inline query_base:: | inline query_base:: | |||
query_base (const query_column<bool>& c) | query_base (const query_column<bool>& c) | |||
{ | { | |||
// Some databases provide the IS TRUE operator. However, we cannot | // Some databases provide the IS TRUE operator. However, we cannot | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
query-dynamic.txx | query-dynamic.txx | |||
---|---|---|---|---|
// file : odb/query-dynamic.txx | // file : odb/query-dynamic.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// query_base | // query_base | |||
// | // | |||
template <typename T> | template <typename T> | |||
void query_base:: | void query_base:: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
query.hxx | query.hxx | |||
---|---|---|---|---|
// file : odb/query.hxx | // file : odb/query.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_QUERY_HXX | #ifndef ODB_QUERY_HXX | |||
#define ODB_QUERY_HXX | #define ODB_QUERY_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/traits.hxx> | #include <odb/traits.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
remove-const-volatile.hxx | remove-const-volatile.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/remove-const-volatile.hxx | // file : odb/details/meta/remove-const-volatile.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_REMOVE_CONST_VOLATILE_HXX | #ifndef ODB_DETAILS_META_REMOVE_CONST_VOLATILE_HXX | |||
#define ODB_DETAILS_META_REMOVE_CONST_VOLATILE_HXX | #define ODB_DETAILS_META_REMOVE_CONST_VOLATILE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/meta/remove-const.hxx> | #include <odb/details/meta/remove-const.hxx> | |||
#include <odb/details/meta/remove-volatile.hxx> | #include <odb/details/meta/remove-volatile.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
remove-const.hxx | remove-const.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/remove-const.hxx | // file : odb/details/meta/remove-const.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_REMOVE_CONST_HXX | #ifndef ODB_DETAILS_META_REMOVE_CONST_HXX | |||
#define ODB_DETAILS_META_REMOVE_CONST_HXX | #define ODB_DETAILS_META_REMOVE_CONST_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
remove-pointer.hxx | remove-pointer.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/remove-pointer.hxx | // file : odb/details/meta/remove-pointer.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_REMOVE_POINTER_HXX | #ifndef ODB_DETAILS_META_REMOVE_POINTER_HXX | |||
#define ODB_DETAILS_META_REMOVE_POINTER_HXX | #define ODB_DETAILS_META_REMOVE_POINTER_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
remove-volatile.hxx | remove-volatile.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/remove-volatile.hxx | // file : odb/details/meta/remove-volatile.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_REMOVE_VOLATILE_HXX | #ifndef ODB_DETAILS_META_REMOVE_VOLATILE_HXX | |||
#define ODB_DETAILS_META_REMOVE_VOLATILE_HXX | #define ODB_DETAILS_META_REMOVE_VOLATILE_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
result.hxx | result.hxx | |||
---|---|---|---|---|
// file : odb/result.hxx | // file : odb/result.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_RESULT_HXX | #ifndef ODB_RESULT_HXX | |||
#define ODB_RESULT_HXX | #define ODB_RESULT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::ptrdiff_t, std::size_t | #include <cstddef> // std::ptrdiff_t, std::size_t | |||
#include <odb/forward.hxx> // odb::core | #include <odb/forward.hxx> // odb::core | |||
skipping to change at line 212 | skipping to change at line 212 | |||
} | } | |||
// Size is only known in cached results. | // Size is only known in cached results. | |||
// | // | |||
size_type | size_type | |||
size () const | size () const | |||
{ | { | |||
return impl_ ? impl_->size () : 0; | return impl_ ? impl_->size () : 0; | |||
} | } | |||
// query_one() and query_value() implementation details. | ||||
// | ||||
public: | ||||
typename object_traits<T>::pointer_type | ||||
one (); | ||||
bool | ||||
one (T&); | ||||
// We cannot return by value here since result can be instantiated | ||||
// for an abstract type (polymorphic abstract base) and it seems | ||||
// the signature must be valid to the point being able to call the | ||||
// necessary constructors. | ||||
// | ||||
void | ||||
value (T&); | ||||
private: | private: | |||
friend class result<const T>; | friend class result<const T>; | |||
details::shared_ptr<result_impl_type> impl_; | details::shared_ptr<result_impl_type> impl_; | |||
}; | }; | |||
namespace common | namespace common | |||
{ | { | |||
using odb::result; | using odb::result; | |||
using odb::result_iterator; | using odb::result_iterator; | |||
} | } | |||
} | } | |||
#include <odb/result.txx> | ||||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#endif // ODB_RESULT_HXX | #endif // ODB_RESULT_HXX | |||
End of changes. 3 change blocks. | ||||
1 lines changed or deleted | 20 lines changed or added | |||
schema-catalog-impl.hxx | schema-catalog-impl.hxx | |||
---|---|---|---|---|
// file : odb/schema-catalog-impl.hxx | // file : odb/schema-catalog-impl.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_SCHEMA_CATALOG_IMPL_HXX | #ifndef ODB_SCHEMA_CATALOG_IMPL_HXX | |||
#define ODB_SCHEMA_CATALOG_IMPL_HXX | #define ODB_SCHEMA_CATALOG_IMPL_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> | #include <cstddef> | |||
#include <odb/forward.hxx> // schema_version | #include <odb/forward.hxx> // schema_version | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
schema-catalog.hxx | schema-catalog.hxx | |||
---|---|---|---|---|
// file : odb/schema-catalog.hxx | // file : odb/schema-catalog.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_SCHEMA_CATALOG_HXX | #ifndef ODB_SCHEMA_CATALOG_HXX | |||
#define ODB_SCHEMA_CATALOG_HXX | #define ODB_SCHEMA_CATALOG_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
#include <string> | #include <string> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
# include <functional> // std::function | # include <utility> // std::move | |||
# include <functional> // std::function | ||||
# include <type_traits> // std::enable_if, std::is_convertible | ||||
#endif | #endif | |||
#include <odb/forward.hxx> // schema_version, odb::core | #include <odb/forward.hxx> // schema_version, odb::core | |||
#include <odb/database.hxx> | ||||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
#include <odb/details/unused.hxx> | #include <odb/details/unused.hxx> | |||
#include <odb/details/meta/static-assert.hxx> | #include <odb/details/meta/static-assert.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
class LIBODB_EXPORT schema_catalog | class LIBODB_EXPORT schema_catalog | |||
{ | { | |||
public: | public: | |||
skipping to change at line 76 | skipping to change at line 79 | |||
// | // | |||
public: | public: | |||
// If version is 0, then use the current database version and also | // If version is 0, then use the current database version and also | |||
// check whether we are in migration. Returns the number of calls made. | // check whether we are in migration. Returns the number of calls made. | |||
// | // | |||
static std::size_t | static std::size_t | |||
migrate_data (database&, | migrate_data (database&, | |||
schema_version = 0, | schema_version = 0, | |||
const std::string& name = ""); | const std::string& name = ""); | |||
#ifdef ODB_CXX11 | typedef void data_migration_function_type (database&); | |||
typedef std::function<void (database&)> data_migration_function_type; | typedef data_migration_function_type* data_migration_function_ptr; | |||
#else | ||||
typedef void (*data_migration_function_type) (database&); | typedef details::function_wrapper<data_migration_function_type> | |||
#endif | data_migration_function_wrapper; | |||
// The following three variants of the registration functions make | // The following three variants of the registration functions make | |||
// sure that the version is greater that the base model version. | // sure that the version is greater that the base model version. | |||
// This helps with identifying and removing data migration function | // This helps with identifying and removing data migration function | |||
// that are no longer required. | // that are no longer required. | |||
// | // | |||
// Data migration functions are called in the order of registration. | // Data migration functions are called in the order of registration. | |||
// | // | |||
#ifndef ODB_CXX11 | ||||
template <schema_version v, schema_version base> | template <schema_version v, schema_version base> | |||
static void | static void | |||
data_migration_function (data_migration_function_type f, | data_migration_function (data_migration_function_ptr f, | |||
const std::string& name = "") | const std::string& name = "") | |||
{ | { | |||
data_migration_function<v, base> (id_common, f, name); | data_migration_function<v, base> (id_common, f, name); | |||
} | } | |||
#else | ||||
template <schema_version v, schema_version base, typename F> | ||||
static typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<data_migration_function_type>>::value, void>::type | ||||
data_migration_function (F f, const std::string& name = "") | ||||
{ | ||||
data_migration_function<v, base> (id_common, std::move (f), name); | ||||
} | ||||
#endif | ||||
// Database-specific data migration. | // Database-specific data migration. | |||
// | // | |||
#ifndef ODB_CXX11 | ||||
template <schema_version v, schema_version base> | template <schema_version v, schema_version base> | |||
static void | static void | |||
data_migration_function (database& db, | data_migration_function (database& db, | |||
data_migration_function_type f, | data_migration_function_ptr f, | |||
const std::string& name = "") | const std::string& name = "") | |||
{ | { | |||
data_migration_function<v, base> (db.id (), f, name); | data_migration_function<v, base> (db.id (), f, name); | |||
} | } | |||
#else | ||||
template <schema_version v, schema_version base, typename F> | ||||
static typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<data_migration_function_type>>::value, void>::type | ||||
data_migration_function (database& db, F f, const std::string& name = " | ||||
") | ||||
{ | ||||
data_migration_function<v, base> (db.id (), std::move (f), name); | ||||
} | ||||
#endif | ||||
#ifndef ODB_CXX11 | ||||
template <schema_version v, schema_version base> | template <schema_version v, schema_version base> | |||
static void | static void | |||
data_migration_function (database_id id, | data_migration_function (database_id id, | |||
data_migration_function_type f, | data_migration_function_ptr f, | |||
const std::string& name = "") | const std::string& name = "") | |||
{ | { | |||
// If the data migration version is below the base model version | // If the data migration version is below the base model version | |||
// then it will never be called. | // then it will never be called. | |||
// | // | |||
#ifdef ODB_CXX11 | ||||
static_assert (v > base || base == 0, | ||||
"data migration function is no longer necessary"); | ||||
#else | ||||
// Poor man's static_assert. | // Poor man's static_assert. | |||
// | // | |||
typedef details::meta::static_assert_test<(v > base || base == 0)> | typedef details::meta::static_assert_test<(v > base || base == 0)> | |||
data_migration_function_is_no_longer_necessary; | data_migration_function_is_no_longer_necessary; | |||
char sa [sizeof (data_migration_function_is_no_longer_necessary)]; | char sa [sizeof (data_migration_function_is_no_longer_necessary)]; | |||
ODB_POTENTIALLY_UNUSED (sa); | ODB_POTENTIALLY_UNUSED (sa); | |||
#endif | ||||
data_migration_function (id, v, f, name); | data_migration_function (id, v, f, name); | |||
} | } | |||
#else | ||||
template <schema_version v, schema_version base, typename F> | ||||
static typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<data_migration_function_type>>::value, void>::type | ||||
data_migration_function (database_id id, F f, const std::string& name = | ||||
"") | ||||
{ | ||||
// If the data migration version is below the base model version | ||||
// then it will never be called. | ||||
// | ||||
static_assert (v > base || base == 0, | ||||
"data migration function is no longer necessary"); | ||||
data_migration_function (id, v, std::move (f), name); | ||||
} | ||||
#endif | ||||
// The same as above but take the version as an argument and do | // The same as above but take the version as an argument and do | |||
// not check whether it is greater than the base model version. | // not check whether it is greater than the base model version. | |||
// | // | |||
#ifndef ODB_CXX11 | ||||
static void | static void | |||
data_migration_function (schema_version v, | data_migration_function (schema_version v, | |||
data_migration_function_type f, | data_migration_function_ptr f, | |||
const std::string& name = "") | const std::string& name = "") | |||
{ | { | |||
data_migration_function (id_common, v, f, name); | data_migration_function (id_common, v, f, name); | |||
} | } | |||
#else | ||||
template <typename F> | ||||
static typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<data_migration_function_type>>::value, void>::type | ||||
data_migration_function (schema_version v, | ||||
F f, | ||||
const std::string& name = "") | ||||
{ | ||||
data_migration_function (id_common, v, std::move (f), name); | ||||
} | ||||
#endif | ||||
#ifndef ODB_CXX11 | ||||
static void | static void | |||
data_migration_function (database& db, | data_migration_function (database& db, | |||
schema_version v, | schema_version v, | |||
data_migration_function_type f, | data_migration_function_ptr f, | |||
const std::string& name = "") | const std::string& name = "") | |||
{ | { | |||
data_migration_function (db.id (), v, f, name); | data_migration_function (db.id (), v, f, name); | |||
} | } | |||
#else | ||||
template <typename F> | ||||
static typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<data_migration_function_type>>::value, void>::type | ||||
data_migration_function (database& db, | ||||
schema_version v, | ||||
F f, | ||||
const std::string& name = "") | ||||
{ | ||||
data_migration_function (db.id (), v, std::move (f), name); | ||||
} | ||||
#endif | ||||
#ifndef ODB_CXX11 | ||||
static void | ||||
data_migration_function (database_id i, | ||||
schema_version v, | ||||
data_migration_function_ptr f, | ||||
const std::string& name = "") | ||||
{ | ||||
data_migration_function (i, | ||||
v, | ||||
data_migration_function_wrapper (f), | ||||
name); | ||||
} | ||||
#else | ||||
template <typename F> | ||||
static typename std::enable_if< | ||||
std::is_convertible< | ||||
F, std::function<data_migration_function_type>>::value, void>::type | ||||
data_migration_function (database_id i, | ||||
schema_version v, | ||||
F f, | ||||
const std::string& name = "") | ||||
{ | ||||
data_migration_function ( | ||||
i, | ||||
v, | ||||
data_migration_function_wrapper (std::move (f)), | ||||
name); | ||||
} | ||||
#endif | ||||
private: | ||||
static void | static void | |||
data_migration_function (database_id, | data_migration_function (database_id, | |||
schema_version, | schema_version, | |||
data_migration_function_type, | data_migration_function_wrapper, | |||
const std::string& name = ""); | const std::string& name); | |||
// Combined schema and data migration. | // Combined schema and data migration. | |||
// | // | |||
public: | public: | |||
// Migrate both schema and data to the specified version. If version | // Migrate both schema and data to the specified version. If version | |||
// is not specified, then migrate to the current model version. | // is not specified, then migrate to the current model version. | |||
// | // | |||
static void | static void | |||
migrate (database&, schema_version = 0, const std::string& name = ""); | migrate (database&, schema_version = 0, const std::string& name = ""); | |||
skipping to change at line 246 | skipping to change at line 343 | |||
migrate_mode); | migrate_mode); | |||
}; | }; | |||
// Static data migration function registration. | // Static data migration function registration. | |||
// | // | |||
template <schema_version v, schema_version base> | template <schema_version v, schema_version base> | |||
struct data_migration_entry | struct data_migration_entry | |||
{ | { | |||
typedef schema_catalog::data_migration_function_type function_type; | typedef schema_catalog::data_migration_function_type function_type; | |||
data_migration_entry (function_type f, const std::string& name = "") | #ifndef ODB_CXX11 | |||
data_migration_entry (function_type* f, const std::string& name = "") | ||||
{ | { | |||
schema_catalog::data_migration_function<v, base> (f, name); | schema_catalog::data_migration_function<v, base> (f, name); | |||
} | } | |||
#else | ||||
template <typename F> | ||||
data_migration_entry (F f, | ||||
const std::string& name = "", | ||||
typename std::enable_if<std::is_convertible< | ||||
F, std::function<function_type>>::value> | ||||
::type* = 0) | ||||
{ | ||||
schema_catalog::data_migration_function<v, base> (std::move (f), name | ||||
); | ||||
} | ||||
#endif | ||||
#ifndef ODB_CXX11 | ||||
data_migration_entry (database_id id, | data_migration_entry (database_id id, | |||
function_type f, | function_type *f, | |||
const std::string& name = "") | const std::string& name = "") | |||
{ | { | |||
schema_catalog::data_migration_function<v, base> (id, v, f, name); | schema_catalog::data_migration_function<v, base> (id, v, f, name); | |||
} | } | |||
#else | ||||
template <typename F> | ||||
data_migration_entry (database_id id, | ||||
F f, | ||||
const std::string& name = "", | ||||
typename std::enable_if<std::is_convertible< | ||||
F, std::function<function_type>>::value> | ||||
::type* = 0) | ||||
{ | ||||
schema_catalog::data_migration_function<v, base> (id, | ||||
v, | ||||
std::move (f), | ||||
name); | ||||
} | ||||
#endif | ||||
}; | }; | |||
namespace common | namespace common | |||
{ | { | |||
using odb::schema_catalog; | using odb::schema_catalog; | |||
using odb::data_migration_entry; | using odb::data_migration_entry; | |||
} | } | |||
} | } | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
End of changes. 28 change blocks. | ||||
21 lines changed or deleted | 149 lines changed or added | |||
schema-version.hxx | schema-version.hxx | |||
---|---|---|---|---|
// file : odb/schema-version.hxx | // file : odb/schema-version.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_SCHEMA_VERSION_HXX | #ifndef ODB_SCHEMA_VERSION_HXX | |||
#define ODB_SCHEMA_VERSION_HXX | #define ODB_SCHEMA_VERSION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> // schema_version | #include <odb/forward.hxx> // schema_version | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
section.hxx | section.hxx | |||
---|---|---|---|---|
// file : odb/section.hxx | // file : odb/section.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_SECTION_HXX | #ifndef ODB_SECTION_HXX | |||
#define ODB_SECTION_HXX | #define ODB_SECTION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/transaction.hxx> | #include <odb/transaction.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
session.hxx | session.hxx | |||
---|---|---|---|---|
// file : odb/session.hxx | // file : odb/session.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_SESSION_HXX | #ifndef ODB_SESSION_HXX | |||
#define ODB_SESSION_HXX | #define ODB_SESSION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <map> | #include <map> | |||
#include <typeinfo> | #include <typeinfo> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
session.ixx | session.ixx | |||
---|---|---|---|---|
// file : odb/session.ixx | // file : odb/session.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/exceptions.hxx> | #include <odb/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T> | template <typename T> | |||
inline void session:: | inline void session:: | |||
cache_erase (const cache_position<T>& p) | cache_erase (const cache_position<T>& p) | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
session.txx | session.txx | |||
---|---|---|---|---|
// file : odb/session.txx | // file : odb/session.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename T> | template <typename T> | |||
typename session::cache_position<T> session:: | typename session::cache_position<T> session:: | |||
cache_insert (database_type& db, | cache_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) | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
shared-ptr-fwd.hxx | shared-ptr-fwd.hxx | |||
---|---|---|---|---|
// file : odb/details/shared-ptr-fwd.hxx | // file : odb/details/shared-ptr-fwd.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_SHARED_PTR_FWD_HXX | #ifndef ODB_DETAILS_SHARED_PTR_FWD_HXX | |||
#define ODB_DETAILS_SHARED_PTR_FWD_HXX | #define ODB_DETAILS_SHARED_PTR_FWD_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/shared-ptr/counter-type.hxx> | #include <odb/details/shared-ptr/counter-type.hxx> | |||
namespace odb | namespace odb | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
shared-ptr.hxx | shared-ptr.hxx | |||
---|---|---|---|---|
// file : odb/details/shared-ptr.hxx | // file : odb/details/shared-ptr.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_SHARED_PTR_HXX | #ifndef ODB_DETAILS_SHARED_PTR_HXX | |||
#define ODB_DETAILS_SHARED_PTR_HXX | #define ODB_DETAILS_SHARED_PTR_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/shared-ptr-fwd.hxx> | #include <odb/details/shared-ptr-fwd.hxx> | |||
#include <odb/details/shared-ptr/base.hxx> | #include <odb/details/shared-ptr/base.hxx> | |||
#include <odb/details/shared-ptr/exception.hxx> | ||||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
template <typename X> | template <typename X> | |||
class shared_ptr: bits::counter_ops<typename bits::counter_type<X>::r, X> | class shared_ptr: bits::counter_ops<typename bits::counter_type<X>::r, X> | |||
{ | { | |||
typedef bits::counter_ops<typename bits::counter_type<X>::r, X> base; | typedef bits::counter_ops<typename bits::counter_type<X>::r, X> base; | |||
skipping to change at line 103 | skipping to change at line 104 | |||
X& | X& | |||
operator* () const | operator* () const | |||
{ | { | |||
return *x_; | return *x_; | |||
} | } | |||
// Conversion to bool. | // Conversion to bool. | |||
// | // | |||
typedef void (shared_ptr::*boolean_convertible)(); | typedef void (shared_ptr::*boolean_convertible)(); | |||
void true_value () {}; | void true_value () {} | |||
operator boolean_convertible () const | operator boolean_convertible () const | |||
{ | { | |||
return x_ ? &shared_ptr<X>::true_value : 0; | return x_ ? &shared_ptr<X>::true_value : 0; | |||
} | } | |||
public: | public: | |||
X* | X* | |||
get () const | get () const | |||
{ | { | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added | |||
simple-object-result.hxx | simple-object-result.hxx | |||
---|---|---|---|---|
// file : odb/simple-object-result.hxx | // file : odb/simple-object-result.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_SIMPLE_OBJECT_RESULT_HXX | #ifndef ODB_SIMPLE_OBJECT_RESULT_HXX | |||
#define ODB_SIMPLE_OBJECT_RESULT_HXX | #define ODB_SIMPLE_OBJECT_RESULT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
simple-object-result.txx | simple-object-result.txx | |||
---|---|---|---|---|
// file : odb/simple-object-result.txx | // file : odb/simple-object-result.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// object_result_impl | // object_result_impl | |||
// | // | |||
template <typename T> | template <typename T> | |||
void object_result_impl<T>:: | void object_result_impl<T>:: | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
statement-processing-common.hxx | statement-processing-common.hxx | |||
---|---|---|---|---|
// file : odb/statement-processingc-common.hxx | // file : odb/statement-processingc-common.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STATEMENT_PROCESSING_COMMON_HXX | #ifndef ODB_STATEMENT_PROCESSING_COMMON_HXX | |||
#define ODB_STATEMENT_PROCESSING_COMMON_HXX | #define ODB_STATEMENT_PROCESSING_COMMON_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
//#define LIBODB_DEBUG_STATEMENT_PROCESSING 1 | //#define LIBODB_DEBUG_STATEMENT_PROCESSING 1 | |||
//#define LIBODB_TRACE_STATEMENT_PROCESSING 1 | //#define LIBODB_TRACE_STATEMENT_PROCESSING 1 | |||
skipping to change at line 36 | skipping to change at line 36 | |||
static inline const char* | static inline const char* | |||
rfind (const char* b, const char* e, char c) | rfind (const char* b, const char* e, char c) | |||
{ | { | |||
for (--e; b != e; --e) | for (--e; b != e; --e) | |||
if (*e == c) | if (*e == c) | |||
return e; | return e; | |||
return 0; | return 0; | |||
} | } | |||
static inline const char* | ||||
find (const char* b, const char* e, const char* s, std::size_t n) | ||||
{ | ||||
for (; b != e; ++b) | ||||
{ | ||||
if (*b == *s && | ||||
static_cast<std::size_t> (e - b) >= n && | ||||
traits::compare (b, s, n) == 0) | ||||
return b; | ||||
} | ||||
return 0; | ||||
} | ||||
// Iterate over INSERT column/value list, UPDATE SET expression list, | // Iterate over INSERT column/value list, UPDATE SET expression list, | |||
// or SELECT column/join list. | // or SELECT column/join list. | |||
// | // | |||
// for (const char* b (columns_begin), *e (begin (b, end)); | // for (const char* b (columns_begin), *e (begin (b, end)); | |||
// e != 0; | // e != 0; | |||
// next (b, e, end)) | // next (b, e, end)) | |||
// { | // { | |||
// // b points to the beginning of the value (i.e., one past '('). | // // b points to the beginning of the value (i.e., one past '('). | |||
// // e points one past the end of the value (i.e., to ',', ')', or '\n '). | // // e points one past the end of the value (i.e., to ',', ')', or '\n '). | |||
// } | // } | |||
skipping to change at line 100 | skipping to change at line 114 | |||
e = find (b, end, '\n'); | e = find (b, end, '\n'); | |||
e = (e != 0 ? e - (*(e - 1) == ',' ? 1 : 0) : end); // Skip ','. | e = (e != 0 ? e - (*(e - 1) == ',' ? 1 : 0) : end); // Skip ','. | |||
} | } | |||
else | else | |||
{ | { | |||
b = (e != end ? e + 1 : end); // Skip past '\n'. | b = (e != end ? e + 1 : end); // Skip past '\n'. | |||
e = 0; | e = 0; | |||
} | } | |||
} | } | |||
// Only allows A-Z and spaces before prefix (e.g., JOIN in LEFT OUTER JOI | ||||
N). | ||||
// | ||||
static inline bool | ||||
fuzzy_prefix (const char* b, | ||||
const char* end, | ||||
const char* prefix, | ||||
std::size_t prefix_size) | ||||
{ | ||||
for (; b != end; ++b) | ||||
{ | ||||
char c (*b); | ||||
if ((c < 'A' || c > 'Z') && c != ' ') | ||||
break; | ||||
if (c == *prefix && | ||||
static_cast<std::size_t> (end - b) > prefix_size && | ||||
traits::compare (b, prefix, prefix_size) == 0) | ||||
return true; | ||||
} | ||||
return false; | ||||
} | ||||
static inline const char* | static inline const char* | |||
newline_begin (const char* b, const char* end) | newline_begin (const char* b, const char* end) | |||
{ | { | |||
// Note that the list may not end with '\n'. | // Note that the list may not end with '\n'. | |||
const char* e (find (b, end, '\n')); | const char* e (find (b, end, '\n')); | |||
return e != 0 ? e : end; | return e != 0 ? e : end; | |||
} | } | |||
static inline void | static inline void | |||
newline_next (const char*& b, | newline_next (const char*& b, | |||
const char*& e, | const char*& e, | |||
const char* end, | const char* end, | |||
const char* prefix, | const char* prefix, | |||
std::size_t prefix_size) | std::size_t prefix_size, | |||
bool prefix_fuzzy = false) | ||||
{ | { | |||
if (e != end) | if (e != end) | |||
e++; // Skip past '\n'. | e++; // Skip past '\n'. | |||
b = e; | b = e; | |||
// Do we have another element? | // Do we have another element? | |||
// | // | |||
if (static_cast<std::size_t> (end - b) > prefix_size && | if (static_cast<std::size_t> (end - b) > prefix_size && | |||
traits::compare (b, prefix, prefix_size) == 0) | (prefix_fuzzy | |||
? fuzzy_prefix (b, end, prefix, prefix_size) | ||||
: traits::compare (b, prefix, prefix_size) == 0)) | ||||
{ | { | |||
e = find (b, end, '\n'); | e = find (b, end, '\n'); | |||
if (e == 0) | if (e == 0) | |||
e = end; | e = end; | |||
} | } | |||
else | else | |||
e = 0; | e = 0; | |||
} | } | |||
// Note that end must point to the beginning of the list. | // Note that end must point to the beginning of the list. | |||
End of changes. 5 change blocks. | ||||
3 lines changed or deleted | 45 lines changed or added | |||
statement.hxx | statement.hxx | |||
---|---|---|---|---|
// file : odb/statement.hxx | // file : odb/statement.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STATEMENT_HXX | #ifndef ODB_STATEMENT_HXX | |||
#define ODB_STATEMENT_HXX | #define ODB_STATEMENT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <string> | #include <string> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
skipping to change at line 88 | skipping to change at line 88 | |||
std::size_t bind_skip, // Offset to the next bind. | std::size_t bind_skip, // Offset to the next bind. | |||
char param_symbol, // $, ?, :, etc. | char param_symbol, // $, ?, :, etc. | |||
std::string& result); | std::string& result); | |||
// Expected statement structure: | // Expected statement structure: | |||
// | // | |||
// SELECT\n | // SELECT\n | |||
// [schema.]table.a,\n | // [schema.]table.a,\n | |||
// alias.b\n | // alias.b\n | |||
// FROM [schema.]table[\n] | // FROM [schema.]table[\n] | |||
// [LEFT JOIN [schema.]table [AS alias] ON ...[\n]]* | // [{A-Z }* JOIN [schema.]table [AS alias][ ON ...][\n]]* | |||
// [WHERE ...] | // [WHERE ...] | |||
// | // | |||
static void | static void | |||
process_select (const char* statement, | process_select (const char* statement, | |||
const void* const* bind, // Array of bind buffer pointe rs. | const void* const* bind, // Array of bind buffer pointe rs. | |||
std::size_t bind_size, // Number of bind elements. | std::size_t bind_size, // Number of bind elements. | |||
std::size_t bind_skip, // Offset to the next bind. | std::size_t bind_skip, // Offset to the next bind. | |||
char quote_open, // Identifier opening quote. | char quote_open, // Identifier opening quote. | |||
char quote_close, // Identifier closing quote. | char quote_close, // Identifier closing quote. | |||
bool optimize, // Remove unused JOINs. | bool optimize, // Remove unused JOINs. | |||
End of changes. 2 change blocks. | ||||
2 lines changed or deleted | 2 lines changed or added | |||
static-assert.hxx | static-assert.hxx | |||
---|---|---|---|---|
// file : odb/details/meta/static-assert.hxx | // file : odb/details/meta/static-assert.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_META_STATIC_ASSERT_HXX | #ifndef ODB_DETAILS_META_STATIC_ASSERT_HXX | |||
#define ODB_DETAILS_META_STATIC_ASSERT_HXX | #define ODB_DETAILS_META_STATIC_ASSERT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
#ifndef ODB_CXX11 | #ifndef ODB_CXX11 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-array-traits.hxx | std-array-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-array-traits.hxx | // file : odb/std-array-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_ARRAY_TRAITS_HXX | #ifndef ODB_STD_ARRAY_TRAITS_HXX | |||
#define ODB_STD_ARRAY_TRAITS_HXX | #define ODB_STD_ARRAY_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <array> | #include <array> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
#include <cassert> | #include <cassert> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-forward-list-traits.hxx | std-forward-list-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-forward-list-traits.hxx | // file : odb/std-forward-list-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_FORWARD_LIST_TRAITS_HXX | #ifndef ODB_STD_FORWARD_LIST_TRAITS_HXX | |||
#define ODB_STD_FORWARD_LIST_TRAITS_HXX | #define ODB_STD_FORWARD_LIST_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <forward_list> | #include <forward_list> | |||
#include <odb/container-traits.hxx> | #include <odb/container-traits.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-list-traits.hxx | std-list-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-list-traits.hxx | // file : odb/std-list-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_LIST_TRAITS_HXX | #ifndef ODB_STD_LIST_TRAITS_HXX | |||
#define ODB_STD_LIST_TRAITS_HXX | #define ODB_STD_LIST_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <list> | #include <list> | |||
#include <odb/container-traits.hxx> | #include <odb/container-traits.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-map-traits.hxx | std-map-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-map-traits.hxx | // file : odb/std-map-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_MAP_TRAITS_HXX | #ifndef ODB_STD_MAP_TRAITS_HXX | |||
#define ODB_STD_MAP_TRAITS_HXX | #define ODB_STD_MAP_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <map> | #include <map> | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-set-traits.hxx | std-set-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-set-traits.hxx | // file : odb/std-set-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_SET_TRAITS_HXX | #ifndef ODB_STD_SET_TRAITS_HXX | |||
#define ODB_STD_SET_TRAITS_HXX | #define ODB_STD_SET_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <set> | #include <set> | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-unordered-map-traits.hxx | std-unordered-map-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-unordered-map-traits.hxx | // file : odb/std-unordered-map-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_UNORDERED_MAP_TRAITS_HXX | #ifndef ODB_STD_UNORDERED_MAP_TRAITS_HXX | |||
#define ODB_STD_UNORDERED_MAP_TRAITS_HXX | #define ODB_STD_UNORDERED_MAP_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <utility> // std::move | #include <utility> // std::move | |||
#include <unordered_map> | #include <unordered_map> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-unordered-set-traits.hxx | std-unordered-set-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-unordered-set-traits.hxx | // file : odb/std-unordered-set-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_UNORDERED_SET_TRAITS_HXX | #ifndef ODB_STD_UNORDERED_SET_TRAITS_HXX | |||
#define ODB_STD_UNORDERED_SET_TRAITS_HXX | #define ODB_STD_UNORDERED_SET_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <utility> // std::move | #include <utility> // std::move | |||
#include <unordered_set> | #include <unordered_set> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
std-vector-traits.hxx | std-vector-traits.hxx | |||
---|---|---|---|---|
// file : odb/std-vector-traits.hxx | // file : odb/std-vector-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_STD_VECTOR_TRAITS_HXX | #ifndef ODB_STD_VECTOR_TRAITS_HXX | |||
#define ODB_STD_VECTOR_TRAITS_HXX | #define ODB_STD_VECTOR_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <vector> | #include <vector> | |||
#include <odb/container-traits.hxx> | #include <odb/container-traits.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
thread.hxx | thread.hxx | |||
---|---|---|---|---|
// file : odb/details/thread.hxx | // file : odb/details/thread.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_THREAD_HXX | #ifndef ODB_DETAILS_THREAD_HXX | |||
#define ODB_DETAILS_THREAD_HXX | #define ODB_DETAILS_THREAD_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> | #include <odb/details/config.hxx> | |||
#ifdef ODB_THREADS_NONE | #ifdef ODB_THREADS_NONE | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
thread.ixx | thread.ixx | |||
---|---|---|---|---|
// file : odb/details/posix/thread.ixx | // file : odb/details/posix/thread.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/details/posix/exceptions.hxx> | #include <odb/details/posix/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
inline thread:: | inline thread:: | |||
~thread () | ~thread () | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
tls.hxx | tls.hxx | |||
---|---|---|---|---|
// file : odb/details/tls.hxx | // file : odb/details/tls.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_TLS_HXX | #ifndef ODB_DETAILS_TLS_HXX | |||
#define ODB_DETAILS_TLS_HXX | #define ODB_DETAILS_TLS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> | #include <odb/details/config.hxx> | |||
#ifdef ODB_THREADS_NONE | #ifdef ODB_THREADS_NONE | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
tls.ixx | tls.ixx | |||
---|---|---|---|---|
// file : odb/details/posix/tls.ixx | // file : odb/details/posix/tls.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
template <typename T> | template <typename T> | |||
inline tls<T>:: | inline tls<T>:: | |||
tls () | tls () | |||
{ | { | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
tls.txx | tls.txx | |||
---|---|---|---|---|
// file : odb/details/posix/tls.txx | // file : odb/details/posix/tls.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/details/unique-ptr.hxx> | #include <odb/details/unique-ptr.hxx> | |||
#include <odb/details/posix/exceptions.hxx> | #include <odb/details/posix/exceptions.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
{ | { | |||
// tls<T> | // tls<T> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
tracer.hxx | tracer.hxx | |||
---|---|---|---|---|
// file : odb/tracer.hxx | // file : odb/tracer.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_TRACER_HXX | #ifndef ODB_TRACER_HXX | |||
#define ODB_TRACER_HXX | #define ODB_TRACER_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
traits.hxx | traits.hxx | |||
---|---|---|---|---|
// file : odb/traits.hxx | // file : odb/traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_TRAITS_HXX | #ifndef ODB_TRAITS_HXX | |||
#define ODB_TRAITS_HXX | #define ODB_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/forward.hxx> | #include <odb/forward.hxx> | |||
#include <odb/pointer-traits.hxx> | #include <odb/pointer-traits.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
// Fallback dummy for non-persistent classes. It is necessary to allow | ||||
// the C++ compiler to instantiate persist(), etc., signatures in class | ||||
// database when T is a pointer (raw, smart). The overloads that use | ||||
// these dummy would never actually be selected by the compiler. | ||||
// | ||||
template <typename T> | ||||
class access::object_traits | ||||
{ | ||||
// If a C++ compiler issues an error pointing to this class and saying | ||||
// that it is missing some declaration, then you are most likely trying | ||||
// to perform a database operation on a C++ type that is not a persiste | ||||
nt | ||||
// object. Or you forgot to include the corresponding -odb.hxx file. | ||||
// | ||||
public: | ||||
struct id_type {}; | ||||
typedef T object_type; | ||||
typedef T* pointer_type; | ||||
static const bool polymorphic = false; | ||||
}; | ||||
template <typename T, typename P> | template <typename T, typename P> | |||
class access::object_factory | class access::object_factory | |||
{ | { | |||
public: | public: | |||
typedef T object_type; | typedef T object_type; | |||
typedef P pointer_type; | typedef P pointer_type; | |||
static P | static P | |||
create () | create () | |||
{ | { | |||
skipping to change at line 143 | skipping to change at line 164 | |||
public: | public: | |||
typedef typename access::object_traits<T>::id_type id_type; | typedef typename access::object_traits<T>::id_type id_type; | |||
typedef typename access::object_traits<T>::object_type object_type; | typedef typename access::object_traits<T>::object_type object_type; | |||
typedef typename pointer_traits::const_pointer_type const_pointer_type; | typedef typename pointer_traits::const_pointer_type const_pointer_type; | |||
typedef const_pointer_type pointer_type; | typedef const_pointer_type pointer_type; | |||
static const bool polymorphic = access::object_traits<T>::polymorphic; | static const bool polymorphic = access::object_traits<T>::polymorphic; | |||
}; | }; | |||
// Specializations for pointer types to allow the C++ compiler to | ||||
// instantiate persist(), etc., signatures in class database. The | ||||
// overloads that use these specializations would never actually | ||||
// be selected by the compiler. | ||||
// | ||||
template <typename T> | ||||
struct object_traits<T*> | ||||
{ | ||||
struct id_type {}; | ||||
}; | ||||
template <typename T> | ||||
struct object_traits<T* const> | ||||
{ | ||||
struct id_type {}; | ||||
}; | ||||
template <typename T, template <typename> class P> | ||||
struct object_traits<P<T> > | ||||
{ | ||||
struct id_type {}; | ||||
}; | ||||
template <typename T, typename A1, template <typename, typename> class P> | ||||
struct object_traits<P<T, A1> > | ||||
{ | ||||
struct id_type {}; | ||||
}; | ||||
template <typename T, template <typename> class P> | ||||
struct object_traits<const P<T> > | ||||
{ | ||||
struct id_type {}; | ||||
}; | ||||
template <typename T, typename A1, template <typename, typename> class P> | ||||
struct object_traits<const P<T, A1> > | ||||
{ | ||||
struct id_type {}; | ||||
}; | ||||
// Specialization for section to allow instantiation of all the load() | // Specialization for section to allow instantiation of all the load() | |||
// signature. | // signature. | |||
// | // | |||
template <> | template <> | |||
struct object_traits<section> {}; | struct object_traits<section> {}; | |||
template <typename T, database_id DB> | template <typename T, database_id DB> | |||
// | // | |||
// If a C++ compiler issues an error pointing to this struct and | // If a C++ compiler issues an error pointing to this struct and | |||
// saying that it is incomplete, then you are most likely trying to | // saying that it is incomplete, then you are most likely trying to | |||
End of changes. 3 change blocks. | ||||
42 lines changed or deleted | 23 lines changed or added | |||
transaction.hxx | transaction.hxx | |||
---|---|---|---|---|
// file : odb/transaction.hxx | // file : odb/transaction.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_TRANSACTION_HXX | #ifndef ODB_TRANSACTION_HXX | |||
#define ODB_TRANSACTION_HXX | #define ODB_TRANSACTION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <vector> | #include <vector> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
transaction.ixx | transaction.ixx | |||
---|---|---|---|---|
// file : odb/transaction.ixx | // file : odb/transaction.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#include <odb/connection.hxx> | #include <odb/connection.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
inline transaction:: | inline transaction:: | |||
transaction () | transaction () | |||
: finalized_ (true), | : finalized_ (true), | |||
impl_ (0), | impl_ (0), | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
transfer-ptr.hxx | transfer-ptr.hxx | |||
---|---|---|---|---|
// file : odb/details/transfer-ptr.hxx | // file : odb/details/transfer-ptr.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_TRANSFER_PTR_HXX | #ifndef ODB_DETAILS_TRANSFER_PTR_HXX | |||
#define ODB_DETAILS_TRANSFER_PTR_HXX | #define ODB_DETAILS_TRANSFER_PTR_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <memory> // std::auto_ptr, std::unique_ptr | #include <memory> // std::auto_ptr, std::unique_ptr | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
type-info.hxx | type-info.hxx | |||
---|---|---|---|---|
// file : odb/details/type-info.hxx | // file : odb/details/type-info.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_TYPE_INFO_HXX | #ifndef ODB_DETAILS_TYPE_INFO_HXX | |||
#define ODB_DETAILS_TYPE_INFO_HXX | #define ODB_DETAILS_TYPE_INFO_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <typeinfo> | #include <typeinfo> | |||
#include <odb/details/export.hxx> | #include <odb/details/export.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
unique-ptr.hxx | unique-ptr.hxx | |||
---|---|---|---|---|
// file : odb/details/unique-ptr.hxx | // file : odb/details/unique-ptr.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_UNIQUE_PTR_HXX | #ifndef ODB_DETAILS_UNIQUE_PTR_HXX | |||
#define ODB_DETAILS_UNIQUE_PTR_HXX | #define ODB_DETAILS_UNIQUE_PTR_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
namespace odb | namespace odb | |||
{ | { | |||
namespace details | namespace details | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
unused.hxx | unused.hxx | |||
---|---|---|---|---|
// file : odb/details/unused.hxx | // file : odb/details/unused.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_UNUSED_DETAILS_HXX | #ifndef ODB_UNUSED_DETAILS_HXX | |||
#define ODB_UNUSED_DETAILS_HXX | #define ODB_UNUSED_DETAILS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
// VC++ doesn't like the (void)x expression if x is a reference to | // VC++ doesn't like the (void)x expression if x is a reference to | |||
// an incomplete type. On the other hand, GCC warns that (void*)&x | // an incomplete type. On the other hand, GCC warns that (void*)&x | |||
// doesn't have any effect. | // doesn't have any effect. | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
vector-impl.hxx | vector-impl.hxx | |||
---|---|---|---|---|
// file : odb/vector-impl.hxx | // file : odb/vector-impl.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_VECTOR_IMPL_HXX | #ifndef ODB_VECTOR_IMPL_HXX | |||
#define ODB_VECTOR_IMPL_HXX | #define ODB_VECTOR_IMPL_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
#include <new> | #include <new> | |||
#include <cstddef> // std::size_t | #include <cstddef> // std::size_t | |||
skipping to change at line 177 | skipping to change at line 177 | |||
// Base class that provides a change tracking interface and | // Base class that provides a change tracking interface and | |||
// handles the rollback callback. The only function that's | // handles the rollback callback. The only function that's | |||
// missing is _start() which needs to know the number of | // missing is _start() which needs to know the number of | |||
// elements currently in the vector. | // elements currently in the vector. | |||
// | // | |||
class LIBODB_EXPORT vector_base | class LIBODB_EXPORT vector_base | |||
{ | { | |||
public: | public: | |||
void | void | |||
_stop () const {impl_.stop ();} | _stop () const; | |||
bool | bool | |||
_tracking () const {return impl_.tracking ();} | _tracking () const; | |||
void | void | |||
_arm (transaction& t) const; | _arm (transaction& t) const; | |||
vector_impl& | vector_impl& | |||
_impl () const {return impl_;} | _impl () const {return impl_;} | |||
private: | private: | |||
// Assignment is changing of the content. | // Assignment is changing of the content. | |||
// | // | |||
vector_base& operator= (const vector_base&); | vector_base& operator= (const vector_base&); | |||
protected: | protected: | |||
vector_base (): tran_ (0) {} | ~vector_base (); | |||
~vector_base () {if (tran_ != 0) tran_->callback_unregister (this);} | vector_base (); | |||
vector_base (const vector_base&); | vector_base (const vector_base&); | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
vector_base (vector_base&&); | vector_base (vector_base&&); | |||
#endif | #endif | |||
void | void | |||
swap (vector_base&); | swap (vector_base&); | |||
static void | static void | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
vector-impl.ixx | vector-impl.ixx | |||
---|---|---|---|---|
// file : odb/vector-impl.ixx | // file : odb/vector-impl.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
# include <utility> // std::swap, std::move | # include <utility> // std::swap, std::move | |||
#else | #else | |||
# include <algorithm> // std::swap | # include <algorithm> // std::swap | |||
#endif | #endif | |||
namespace odb | namespace odb | |||
{ | { | |||
skipping to change at line 103 | skipping to change at line 103 | |||
inline vector_impl::element_state_type vector_impl:: | inline vector_impl::element_state_type vector_impl:: | |||
state (std::size_t i) const | state (std::size_t i) const | |||
{ | { | |||
std::size_t r (i % 4); | std::size_t r (i % 4); | |||
unsigned char v (data_[i / 4]); | unsigned char v (data_[i / 4]); | |||
return static_cast<element_state_type> ((v & mask_[r]) >> shift_[r]); | return static_cast<element_state_type> ((v & mask_[r]) >> shift_[r]); | |||
} | } | |||
inline void vector_impl:: | inline void vector_impl:: | |||
set (std::size_t i, element_state_type s) | ||||
{ | ||||
std::size_t r (i % 4); | ||||
i /= 4; | ||||
unsigned char v (static_cast<unsigned char> (s)); | ||||
v <<= shift_[r]; | ||||
data_[i] = (data_[i] & ~mask_[r]) | v; | ||||
} | ||||
inline void vector_impl:: | ||||
modify (std::size_t i, std::size_t n) | modify (std::size_t i, std::size_t n) | |||
{ | { | |||
for (; n != 0; --n, ++i) | for (; n != 0; --n, ++i) | |||
if (state (i) != state_inserted) | if (state (i) != state_inserted) | |||
set (i, state_updated); | set (i, state_updated); | |||
} | } | |||
inline void vector_impl:: | inline void vector_impl:: | |||
assign (std::size_t n) | assign (std::size_t n) | |||
{ | { | |||
skipping to change at line 128 | skipping to change at line 138 | |||
inline void vector_impl:: | inline void vector_impl:: | |||
resize (size_t n) | resize (size_t n) | |||
{ | { | |||
if (n < tail_) | if (n < tail_) | |||
pop_back (tail_ - n); | pop_back (tail_ - n); | |||
else if (n > tail_) | else if (n > tail_) | |||
push_back (n - tail_); | push_back (n - tail_); | |||
} | } | |||
inline void vector_impl:: | // vector_base | |||
set (std::size_t i, element_state_type s) | // | |||
inline vector_base:: | ||||
~vector_base () | ||||
{ | { | |||
std::size_t r (i % 4); | if (tran_ != 0) | |||
i /= 4; | tran_->callback_unregister (this); | |||
unsigned char v (static_cast<unsigned char> (s)); | } | |||
v <<= shift_[r]; | ||||
data_[i] = (data_[i] & ~mask_[r]) | v; | inline vector_base:: | |||
vector_base (): tran_ (0) {} | ||||
inline vector_base:: | ||||
vector_base (const vector_base& x) | ||||
: impl_ (x.impl_), tran_ (0) | ||||
{ | ||||
// If the original is armed, then arm ourselves as well. | ||||
// | ||||
if (x.tran_ != 0) | ||||
_arm (*x.tran_); | ||||
} | ||||
inline void vector_base:: | ||||
swap (vector_base& x) | ||||
{ | ||||
impl_.swap (x.impl_); | ||||
if (tran_ != 0 || x.tran_ != 0) | ||||
swap_tran (x); | ||||
} | } | |||
// vector_base | ||||
// | ||||
#ifdef ODB_CXX11 | #ifdef ODB_CXX11 | |||
inline vector_base:: | inline vector_base:: | |||
vector_base (vector_base&& x) | vector_base (vector_base&& x) | |||
: impl_ (std::move (x.impl_)), tran_ (0) | : impl_ (std::move (x.impl_)), tran_ (0) | |||
{ | { | |||
if (x.tran_ != 0) | if (x.tran_ != 0) | |||
{ | { | |||
x.tran_->callback_unregister (&x); | x.tran_->callback_unregister (&x); | |||
_arm (*x.tran_); | _arm (*x.tran_); | |||
} | } | |||
} | } | |||
#endif | #endif | |||
inline void vector_base:: | inline void vector_base:: | |||
_arm (transaction& t) const | _stop () const | |||
{ | { | |||
tran_ = &t; | impl_.stop (); | |||
t.callback_register (&rollback, | ||||
const_cast<vector_base*> (this), | ||||
transaction::event_rollback, | ||||
0, | ||||
&tran_); | ||||
} | } | |||
inline vector_base:: | inline bool vector_base:: | |||
vector_base (const vector_base& x) | _tracking () const | |||
: impl_ (x.impl_), tran_ (0) | ||||
{ | { | |||
// If the original is armed, then arm ourselves as well. | return impl_.tracking (); | |||
// | ||||
if (x.tran_ != 0) | ||||
_arm (*x.tran_); | ||||
} | } | |||
inline void vector_base:: | inline void vector_base:: | |||
swap (vector_base& x) | _arm (transaction& t) const | |||
{ | { | |||
impl_.swap (x.impl_); | tran_ = &t; | |||
t.callback_register (&rollback, | ||||
if (tran_ != 0 || x.tran_ != 0) | const_cast<vector_base*> (this), | |||
swap_tran (x); | transaction::event_rollback, | |||
0, | ||||
&tran_); | ||||
} | } | |||
} | } | |||
End of changes. 11 change blocks. | ||||
29 lines changed or deleted | 51 lines changed or added | |||
vector-traits.hxx | vector-traits.hxx | |||
---|---|---|---|---|
// file : odb/vector-traits.hxx | // file : odb/vector-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_VECTOR_TRAITS_HXX | #ifndef ODB_VECTOR_TRAITS_HXX | |||
#define ODB_VECTOR_TRAITS_HXX | #define ODB_VECTOR_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/vector.hxx> | #include <odb/vector.hxx> | |||
#include <odb/vector-impl.hxx> | #include <odb/vector-impl.hxx> | |||
#include <odb/container-traits.hxx> | #include <odb/container-traits.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
vector-traits.txx | vector-traits.txx | |||
---|---|---|---|---|
// file : odb/vector-traits.txx | // file : odb/vector-traits.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
template <typename V, typename A LIBODB_VECTOR_ARG_DECL> | template <typename V, typename A LIBODB_VECTOR_ARG_DECL> | |||
bool access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >:: | bool access::container_traits<vector<V, A LIBODB_VECTOR_ARG_USE> >:: | |||
changed (const container_type& c) | changed (const container_type& c) | |||
{ | { | |||
// Because modifications can cancel each other (e.g., push and pop), | // Because modifications can cancel each other (e.g., push and pop), | |||
// it is tricky to keep track of whether there are any changes in | // it is tricky to keep track of whether there are any changes in | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
vector.hxx | vector.hxx | |||
---|---|---|---|---|
// file : odb/vector.hxx | // file : odb/vector.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_VECTOR_HXX | #ifndef ODB_VECTOR_HXX | |||
#define ODB_VECTOR_HXX | #define ODB_VECTOR_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/details/config.hxx> // ODB_CXX11 | #include <odb/details/config.hxx> // ODB_CXX11 | |||
#include <vector> | #include <vector> | |||
#include <iterator> | #include <iterator> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
vector.ixx | vector.ixx | |||
---|---|---|---|---|
// file : odb/vector.ixx | // file : odb/vector.ixx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// construct/copy/destroy: | // construct/copy/destroy: | |||
// | // | |||
template <class T, class A LIBODB_VECTOR_ARG_DECL> | template <class T, class A LIBODB_VECTOR_ARG_DECL> | |||
inline vector<T, A LIBODB_VECTOR_ARG_USE>& | inline vector<T, A LIBODB_VECTOR_ARG_USE>& | |||
vector<T, A LIBODB_VECTOR_ARG_USE>:: | vector<T, A LIBODB_VECTOR_ARG_USE>:: | |||
operator= (const vector& x) | operator= (const vector& x) | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
version.hxx | version.hxx | |||
---|---|---|---|---|
// file : odb/version.hxx | // file : odb/version.hxx | |||
// copyright : Copyright (c) 2005-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2005-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_VERSION_HXX | #ifndef ODB_VERSION_HXX | |||
#define ODB_VERSION_HXX | #define ODB_VERSION_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
// Version format is AABBCCDD where | // Version format is AABBCCDD where | |||
// | // | |||
// AA - major version number | // AA - major version number | |||
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 20300 | #define ODB_VERSION 20400 | |||
#define ODB_VERSION_STR "2.3" | #define ODB_VERSION_STR "2.4" | |||
// libodb version: interface version plus the bugfix version. | // libodb version: interface version plus the bugfix version. | |||
// | // | |||
#define LIBODB_VERSION 2030000 | #define LIBODB_VERSION 2040000 | |||
#define LIBODB_VERSION_STR "2.3.0" | #define LIBODB_VERSION_STR "2.4.0" | |||
#include <odb/post.hxx> | #include <odb/post.hxx> | |||
#endif // ODB_VERSION_HXX | #endif // ODB_VERSION_HXX | |||
End of changes. 3 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added | |||
view-result.hxx | view-result.hxx | |||
---|---|---|---|---|
// file : odb/view-result.hxx | // file : odb/view-result.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_VIEW_RESULT_HXX | #ifndef ODB_VIEW_RESULT_HXX | |||
#define ODB_VIEW_RESULT_HXX | #define ODB_VIEW_RESULT_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <cstddef> // std::ptrdiff_t, std::size_t | #include <cstddef> // std::ptrdiff_t, std::size_t | |||
#include <iterator> // iterator categories | #include <iterator> // iterator categories | |||
#include <utility> // std::move | #include <utility> // std::move | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
view-result.txx | view-result.txx | |||
---|---|---|---|---|
// file : odb/view-result.txx | // file : odb/view-result.txx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
namespace odb | namespace odb | |||
{ | { | |||
// | // | |||
// view_result_impl | // view_result_impl | |||
// | // | |||
template <typename T> | template <typename T> | |||
typename view_result_impl<T>::pointer_type& | typename view_result_impl<T>::pointer_type& | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
wrapper-p.hxx | wrapper-p.hxx | |||
---|---|---|---|---|
// file : odb/details/wrapper-p.hxx | // file : odb/details/wrapper-p.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_DETAILS_WRAPPER_P_HXX | #ifndef ODB_DETAILS_WRAPPER_P_HXX | |||
#define ODB_DETAILS_WRAPPER_P_HXX | #define ODB_DETAILS_WRAPPER_P_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <odb/wrapper-traits.hxx> | #include <odb/wrapper-traits.hxx> | |||
#include <odb/details/meta/answer.hxx> | #include <odb/details/meta/answer.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||
wrapper-traits.hxx | wrapper-traits.hxx | |||
---|---|---|---|---|
// file : odb/wrapper-traits.hxx | // file : odb/wrapper-traits.hxx | |||
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC | // copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC | |||
// license : GNU GPL v2; see accompanying LICENSE file | // license : GNU GPL v2; see accompanying LICENSE file | |||
#ifndef ODB_WRAPPER_TRAITS_HXX | #ifndef ODB_WRAPPER_TRAITS_HXX | |||
#define ODB_WRAPPER_TRAITS_HXX | #define ODB_WRAPPER_TRAITS_HXX | |||
#include <odb/pre.hxx> | #include <odb/pre.hxx> | |||
#include <memory> // std::auto_ptr, std::unique_ptr, std::shared_ptr/weak_p tr | #include <memory> // std::auto_ptr, std::unique_ptr, std::shared_ptr/weak_p tr | |||
#include <odb/nullable.hxx> | #include <odb/nullable.hxx> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added | |||