Common ODB Runtime Library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
exceptions.hxx
Go to the documentation of this file.
1 // file : odb/exceptions.hxx
2 // copyright : Copyright (c) 2009-2013 Code Synthesis Tools CC
3 // license : GNU GPL v2; see accompanying LICENSE file
4 
5 #ifndef ODB_EXCEPTIONS_HXX
6 #define ODB_EXCEPTIONS_HXX
7 
8 #include <odb/pre.hxx>
9 
10 #include <string>
11 
12 #include <odb/forward.hxx> // schema_version, odb::core
13 #include <odb/exception.hxx>
14 
15 #include <odb/details/export.hxx>
16 
17 namespace odb
18 {
19  struct LIBODB_EXPORT null_pointer: odb::exception
20  {
21  virtual const char*
22  what () const throw ();
23  };
24 
25  // Transaction exceptions.
26  //
27  struct LIBODB_EXPORT already_in_transaction: odb::exception
28  {
29  virtual const char*
30  what () const throw ();
31  };
32 
33  struct LIBODB_EXPORT not_in_transaction: odb::exception
34  {
35  virtual const char*
36  what () const throw ();
37  };
38 
40  {
41  virtual const char*
42  what () const throw ();
43  };
44 
45  // Session exceptions.
46  //
47  struct LIBODB_EXPORT already_in_session: odb::exception
48  {
49  virtual const char*
50  what () const throw ();
51  };
52 
53  struct LIBODB_EXPORT not_in_session: odb::exception
54  {
55  virtual const char*
56  what () const throw ();
57  };
58 
59  struct LIBODB_EXPORT session_required: odb::exception
60  {
61  virtual const char*
62  what () const throw ();
63  };
64 
65  // Database operations exceptions.
66  //
67  struct LIBODB_EXPORT recoverable: odb::exception
68  {
69  };
70 
71  struct LIBODB_EXPORT connection_lost: recoverable
72  {
73  virtual const char*
74  what () const throw ();
75  };
76 
77  struct LIBODB_EXPORT timeout: recoverable
78  {
79  virtual const char*
80  what () const throw ();
81  };
82 
83  struct LIBODB_EXPORT deadlock: recoverable
84  {
85  virtual const char*
86  what () const throw ();
87  };
88 
89  struct LIBODB_EXPORT object_not_persistent: odb::exception
90  {
91  virtual const char*
92  what () const throw ();
93  };
94 
96  {
97  virtual const char*
98  what () const throw ();
99  };
100 
101  struct LIBODB_EXPORT object_changed: odb::exception
102  {
103  virtual const char*
104  what () const throw ();
105  };
106 
107  struct LIBODB_EXPORT result_not_cached: odb::exception
108  {
109  virtual const char*
110  what () const throw ();
111  };
112 
113  struct LIBODB_EXPORT database_exception: odb::exception
114  {
115  };
116 
117  // Polymorphism support exceptions.
118  //
119  struct LIBODB_EXPORT abstract_class: odb::exception
120  {
121  virtual const char*
122  what () const throw ();
123  };
124 
125  struct LIBODB_EXPORT no_type_info: odb::exception
126  {
127  virtual const char*
128  what () const throw ();
129  };
130 
131  // Prepared query support exceptions.
132  //
134  {
135  prepared_already_cached (const char* name);
136  ~prepared_already_cached () throw ();
137 
138  const char*
139  name () const
140  {
141  return name_;
142  }
143 
144  virtual const char*
145  what () const throw ();
146 
147  private:
148  const char* name_;
149  std::string what_;
150  };
151 
152  struct LIBODB_EXPORT prepared_type_mismatch: odb::exception
153  {
154  prepared_type_mismatch (const char* name);
155  ~prepared_type_mismatch () throw ();
156 
157  const char*
158  name () const
159  {
160  return name_;
161  }
162 
163  virtual const char*
164  what () const throw ();
165 
166  private:
167  const char* name_;
168  std::string what_;
169  };
170 
171  // Schema catalog exceptions.
172  //
173  struct LIBODB_EXPORT unknown_schema: odb::exception
174  {
175  unknown_schema (const std::string& name);
176  ~unknown_schema () throw ();
177 
178  const std::string&
179  name () const
180  {
181  return name_;
182  }
183 
184  virtual const char*
185  what () const throw ();
186 
187  private:
188  std::string name_;
189  std::string what_;
190  };
191 
192  struct LIBODB_EXPORT unknown_schema_version: odb::exception
193  {
195  ~unknown_schema_version () throw ();
196 
198  version () const
199  {
200  return version_;
201  }
202 
203  virtual const char*
204  what () const throw ();
205 
206  private:
207  schema_version version_;
208  std::string what_;
209  };
210 
211  // Section exceptions.
212  //
213  struct LIBODB_EXPORT section_not_loaded: odb::exception
214  {
215  virtual const char*
216  what () const throw ();
217  };
218 
219  struct LIBODB_EXPORT section_not_in_object: odb::exception
220  {
221  virtual const char*
222  what () const throw ();
223  };
224 
225  namespace common
226  {
227  using odb::null_pointer;
228 
232 
234  using odb::not_in_session;
235  using odb::session_required;
236 
237  using odb::recoverable;
238  using odb::deadlock;
239  using odb::connection_lost;
240  using odb::timeout;
243  using odb::object_changed;
246 
247  using odb::abstract_class;
248  using odb::no_type_info;
249 
250  using odb::unknown_schema;
252 
255  }
256 }
257 
258 #include <odb/post.hxx>
259 
260 #endif // ODB_EXCEPTIONS_HXX
Definition: exceptions.hxx:101
Definition: exceptions.hxx:152
Definition: exceptions.hxx:59
Definition: exceptions.hxx:213
Definition: exceptions.hxx:119
Definition: exceptions.hxx:47
Definition: exceptions.hxx:33
Definition: exceptions.hxx:67
Definition: exceptions.hxx:71
Definition: exceptions.hxx:107
Definition: exceptions.hxx:53
Definition: exceptions.hxx:125
Definition: exceptions.hxx:219
schema_version version() const
Definition: exceptions.hxx:198
const std::string & name() const
Definition: exceptions.hxx:179
const char * name() const
Definition: exceptions.hxx:139
unsigned long long schema_version
Definition: forward.hxx:30
Definition: exceptions.hxx:83
Definition: exceptions.hxx:95
Definition: exceptions.hxx:27
Definition: exceptions.hxx:39
Definition: exceptions.hxx:133
Definition: exceptions.hxx:192
Definition: exceptions.hxx:19
Definition: exceptions.hxx:113
Definition: exceptions.hxx:173
Definition: exception.hxx:17
Definition: exceptions.hxx:89
const char * name() const
Definition: exceptions.hxx:158
Definition: exceptions.hxx:77