diff options
Diffstat (limited to 'src/components/policy/policy_external/src/sql_pt_queries.cc')
-rw-r--r-- | src/components/policy/policy_external/src/sql_pt_queries.cc | 115 |
1 files changed, 107 insertions, 8 deletions
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 97d75731ea..f4cac214a5 100644 --- a/src/components/policy/policy_external/src/sql_pt_queries.cc +++ b/src/components/policy/policy_external/src/sql_pt_queries.cc @@ -98,6 +98,9 @@ const std::string kCreateSchema = "CREATE TABLE IF NOT EXISTS `hmi_level`( " " `value` VARCHAR(45) PRIMARY KEY NOT NULL " "); " + "CREATE TABLE IF NOT EXISTS `hybrid_app_preference`( " + " `value` VARCHAR(45) PRIMARY KEY NOT NULL " + "); " "CREATE TABLE IF NOT EXISTS `notifications_by_priority`( " " `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL, " " `value` INTEGER NOT NULL, " @@ -147,6 +150,14 @@ const std::string kCreateSchema = " `is_predata` BOOLEAN, " " `memory_kb` INTEGER NOT NULL, " " `heart_beat_timeout_ms` INTEGER NOT NULL, " + " `certificate` VARCHAR(65535), " + " `hybrid_app_preference_value` VARCHAR(255), " + " `endpoint` VARCHAR(255), " + " `enabled` BOOLEAN, " + " `auth_token` VARCHAR(65535), " + " `cloud_transport_type` VARCHAR(255), " + " `icon_url` VARCHAR(65535), " + " `allow_unknown_rpc_passthrough` BOOLEAN, " " `remote_control_denied` BOOLEAN NOT NULL DEFAULT 0, " " CONSTRAINT `fk_application_hmi_level1` " " FOREIGN KEY(`default_hmi`) " @@ -154,11 +165,17 @@ const std::string kCreateSchema = " CONSTRAINT `fk_application_priorities1` " " FOREIGN KEY(`priority_value`) " " REFERENCES `priority`(`value`) " + " CONSTRAINT `fk_application_hybrid_app_preference1` " + " FOREIGN KEY(`hybrid_app_preference_value`) " + " REFERENCES `hybrid_app_preference`(`value`) " "); " "CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx` " " ON `application`(`default_hmi`); " "CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx` " " ON `application`(`priority_value`); " + "CREATE INDEX IF NOT EXISTS " + "`application.fk_application_hybrid_app_preference1` " + " ON `application`(`hybrid_app_preference_value`); " "CREATE TABLE IF NOT EXISTS `app_group`( " " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " " `functional_group_id` INTEGER NOT NULL, " @@ -286,6 +303,30 @@ const std::string kCreateSchema = " FOREIGN KEY(`application_id`) " " REFERENCES `application`(`id`) " "); " + "CREATE TABLE IF NOT EXISTS `app_service_types`( " + " `id` INTEGER PRIMARY KEY NOT NULL, " + " `service_type` VARCHAR(50), " + " `application_id` VARCHAR(45) NOT NULL COLLATE NOCASE, " + " CONSTRAINT `fk_service_type_app_id` " + " FOREIGN KEY(`application_id`) " + " REFERENCES `application`(`id`) " + "); " + "CREATE TABLE IF NOT EXISTS `app_service_names`( " + " `service_type_id` INTEGER NOT NULL, " + " `service_name` VARCHAR(45), " + " PRIMARY KEY(`service_name`,`service_type_id`), " + " CONSTRAINT `fk_service_name_service_type_id` " + " FOREIGN KEY(`service_type_id`) " + " REFERENCES `app_service_types`(`id`) " + "); " + "CREATE TABLE IF NOT EXISTS `app_service_handled_rpcs`( " + " `service_type_id` INTEGER NOT NULL, " + " `function_id` INTEGER, " + " PRIMARY KEY(`function_id`,`service_type_id`), " + " CONSTRAINT `fk_function_id_service_type_id` " + " FOREIGN KEY(`service_type_id`) " + " REFERENCES `app_service_types`(`id`) " + "); " "CREATE INDEX IF NOT EXISTS `app_type.fk_app_type_application1_idx` " " ON `app_type`(`application_id` COLLATE NOCASE); " "CREATE TABLE IF NOT EXISTS `consent_group`( " @@ -430,6 +471,9 @@ const std::string kInsertInitData = "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED'); " "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); " "INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); " + "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('MOBILE'); " + "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('CLOUD'); " + "INSERT OR IGNORE INTO `hybrid_app_preference`(`value`) VALUES ('BOTH'); " "INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); " "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); " ""; @@ -491,6 +535,9 @@ const std::string kDropSchema = "DROP TABLE IF EXISTS `app_type`; " "DROP TABLE IF EXISTS `request_type`; " "DROP TABLE IF EXISTS `request_subtype`; " + "DROP TABLE IF EXISTS `app_service_types`; " + "DROP TABLE IF EXISTS `app_service_names`; " + "DROP TABLE IF EXISTS `app_service_handled_rpcs`; " "DROP INDEX IF EXISTS `nickname.fk_nickname_application1_idx`; " "DROP TABLE IF EXISTS `nickname`; " "DROP INDEX IF EXISTS `app_level.fk_app_level_language2_idx`; " @@ -532,6 +579,7 @@ const std::string kDropSchema = "`notifications_by_priority.fk_notifications_by_priority_priority1_idx`; " "DROP TABLE IF EXISTS `notifications_by_priority`; " "DROP TABLE IF EXISTS `hmi_level`; " + "DROP TABLE IF EXISTS `hybrid_app_preference`; " "DROP TABLE IF EXISTS `priority`; " "DROP TABLE IF EXISTS `functional_group`; " "DROP TABLE IF EXISTS `module_config`; " @@ -628,8 +676,11 @@ const std::string kInsertRpcWithParameter = const std::string kInsertApplication = "INSERT OR IGNORE INTO `application` (`id`, `priority_value`, " - "`is_revoked`, `memory_kb`," - " `heart_beat_timeout_ms`) VALUES (?,?,?,?,?)"; + "`is_revoked`, `memory_kb`, `heart_beat_timeout_ms`, `certificate`, " + "`hybrid_app_preference_value`, `endpoint`, `enabled`, `auth_token`, " + "`cloud_transport_type`, `icon_url`, `allow_unknown_rpc_passthrough`) " + "VALUES " + "(?,?,?,?,?,?,?,?,?,?,?,?,?)"; const std::string kInsertAppGroup = "INSERT INTO `app_group` (`application_id`, `functional_group_id`)" @@ -650,6 +701,21 @@ const std::string kInsertRequestSubType = "`request_subtype`) " "VALUES (?, ?)"; +const std::string kInsertAppServiceTypes = + "INSERT INTO `app_service_types` (`id`, " + "`service_type`, `application_id`) " + "VALUES (?, ?, ?)"; + +const std::string kInsertAppServiceNames = + "INSERT INTO `app_service_names` (`service_type_id`, " + "`service_name`) " + "VALUES (?, ?)"; + +const std::string kInsertAppServiceHandledRpcs = + "INSERT INTO `app_service_handled_rpcs` (`service_type_id`, " + "`function_id`) " + "VALUES (?, ?)"; + const std::string kUpdateVersion = "UPDATE `version` SET `number`= ?"; const std::string kInsertMessageType = @@ -752,7 +818,11 @@ const std::string kSelectUserMsgsVersion = const std::string kSelectAppPolicies = "SELECT `id`, `priority_value`, `memory_kb`, " - " `heart_beat_timeout_ms` FROM `application`"; + " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, " + " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, `icon_url`, " + " `allow_unknown_rpc_passthrough` " + "FROM " + " `application`"; const std::string kCollectFriendlyMsg = "SELECT * FROM `message`"; @@ -779,6 +849,21 @@ const std::string kSelectRequestSubTypes = "`application_id` " "= ?"; +const std::string kSelectAppServiceTypes = + "SELECT `id`, `service_type` FROM `app_service_types` WHERE " + "`application_id` " + "= ?"; + +const std::string kSelectAppServiceNames = + "SELECT DISTINCT `service_name` FROM `app_service_names` WHERE " + "`service_type_id` " + "= ?"; + +const std::string kSelectAppServiceHandledRpcs = + "SELECT DISTINCT `function_id` FROM `app_service_handled_rpcs` WHERE " + "`service_type_id` " + "= ?"; + const std::string kSelectSecondsBetweenRetries = "SELECT `value` FROM `seconds_between_retry` ORDER BY `index`"; @@ -826,6 +911,13 @@ const std::string kDeleteRequestType = "DELETE FROM `request_type`"; const std::string kDeleteRequestSubType = "DELETE FROM `request_subtype`"; +const std::string kDeleteAppServiceTypes = "DELETE FROM `app_service_types`"; + +const std::string kDeleteAppServiceNames = "DELETE FROM `app_service_names`"; + +const std::string kDeleteAppServiceHandledRpcs = + "DELETE FROM `app_service_handled_rpcs`"; + const std::string kSelectApplicationRevoked = "SELECT `is_revoked` FROM `application` WHERE `id` = ?"; @@ -849,15 +941,22 @@ const std::string kDeleteAppGroupByApplicationId = const std::string kInsertApplicationFull = "INSERT OR IGNORE INTO `application` (`id`, `keep_context`, `steal_focus`, " - " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " - "`is_predata`, " - " `memory_kb`, `heart_beat_timeout_ms`) " - " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; + " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, " + " `is_predata`, `memory_kb`, `heart_beat_timeout_ms`, " + " `certificate`, `hybrid_app_preference_value`, `endpoint`, `enabled`, " + " `auth_token`, `cloud_transport_type`, `icon_url`, " + "`allow_unknown_rpc_passthrough`) " + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; const std::string kSelectApplicationFull = "SELECT `keep_context`, `steal_focus`, `default_hmi`, `priority_value`, " " `is_revoked`, `is_default`, `is_predata`, `memory_kb`," - " `heart_beat_timeout_ms` FROM `application` WHERE `id` = ?"; + " `heart_beat_timeout_ms`, `certificate`, `hybrid_app_preference_value`, " + " `endpoint`, `enabled`, `auth_token`, `cloud_transport_type`, " + "`icon_url`, " + " `allow_unknown_rpc_passthrough` " + "FROM `application` " + "WHERE `id` = ?"; const std::string kSelectDBVersion = "SELECT `db_version_hash` from `_internal_data`"; |