2
3
4
5
6
7
8
9
10
12#ifndef MQTTSTORE_LIB_MARIADBSTORAGE_H
13#define MQTTSTORE_LIB_MARIADBSTORAGE_H
17#include <database/mariadb/MariaDBClient.h>
19namespace mqtt::mqttstore::
lib {
23#ifndef DOXYGEN_SHOULD_SKIP_THIS
26#include <nlohmann/json_fwd.hpp>
32namespace mqtt::mqttstore::
lib {
49 bool autoCreateRawTable,
56 [[nodiscard]]
static std::string
quoteIdentifier(
const std::string& identifier);
57 [[nodiscard]]
static std::string
sqlQuote(
const std::string& value);
61 [[nodiscard]]
static std::string
63 [[nodiscard]]
static std::string
65 [[nodiscard]]
static std::string
68 const std::string& operation,
69 const std::string& errorString,
70 unsigned int errorNumber);
static std::string quoteIdentifier(const std::string &identifier)
std::string connectionName
static std::string buildRawInsertSql(const std::string &rawTable, const MqttMessage &message, const std::optional< nlohmann::json > &payloadJson)
static std::string jsonValueForColumn(const StoragePlan::ColumnMapping &mapping, const MqttMessage &message, const nlohmann::json &payloadJson)
static std::string sqlValue(const nlohmann::json &value)
static bool hasBinaryContent(const std::string &payload)
MariaDbStorage(const std::string &connectionName, const ConnectionConfig &connectionConfig, std::string rawTable, bool autoCreateRawTable, StoragePlan storagePlan)
static bool isSafeIdentifier(const std::string &identifier)
void storeProjections(const MqttMessage &message, const std::optional< nlohmann::json > &payloadJson)
static std::string buildProjectionInsertSql(const StoragePlan::Projection &projection, const MqttMessage &message, const nlohmann::json &payloadJson)
database::mariadb::MariaDBClient mariaDB
static std::optional< nlohmann::json > parsePayload(const std::string &payload)
void store(const MqttMessage &message)
static void execLogFailure(const std::string &connectionName, const std::string &operation, const std::string &errorString, unsigned int errorNumber)
static std::string sqlQuote(const std::string &value)
const std::string willTopic
Mqtt(const std::string &connectionName, const std::string &clientId, std::uint8_t qoSDefault, std::uint16_t keepAlive, bool cleanSession, const std::string &willTopic, const std::string &willMessage, std::uint8_t willQoS, bool willRetain, const std::string &username, const std::string &password, const std::list< std::string > &subTopics, MariaDbStorage::ConnectionConfig connectionConfig, const std::string &rawTable, bool autoCreateRawTable, StoragePlan storagePlan, const std::string &sessionStoreFileName="")
const std::uint8_t qoSDefault
void onConnack(const iot::mqtt::packets::Connack &connack) final
const std::string willMessage
iot::mqtt::client::Mqtt Super
const std::uint8_t willQoS
bool onSignal(int signum) final
const std::list< std::string > subTopics
void onPublish(const iot::mqtt::packets::Publish &publish) final
const std::string username
const std::string password
static std::uint8_t getQos(const std::string &qoSString)
void onSuback(const iot::mqtt::packets::Suback &suback) final