#include <MariaDbStorage.h>
Classes | |
| struct | ConnectionConfig |
Public Member Functions | |
| MariaDbStorage (const std::string &connectionName, const ConnectionConfig &connectionConfig, std::string rawTable, bool autoCreateRawTable, StoragePlan storagePlan) | |
| void | store (const MqttMessage &message) |
Private Member Functions | |
| void | createRawTable () |
| void | storeProjections (const MqttMessage &message, const std::optional< nlohmann::json > &payloadJson) |
Static Private Member Functions | |
| static bool | isSafeIdentifier (const std::string &identifier) |
| static std::string | quoteIdentifier (const std::string &identifier) |
| static std::string | sqlQuote (const std::string &value) |
| static std::string | sqlValue (const nlohmann::json &value) |
| static std::optional< nlohmann::json > | parsePayload (const std::string &payload) |
| static bool | hasBinaryContent (const std::string &payload) |
| static std::string | buildRawInsertSql (const std::string &rawTable, const MqttMessage &message, const std::optional< nlohmann::json > &payloadJson) |
| static std::string | buildProjectionInsertSql (const StoragePlan::Projection &projection, const MqttMessage &message, const nlohmann::json &payloadJson) |
| static std::string | jsonValueForColumn (const StoragePlan::ColumnMapping &mapping, const MqttMessage &message, const nlohmann::json &payloadJson) |
| static void | execLogFailure (const std::string &connectionName, const std::string &operation, const std::string &errorString, unsigned int errorNumber) |
Private Attributes | |
| std::string | connectionName |
| database::mariadb::MariaDBClient | mariaDB |
| std::string | rawTable |
| StoragePlan | storagePlan |
Definition at line 34 of file MariaDbStorage.h.
| mqtt::mqttstore::lib::MariaDbStorage::MariaDbStorage | ( | const std::string & | connectionName, |
| const ConnectionConfig & | connectionConfig, | ||
| std::string | rawTable, | ||
| bool | autoCreateRawTable, | ||
| StoragePlan | storagePlan ) |
Definition at line 55 of file MariaDbStorage.cpp.
References connectionName, and MariaDbStorage().
Referenced by MariaDbStorage().
|
staticnodiscardprivate |
Definition at line 209 of file MariaDbStorage.cpp.
References mqtt::mqttstore::lib::StoragePlan::Projection::name, quoteIdentifier(), and mqtt::mqttstore::lib::StoragePlan::Projection::table.
|
staticnodiscardprivate |
Definition at line 192 of file MariaDbStorage.cpp.
References mqtt::mqttstore::lib::MqttMessage::connectionName, mqtt::mqttstore::lib::MqttMessage::dup, hasBinaryContent(), mqtt::mqttstore::lib::MqttMessage::packetIdentifier, mqtt::mqttstore::lib::MqttMessage::payload, mqtt::mqttstore::lib::MqttMessage::qoS, quoteIdentifier(), mqtt::mqttstore::lib::MqttMessage::retain, sqlQuote(), and mqtt::mqttstore::lib::MqttMessage::topic.
Referenced by store().
|
private |
Definition at line 267 of file MariaDbStorage.cpp.
References quoteIdentifier(), and rawTable.
|
staticprivate |
Definition at line 260 of file MariaDbStorage.cpp.
|
staticnodiscardprivate |
Definition at line 186 of file MariaDbStorage.cpp.
Referenced by buildRawInsertSql().
|
staticnodiscardprivate |
Definition at line 108 of file MariaDbStorage.cpp.
Referenced by quoteIdentifier().
|
staticnodiscardprivate |
Definition at line 232 of file MariaDbStorage.cpp.
References mqtt::mqttstore::lib::StoragePlan::ColumnMapping::jsonPointer, mqtt::mqttstore::lib::StoragePlan::ColumnMapping::literal, sqlQuote(), sqlValue(), and mqtt::mqttstore::lib::StoragePlan::ColumnMapping::topicLevel.
|
staticnodiscardprivate |
Definition at line 178 of file MariaDbStorage.cpp.
|
staticnodiscardprivate |
Definition at line 114 of file MariaDbStorage.cpp.
References isSafeIdentifier().
Referenced by buildProjectionInsertSql(), buildRawInsertSql(), and createRawTable().
|
staticnodiscardprivate |
Definition at line 122 of file MariaDbStorage.cpp.
Referenced by buildRawInsertSql(), jsonValueForColumn(), and sqlValue().
|
staticnodiscardprivate |
Definition at line 161 of file MariaDbStorage.cpp.
References sqlQuote().
Referenced by jsonValueForColumn().
| void mqtt::mqttstore::lib::MariaDbStorage::store | ( | const MqttMessage & | message | ) |
Definition at line 92 of file MariaDbStorage.cpp.
References buildRawInsertSql(), rawTable, and storeProjections().
|
private |
Definition at line 296 of file MariaDbStorage.cpp.
Referenced by store().
|
private |
Definition at line 74 of file MariaDbStorage.h.
Referenced by MariaDbStorage().
|
private |
Definition at line 75 of file MariaDbStorage.h.
|
private |
Definition at line 76 of file MariaDbStorage.h.
Referenced by createRawTable(), and store().
|
private |
Definition at line 77 of file MariaDbStorage.h.