aboutsummaryrefslogtreecommitdiff
path: root/common/schema/test.hxx
blob: 45ffe9a441ce4af77dd23e3a221404274eff9e70 (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
72
73
74
75
76
77
78
79
// file      : common/schema/test.hxx
// author    : Boris Kolpackov <boris@codesynthesis.com>
// copyright : Copyright (c) 2009-2011 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#ifndef TEST_HXX
#define TEST_HXX

#include <string>
#include <odb/core.hxx>

// Table names.
//
#pragma db object table ("TABLE_EXPLICIT")
struct table_explicit
{
  #pragma db id
  unsigned long id_;
};

#pragma db object
struct table_implicit
{
  #pragma db id
  unsigned long id_;
};

// Column names.
//
#pragma db object
struct column
{
  #pragma db id
  int m1;

  #pragma db column ("foo")
  int m2;

  int m_m3;
  int _m4;
  int m5_;
  int m_;
  int m__;
};

// Column types.
//
#pragma db object
struct type
{
  #pragma db id
  std::string id;

  // Test default C++ to DB type mapping.
  //
  bool b;
  char c;
  signed char sc;
  unsigned char uc;
  short s;
  unsigned short us;
  int i;
  unsigned int ui;
  long l;
  unsigned long ul;
  long long ll;
  unsigned long long ull;
  float f;
  double d;
  std::string str;

  #pragma db type ("INTEGER")
  bool m1;

  #pragma db transient
  char* m2;
};

#endif // TEST_HXX