Oracle ODB Runtime Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
traits-calls.hxx
Go to the documentation of this file.
1 // file : odb/oracle/traits-calls.hxx
2 // copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
3 // license : ODB NCUEL; see accompanying LICENSE file
4 
5 #ifndef ODB_ORACLE_TRAITS_CALLS_HXX
6 #define ODB_ORACLE_TRAITS_CALLS_HXX
7 
8 #include <odb/pre.hxx>
9 
10 #include <cstddef> // std::size_t
11 
12 #include <odb/forward.hxx>
13 #include <odb/schema-version.hxx>
14 #include <odb/traits.hxx>
15 
16 #include <odb/oracle/forward.hxx>
18 
19 namespace odb
20 {
21  namespace oracle
22  {
23  //
24  // object_traits_calls
25  //
26 
27  template <typename T,
28  bool versioned = object_traits_impl<T, id_oracle>::versioned>
30 
31  template <typename T>
32  struct object_traits_calls<T, false>
33  {
35  typedef typename traits::image_type image_type;
37 
39 
41  version () const {return 0;}
42 
43  static void
45  {
46  traits::bind (b, i, sk);
47  }
48 
49  // Poly-derived version.
50  //
51  static void
53  const bind_type* id, std::size_t id_size,
54  image_type& i,
55  statement_kind sk)
56  {
57  traits::bind (b, id, id_size, i, sk);
58  }
59 
60  static void
61  init (T& o, const image_type& i, odb::database* db)
62  {
63  traits::init (o, i, db);
64  }
65 
66  static bool
67  find_ (typename traits::statements_type& sts,
68  const typename traits::id_type* id)
69  {
70  return traits::find_ (sts, id);
71  }
72 
73  static void
74  load_ (typename traits::statements_type& sts, T& o, bool reload)
75  {
76  return traits::load_ (sts, o, reload);
77  }
78  };
79 
80  template <typename T>
81  struct object_traits_calls<T, true>
82  {
84  typedef typename traits::image_type image_type;
86 
87  object_traits_calls (const schema_version_migration* svm): svm_ (*svm) {}
88 
90  version () const {return &svm_;}
91 
92  void
94  {
95  traits::bind (b, i, sk, svm_);
96  }
97 
98  // Poly-derived version.
99  //
100  void
102  const bind_type* id, std::size_t id_size,
103  image_type& i,
104  statement_kind sk) const
105  {
106  traits::bind (b, id, id_size, i, sk, svm_);
107  }
108 
109  void
110  init (T& o, const image_type& i, odb::database* db) const
111  {
112  traits::init (o, i, db, svm_);
113  }
114 
115  bool
116  find_ (typename traits::statements_type& sts,
117  const typename traits::id_type* id) const
118  {
119  return traits::find_ (sts, id, svm_);
120  }
121 
122  void
123  load_ (typename traits::statements_type& sts, T& o, bool reload) const
124  {
125  return traits::load_ (sts, o, reload, svm_);
126  }
127 
128  private:
129  const schema_version_migration& svm_;
130  };
131 
132  //
133  // view_traits_calls
134  //
135 
136  template <typename T,
139 
140  template <typename T>
141  struct view_traits_calls<T, false>
142  {
144  typedef typename traits::image_type image_type;
146 
148 
149  static void
151  {
152  traits::bind (b, i);
153  }
154 
155  static void
156  init (T& o, const image_type& i, odb::database* db)
157  {
158  traits::init (o, i, db);
159  }
160  };
161 
162  template <typename T>
163  struct view_traits_calls<T, true>
164  {
166  typedef typename traits::image_type image_type;
168 
169  view_traits_calls (const schema_version_migration* svm): svm_ (*svm) {}
170 
171  void
172  bind (bind_type* b, image_type& i) const
173  {
174  traits::bind (b, i, svm_);
175  }
176 
177  void
178  init (T& o, const image_type& i, odb::database* db) const
179  {
180  traits::init (o, i, db, svm_);
181  }
182 
183  private:
184  const schema_version_migration& svm_;
185  };
186  }
187 }
188 
189 #include <odb/post.hxx>
190 
191 #endif // ODB_ORACLE_TRAITS_CALLS_HXX
void init(T &o, const image_type &i, odb::database *db) const
Definition: traits-calls.hxx:178
void bind(bind_type *b, const bind_type *id, std::size_t id_size, image_type &i, statement_kind sk) const
Definition: traits-calls.hxx:101
static void bind(bind_type *b, const bind_type *id, std::size_t id_size, image_type &i, statement_kind sk)
Definition: traits-calls.hxx:52
traits::image_type image_type
Definition: traits-calls.hxx:35
object_traits_impl< T, id_oracle > traits
Definition: traits-calls.hxx:83
void bind(bind_type *b, image_type &i, statement_kind sk) const
Definition: traits-calls.hxx:93
oracle::bind bind_type
Definition: traits-calls.hxx:145
static void init(T &o, const image_type &i, odb::database *db)
Definition: traits-calls.hxx:61
view_traits_calls(const schema_version_migration *)
Definition: traits-calls.hxx:147
oracle::bind bind_type
Definition: traits-calls.hxx:85
view_traits_impl< T, id_oracle > traits
Definition: traits-calls.hxx:143
void bind(bind_type *b, image_type &i) const
Definition: traits-calls.hxx:172
Definition: traits-calls.hxx:29
const schema_version_migration * version() const
Definition: traits-calls.hxx:41
statement_kind
Definition: forward.hxx:42
object_traits_calls(const schema_version_migration *)
Definition: traits-calls.hxx:38
oracle::bind bind_type
Definition: traits-calls.hxx:36
static bool find_(typename traits::statements_type &sts, const typename traits::id_type *id)
Definition: traits-calls.hxx:67
object_traits_calls(const schema_version_migration *svm)
Definition: traits-calls.hxx:87
traits::image_type image_type
Definition: traits-calls.hxx:166
object_traits_impl< T, id_oracle > traits
Definition: traits-calls.hxx:34
static void bind(bind_type *b, image_type &i)
Definition: traits-calls.hxx:150
view_traits_calls(const schema_version_migration *svm)
Definition: traits-calls.hxx:169
static void load_(typename traits::statements_type &sts, T &o, bool reload)
Definition: traits-calls.hxx:74
Definition: oracle-types.hxx:78
static void init(T &o, const image_type &i, odb::database *db)
Definition: traits-calls.hxx:156
traits::image_type image_type
Definition: traits-calls.hxx:144
traits::image_type image_type
Definition: traits-calls.hxx:84
void init(T &o, const image_type &i, odb::database *db) const
Definition: traits-calls.hxx:110
oracle::bind bind_type
Definition: traits-calls.hxx:167
void load_(typename traits::statements_type &sts, T &o, bool reload) const
Definition: traits-calls.hxx:123
Definition: traits-calls.hxx:138
view_traits_impl< T, id_oracle > traits
Definition: traits-calls.hxx:165
const schema_version_migration * version() const
Definition: traits-calls.hxx:90
static void bind(bind_type *b, image_type &i, statement_kind sk)
Definition: traits-calls.hxx:44
bool find_(typename traits::statements_type &sts, const typename traits::id_type *id) const
Definition: traits-calls.hxx:116