aboutsummaryrefslogtreecommitdiff
path: root/odb/exceptions.cxx
blob: a5292bcbdd17df4446fc055519e67309aa8fa490 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
// file      : odb/exceptions.cxx
// copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
// license   : GNU GPL v2; see accompanying LICENSE file

#include <sstream>
#include <odb/exceptions.hxx>

using namespace std;

namespace odb
{
  const char* null_pointer::
  what () const throw ()
  {
    return "NULL pointer";
  }

  const char* already_in_transaction::
  what () const throw ()
  {
    return "transaction already in progress in this thread";
  }

  const char* not_in_transaction::
  what () const throw ()
  {
    return "operation can only be performed in transaction";
  }

  const char* transaction_already_finalized::
  what () const throw ()
  {
    return "transaction already committed or rolled back";
  }

  const char* already_in_session::
  what () const throw ()
  {
    return "session already in effect in this thread";
  }

  const char* not_in_session::
  what () const throw ()
  {
    return "session not in effect in this thread";
  }

  const char* session_required::
  what () const throw ()
  {
    return "session required to load this object relationship";
  }

  const char* deadlock::
  what () const throw ()
  {
    return "transaction aborted due to deadlock";
  }

  const char* connection_lost::
  what () const throw ()
  {
    return "connection to database lost";
  }

  const char* timeout::
  what () const throw ()
  {
    return "database operation timeout";
  }

  const char* object_not_persistent::
  what () const throw ()
  {
    return "object not persistent";
  }

  const char* object_already_persistent::
  what () const throw ()
  {
    return "object already persistent";
  }

  const char* object_changed::
  what () const throw ()
  {
    return "object changed concurrently";
  }

  const char* result_not_cached::
  what () const throw ()
  {
    return "query result is not cached";
  }

  const char* abstract_class::
  what () const throw ()
  {
    return "database operation on instance of abstract class";
  }

  const char* no_type_info::
  what () const throw ()
  {
    return "no type information";
  }

  prepared_already_cached::
  prepared_already_cached (const char* name)
      : name_ (name)
  {
    what_ = "prepared query '";
    what_ += name;
    what_ += "' is already cached";
  }

  prepared_already_cached::
  ~prepared_already_cached () throw ()
  {
  }

  const char* prepared_already_cached::
  what () const throw ()
  {
    return what_.c_str ();
  }

  prepared_type_mismatch::
  prepared_type_mismatch (const char* name)
      : name_ (name)
  {
    what_ = "type mismatch while looking up prepared query '";
    what_ += name;
    what_ += "'";
  }

  prepared_type_mismatch::
  ~prepared_type_mismatch () throw ()
  {
  }

  const char* prepared_type_mismatch::
  what () const throw ()
  {
    return what_.c_str ();
  }

  unknown_schema::
  unknown_schema (const std::string& name)
      : name_ (name)
  {
    what_ = "unknown database schema '";
    what_ += name;
    what_ += "'";
  }

  unknown_schema::
  ~unknown_schema () throw ()
  {
  }

  const char* unknown_schema::
  what () const throw ()
  {
    return what_.c_str ();
  }

  unknown_schema_version::
  unknown_schema_version (schema_version v)
      : version_ (v)
  {
    ostringstream os;
    os << v;
    what_ = "unknown database schema version ";
    what_ += os.str ();
  }

  unknown_schema_version::
  ~unknown_schema_version () throw ()
  {
  }

  const char* unknown_schema_version::
  what () const throw ()
  {
    return what_.c_str ();
  }

  const char* section_not_loaded::
  what () const throw ()
  {
    return "section is not loaded";
  }

  const char* section_not_in_object::
  what () const throw ()
  {
    return "section instance is not part of an object (section was copied?)";
  }
}