SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Exception.cpp
1 #include "Exception.h"
2 
3 namespace sqlite
4 {
5  void throw_error_code(sqlite3 *connection)
6  {
7  const int errcode = sqlite3_extended_errcode(connection);
8  if (errcode == SQLITE_OK) return;
9  if (errcode == SQLITE_DONE) return;
10 
11  switch(errcode)
12  {
13  case SQLITE_BUSY:
14  throw busy_exception(connection);
15  break;
16  default:
17  throw exception(connection);
18  break;
19  }
20  }
21 
22  void throw_error_code(const int errcode, const std::string& message)
23  {
24  if (errcode == SQLITE_OK) return;
25  if (errcode == SQLITE_DONE) return;
26 
27  switch(errcode)
28  {
29  case SQLITE_BUSY:
30  throw busy_exception(message);
31  break;
32  default:
33  throw exception(errcode, message);
34  break;
35  }
36  }
37 
38 }