Fledge
An open source edge computing platform for industrial users
common.h
1 #ifndef _COMMON_CONNECTION_H
2 #define _COMMON_CONNECTION_H
3 
4 #include <sql_buffer.h>
5 #include <iostream>
6 #include <sqlite3.h>
7 #include "rapidjson/document.h"
8 #include "rapidjson/writer.h"
9 #include "rapidjson/stringbuffer.h"
10 #include "rapidjson/error/error.h"
11 #include "rapidjson/error/en.h"
12 #include <string>
13 #include <map>
14 #include <stdarg.h>
15 #include <stdlib.h>
16 #include <sstream>
17 #include <logger.h>
18 #include <time.h>
19 #include <unistd.h>
20 #include <chrono>
21 #include <thread>
22 #include <atomic>
23 #include <condition_variable>
24 #include <sys/time.h>
25 #include <connection.h>
26 
27 #define STORAGE_PURGE_RETAIN_ANY 0x0001U
28 #define STORAGE_PURGE_RETAIN_ALL 0x0002U
29 #define STORAGE_PURGE_SIZE 0x0004U
30 
31 #define DB_CONFIGURATION "PRAGMA busy_timeout = 5000; PRAGMA cache_size = -4000; PRAGMA journal_mode = WAL; PRAGMA secure_delete = off; PRAGMA journal_size_limit = 4096000;"
32 
33 static std::map<std::string, std::string> sqliteDateFormat = {
34  {"HH24:MI:SS",
35  F_TIMEH24_S},
36  {"YYYY-MM-DD HH24:MI:SS.MS",
37  F_DATEH24_MS},
38  {"YYYY-MM-DD HH24:MI:SS",
39  F_DATEH24_S},
40  {"YYYY-MM-DD HH24:MI",
41  F_DATEH24_M},
42  {"YYYY-MM-DD HH24",
43  F_DATEH24_H},
44  {"", ""}
45  };
46 #endif