blob: 79b0a333f63716e99ab82ee68b2f6943d7b1af3d (
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
|
// file : sqlite/types/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 <set>
#include <string>
#include <vector>
#include <memory> // std::auto_ptr
#include <odb/core.hxx>
typedef std::auto_ptr<std::string> string_ptr;
#pragma db object
struct object
{
object (unsigned long id)
: id_ (id)
{
}
object ()
{
}
#pragma db id
unsigned long id_;
#pragma db type ("BOOL")
bool bool_;
#pragma db type ("INTEGER")
int integer_;
#pragma db type ("REAL")
double real_;
#pragma db type ("TEXT")
std::string text_;
#pragma db type ("BLOB")
std::vector<char> blob_;
// Test NULL value.
//
#pragma db type ("TEXT") null
string_ptr null_;
bool
operator== (const object& y) const
{
return
id_ == y.id_ &&
bool_ == y.bool_ &&
integer_ == y.integer_ &&
real_ == y.real_ &&
text_ == y.text_ &&
blob_ == y.blob_ &&
((null_.get () == 0 && y.null_.get () == 0) || *null_ == *y.null_);
}
};
#endif // TEST_HXX
|