SQLite Containers
Loading...
Searching...
No Matches
Enums.hpp
Go to the documentation of this file.
1#pragma once
2
5
6#include <array>
7#include <string>
8
9namespace sqlite_containers {
10
13 enum class JournalMode {
15 TRUNCATE,
16 PERSIST,
17 MEMORY,
18 WAL,
19 OFF
20 };
21
24 enum class SynchronousMode {
25 OFF,
26 NORMAL,
27 FULL,
28 EXTRA
29 };
30
33 enum class LockingMode {
34 NORMAL,
36 };
37
40 enum class AutoVacuumMode {
41 NONE,
42 FULL,
44 };
45
48 enum class TempStore {
49 DEFAULT,
50 FILE,
51 MEMORY
52 };
53
56 enum class TransactionMode {
57 DEFERRED,
58 IMMEDIATE,
60 };
61
65 std::string to_string(const JournalMode &mode) {
66 static const std::array<std::string, 6> data = {
67 "DELETE",
68 "TRUNCATE",
69 "PERSIST",
70 "MEMORY",
71 "WAL",
72 "OFF"
73 };
74 return data[static_cast<size_t>(mode)];
75 }
76
80 std::string to_string(const SynchronousMode &mode) {
81 static const std::array<std::string, 6> data = {
82 "OFF",
83 "NORMAL",
84 "FULL",
85 "EXTRA"
86 };
87 return data[static_cast<size_t>(mode)];
88 }
89
93 std::string to_string(const LockingMode &mode) {
94 static const std::array<std::string, 6> data = {
95 "NORMAL",
96 "EXCLUSIVE"
97 };
98 return data[static_cast<size_t>(mode)];
99 }
100
104 std::string to_string(const AutoVacuumMode &mode) {
105 static const std::array<std::string, 6> data = {
106 "NONE",
107 "FULL",
108 "INCREMENTAL"
109 };
110 return data[static_cast<size_t>(mode)];
111 }
112
116 std::string to_string(const TransactionMode &mode) {
117 static const std::array<std::string, 3> data = {
118 "DEFERRED",
119 "IMMEDIATE",
120 "EXCLUSIVE"
121 };
122 return data[static_cast<size_t>(mode)];
123 }
124
125}; // namespace sqlite_containers
std::string to_string(const JournalMode &mode)
Converts JournalMode enum to string representation.
Definition Enums.hpp:65
SynchronousMode
SQLite synchronous modes enumeration.
Definition Enums.hpp:24
@ NORMAL
Normal synchronous mode.
@ EXTRA
Extra synchronous mode.
@ FULL
Full synchronous mode.
TransactionMode
Defines SQLite transaction modes.
Definition Enums.hpp:56
@ IMMEDIATE
Locks the database for writing at the start, allowing only read operations by others.
@ DEFERRED
Waits to lock the database until a write operation is requested.
TempStore
SQLite temporary storage modes enumeration.
Definition Enums.hpp:48
@ DEFAULT
Default temporary storage behavior.
@ FILE
Temporary storage using a file.
LockingMode
SQLite locking modes enumeration.
Definition Enums.hpp:33
@ EXCLUSIVE
Exclusive locking mode.
JournalMode
SQLite journal modes enumeration.
Definition Enums.hpp:13
@ TRUNCATE
Truncate journal mode.
@ MEMORY
Memory journal mode.
@ PERSIST
Persist journal mode.
@ DELETE_MODE
Delete journal mode.
@ WAL
Write-ahead logging (WAL) mode.
AutoVacuumMode
SQLite auto-vacuum modes enumeration.
Definition Enums.hpp:40
@ INCREMENTAL
Incremental auto-vacuuming.