summaryrefslogtreecommitdiff
path: root/src/components/policy/policy_regular/src/sql_pt_representation.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/policy/policy_regular/src/sql_pt_representation.cc')
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc25
1 files changed, 21 insertions, 4 deletions
diff --git a/src/components/policy/policy_regular/src/sql_pt_representation.cc b/src/components/policy/policy_regular/src/sql_pt_representation.cc
index 7193a06bdb..57781ae16f 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -472,10 +472,11 @@ void SQLPTRepresentation::GatherModuleMeta(
SDL_LOG_INFO("Gather Module Meta Info");
utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectModuleMeta) && query.Next()) {
- *meta->pt_exchanged_at_odometer_x = query.GetInteger(0);
- *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(1);
- *meta->ignition_cycles_since_last_exchange = query.GetInteger(2);
- *meta->ccpu_version = query.GetString(4);
+ *meta->ccpu_version = query.GetString(0);
+ *meta->hardware_version = query.GetString(1);
+ *meta->pt_exchanged_at_odometer_x = query.GetInteger(2);
+ *meta->pt_exchanged_x_days_after_epoch = query.GetInteger(3);
+ *meta->ignition_cycles_since_last_exchange = query.GetInteger(4);
}
}
@@ -716,6 +717,22 @@ bool SQLPTRepresentation::SetMetaInfo(const std::string& ccpu_version) {
return true;
}
+void SQLPTRepresentation::SetHardwareVersion(
+ const std::string& hardware_version) {
+ SDL_LOG_AUTO_TRACE();
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kUpdateMetaHardwareVersion)) {
+ SDL_LOG_WARN("Incorrect statement for insert to module meta.");
+ return;
+ }
+
+ query.Bind(0, hardware_version);
+
+ if (!query.Exec()) {
+ SDL_LOG_WARN("Incorrect insert to module meta.");
+ }
+}
+
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
SDL_LOG_INFO("Gather applications policies");