SQLiteXX  0.1.0
 All Classes Namespaces Files Functions Enumerations Enumerator
Open.h
Go to the documentation of this file.
1 
3 #ifndef __SQLITEXX_SQLITE_OPEN_H__
4 #define __SQLITEXX_SQLITE_OPEN_H__
5 
6 #include <sqlite3.h>
7 
8 #include <type_traits>
9 
10 namespace sqlite
11 {
14  enum class openmode : int {
15  read_only = SQLITE_OPEN_READONLY,
16  read_write = SQLITE_OPEN_READWRITE,
17  create = SQLITE_OPEN_CREATE,
18  uri = SQLITE_OPEN_URI,
19  memory = SQLITE_OPEN_MEMORY,
20  no_mutex = SQLITE_OPEN_NOMUTEX,
21  full_mutex = SQLITE_OPEN_FULLMUTEX,
22  shared_cache = SQLITE_OPEN_SHAREDCACHE,
23  private_cache = SQLITE_OPEN_PRIVATECACHE,
24  };
25 
26  inline openmode operator&(openmode lhs, openmode rhs) {
27  return static_cast<openmode>(
28  static_cast<std::underlying_type<openmode>::type>(lhs) &
29  static_cast<std::underlying_type<openmode>::type>(rhs));
30  }
31 
32  inline openmode operator|(openmode lhs, openmode rhs) {
33  return static_cast<openmode>(
34  static_cast<std::underlying_type<openmode>::type>(lhs) |
35  static_cast<std::underlying_type<openmode>::type>(rhs));
36  }
37 
38  inline openmode operator^(openmode lhs, openmode rhs) {
39  return static_cast<openmode>(
40  static_cast<std::underlying_type<openmode>::type>(lhs) |
41  static_cast<std::underlying_type<openmode>::type>(rhs));
42  }
43 
44  inline openmode operator~(openmode flag) {
45  return static_cast<openmode>(
46  static_cast<std::underlying_type<openmode>::type>(flag));
47  }
48 
49  inline const openmode& operator&=(openmode &lhs, openmode rhs) {
50  return lhs = lhs & rhs;
51  }
52 
53  inline const openmode& operator|=(openmode &lhs, openmode rhs) {
54  return lhs = lhs | rhs;
55  }
56 
57  inline const openmode& operator^=(openmode &lhs, openmode rhs) {
58  return lhs = lhs ^ rhs;
59  }
60 }
61 
62 #endif
database connections opens in the multi-thread threading mode as long as the single-thread mode has n...
openmode
Different ways to open a dbconnection.
Definition: Open.h:14
database will be created if it does not already exist
database connection opens in the serialized threading mode unless single-thread was previously select...
causes the database connection to not participate in shared cache mode even if it is enabled...
URI filename interpretation is enabled.
open an in memory database
opened for reading and writing if possible, or reading only if the file is write protected by the ope...
opened in read-only mode
causes the database connection to be eligible to use shared cache mode, regardless of whether or not ...