#define BILLION 1000000000 /* for calculating nano seconds */
static time_t periodic_alarm_standard_time = 0;
+static bool is_db_corrupted = false;
static int __is_ui_app(const char *appid, uid_t uid);
static long __get_proper_interval(long interval, int alarm_type);
}
}
+int check_callback(void *pid, int argc, char **argv, char **notUsed2)
+{
+ if (strcmp(argv[0], "ok") != 0) {
+ ALARM_MGR_EXCEPTION_PRINT("check integrity result : %s" , argv[0]);
+ is_db_corrupted = true;
+ return -1;
+ } else {
+ ALARM_MGR_LOG_PRINT("check integrity result : %s" , argv[0]);
+ }
+
+ return 0;
+}
+
static bool __initialize_db()
{
char *error_message = NULL;
}
}
+ /* Check integrity of DB */
+ ret = sqlite3_exec(alarmmgr_db, "PRAGMA integrity_check", check_callback, NULL, 0);
+ if (ret != SQLITE_OK || is_db_corrupted) {
+ ALARM_MGR_EXCEPTION_PRINT("Loss alarm db's integrity");
+ goto recover;
+ }
+
return true;
recover: