summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjacobkeeler <jacob.keeler@livioradio.com>2018-09-13 14:49:15 -0400
committerjacobkeeler <jacob.keeler@livioradio.com>2018-09-13 14:49:15 -0400
commitc934f656df2e1c6993500973ca5e29c23b592355 (patch)
tree0387c79e02ffd10d2f90e091e962c481cf09e59e
parent74be3a1a9e2fb5d6e0d2160d605554c36763b8ce (diff)
downloadsdl_core-fix/gather_request_types.tar.gz
Fix incorrectly saved RequestType and RequestSubType, which caused silent errors while loading application policies on startupfix/gather_request_types
-rw-r--r--src/components/policy/policy_external/include/policy/sql_pt_queries.h2
-rw-r--r--src/components/policy/policy_external/src/sql_pt_queries.cc8
-rw-r--r--src/components/policy/policy_external/src/sql_pt_representation.cc24
-rw-r--r--src/components/policy/policy_regular/include/policy/sql_pt_queries.h2
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_queries.cc8
-rw-r--r--src/components/policy/policy_regular/src/sql_pt_representation.cc24
6 files changed, 0 insertions, 68 deletions
diff --git a/src/components/policy/policy_external/include/policy/sql_pt_queries.h b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
index 646cc7663b..dd9e0204e7 100644
--- a/src/components/policy/policy_external/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_external/include/policy/sql_pt_queries.h
@@ -79,8 +79,6 @@ extern const std::string kInsertAppGroup;
extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
-extern const std::string kInsertOmittedRequestType;
-extern const std::string kInsertOmittedRequestSubType;
extern const std::string kInsertRequestSubType;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
diff --git a/src/components/policy/policy_external/src/sql_pt_queries.cc b/src/components/policy/policy_external/src/sql_pt_queries.cc
index ee53eb1487..97d75731ea 100644
--- a/src/components/policy/policy_external/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_external/src/sql_pt_queries.cc
@@ -645,19 +645,11 @@ const std::string kInsertRequestType =
"INSERT OR IGNORE INTO `request_type` (`application_id`, `request_type`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestType =
- "INSERT INTO `request_type` (`application_id`) "
- "VALUES (?)";
-
const std::string kInsertRequestSubType =
"INSERT INTO `request_subtype` (`application_id`, "
"`request_subtype`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestSubType =
- "INSERT INTO `request_subtype` (`application_id`) "
- "VALUES (?)";
-
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
const std::string kInsertMessageType =
diff --git a/src/components/policy/policy_external/src/sql_pt_representation.cc b/src/components/policy/policy_external/src/sql_pt_representation.cc
index 34c5b90903..31c69e3725 100644
--- a/src/components/policy/policy_external/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_external/src/sql_pt_representation.cc
@@ -1193,18 +1193,6 @@ bool SQLPTRepresentation::SaveRequestType(
LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request types omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
- return false;
- }
}
return true;
}
@@ -1237,18 +1225,6 @@ bool SQLPTRepresentation::SaveRequestSubType(
LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request subtypes omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
- return false;
- }
}
return true;
}
diff --git a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
index 5259ffa7e9..191873efe0 100644
--- a/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
+++ b/src/components/policy/policy_regular/include/policy/sql_pt_queries.h
@@ -79,8 +79,6 @@ extern const std::string kInsertAppGroup;
extern const std::string kInsertNickname;
extern const std::string kInsertAppType;
extern const std::string kInsertRequestType;
-extern const std::string kInsertOmittedRequestType;
-extern const std::string kInsertOmittedRequestSubType;
extern const std::string kInsertRequestSubType;
extern const std::string kInsertMessageType;
extern const std::string kInsertLanguage;
diff --git a/src/components/policy/policy_regular/src/sql_pt_queries.cc b/src/components/policy/policy_regular/src/sql_pt_queries.cc
index 91a5573a04..f5ccffce3b 100644
--- a/src/components/policy/policy_regular/src/sql_pt_queries.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_queries.cc
@@ -595,19 +595,11 @@ const std::string kInsertRequestType =
"INSERT INTO `request_type` (`application_id`, `request_type`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestType =
- "INSERT INTO `request_type` (`application_id`) "
- "VALUES (?)";
-
const std::string kInsertRequestSubType =
"INSERT INTO `request_subtype` (`application_id`, "
"`request_subtype`) "
"VALUES (?, ?)";
-const std::string kInsertOmittedRequestSubType =
- "INSERT INTO `request_subtype` (`application_id`) "
- "VALUES (?)";
-
const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?";
const std::string kInsertMessageType =
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 d32ee7133d..4f5dbc4c3b 100644
--- a/src/components/policy/policy_regular/src/sql_pt_representation.cc
+++ b/src/components/policy/policy_regular/src/sql_pt_representation.cc
@@ -1137,18 +1137,6 @@ bool SQLPTRepresentation::SaveRequestType(
LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request types omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request types.");
- return false;
- }
}
return true;
}
@@ -1181,18 +1169,6 @@ bool SQLPTRepresentation::SaveRequestSubType(
LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
return false;
}
- } else {
- utils::dbms::SQLQuery query_omitted(db());
- if (!query_omitted.Prepare(sql_pt::kInsertOmittedRequestSubType)) {
- LOG4CXX_WARN(logger_, "Incorrect insert statement for request subtypes.");
- return false;
- }
- LOG4CXX_WARN(logger_, "Request subtypes omitted.");
- query_omitted.Bind(0, app_id);
- if (!query_omitted.Exec() || !query_omitted.Reset()) {
- LOG4CXX_WARN(logger_, "Incorrect insert into request subtypes.");
- return false;
- }
}
return true;
}