blob: 314136252fb46d22d03e42ee0dc4c8520bfd5700 (
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
80
81
|
// file : common/query/array/test.hxx
// copyright : Copyright (c) 2009-2019 Code Synthesis Tools CC
// license : GNU GPL v2; see accompanying LICENSE file
#ifndef TEST_HXX
#define TEST_HXX
#include <common/config.hxx> // HAVE_CXX11
#include <cstring> // std::memcpy, std::strlen
#ifdef HAVE_CXX11
# include <array>
#endif
#include <odb/core.hxx>
#pragma db object
struct object
{
object () {}
object (unsigned long id, const char* s, const char* b)
: id_ (id)
{
std::memcpy (s_, s, std::strlen (s) + 1); // VC++ strncpy deprecation.
std::memcpy (s1_, s, std::strlen (s) + 1);
#ifdef HAVE_CXX11
std::memcpy (a_.data (), s, std::strlen (s) + 1);
#endif
c_ = c1_ = *s;
std::memcpy (b_, b, sizeof (b_));
}
#pragma db id
unsigned long id_;
char s_[17];
char s1_[17];
#ifdef HAVE_CXX11
#ifdef ODB_COMPILER
# if defined(ODB_DATABASE_MYSQL) || \
defined(ODB_DATABASE_PGSQL) || \
defined(ODB_DATABASE_ORACLE) || \
defined(ODB_DATABASE_MSSQL)
# pragma db type("VARCHAR(16)")
# elif defined(ODB_DATABASE_SQLITE)
# pragma db type("TEXT")
# elif defined(ODB_DATABASE_COMMON)
# pragma db type("DYMMU") // Necessary to make it a value.
# else
# error unknown database
# endif
#endif
std::array<char, 17> a_;
#endif
char c_;
char c1_;
#ifdef ODB_COMPILER
# if defined(ODB_DATABASE_MYSQL)
# pragma db type("BINARY(16)")
# elif defined(ODB_DATABASE_SQLITE)
# pragma db type("BLOB")
# elif defined(ODB_DATABASE_PGSQL)
# pragma db type("BYTEA")
# elif defined(ODB_DATABASE_ORACLE)
# pragma db type("RAW(16)")
# elif defined(ODB_DATABASE_MSSQL)
# pragma db type("BINARY(16)")
# elif defined(ODB_DATABASE_COMMON)
# else
# error unknown database
# endif
#endif
char b_[16];
};
#endif // TEST_HXX
|