blob: 2a904a44723a0157213cca1136167243acb6bb74 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
// file : odb/database.hxx
// author : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2010 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef ODB_DATABASE_HXX
#define ODB_DATABASE_HXX
#include <odb/traits.hxx>
#include <odb/forward.hxx>
namespace odb
{
class transaction_impl;
class database
{
public:
virtual
~database ();
template <typename T, template <typename> class P>
typename object_traits<T>::id_type
persist (P<T> obj);
template <typename T>
typename object_traits<T>::shared_ptr
load (typename object_traits<T>::id_type const&);
template <typename T>
typename object_traits<T>::shared_ptr
find (typename object_traits<T>::id_type const&);
template <typename T, template <typename> class P>
void
erase (P<T> obj);
template <typename T, template <typename> class P>
void
modified (P<T> obj);
// Transaction API.
//
public:
// Start a transaction. If an existing session can be obtained via
// session::current(), the transaction is run as part of that session.
// Otherwise a new session is created and will be automatically flushed
// and destroyed when transaction ends.
//
virtual transaction_impl*
begin_transaction () = 0;
// Start a transaction as part of an existing session. The session
// is not automatically flushed or destroyed when transaction ends.
//
virtual transaction_impl*
begin_transaction (session&) = 0;
protected:
database ();
private:
database (const database&);
database& operator= (const database&);
};
}
#include <odb/database.ixx>
#include <odb/database.txx>
#endif // ODB_DATABASE_HXX
|