aboutsummaryrefslogtreecommitdiff
path: root/evolution/data/model.hxx
blob: 87518964a54bcf030ddd2c05d8206270a5b0866b (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
// file      : evolution/data/model.hxx
// copyright : Copyright (c) 2009-2015 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#ifndef MODEL_VERSION
#  error model.hxx included directly
#endif

#include <odb/core.hxx>

#pragma db model version(1, MODEL_VERSION)

#define MODEL_NAMESPACE_IMPL(V) v##V
#define MODEL_NAMESPACE(V) MODEL_NAMESPACE_IMPL(V)

namespace MODEL_NAMESPACE(MODEL_VERSION)
{
#if MODEL_VERSION == 2
  #pragma db object
  struct object1
  {
    object1 (unsigned long id = 0): id_ (id) {}

    #pragma db id
    unsigned long id_;

    int num;
  };
#endif

#if MODEL_VERSION == 3
  #pragma db object
  struct object2
  {
    object2 (unsigned long id = 0): id_ (id) {}

    #pragma db id
    unsigned long id_;

    int num;
  };
#endif
}

#undef MODEL_NAMESPACE
#undef MODEL_NAMESPACE_IMPL