static bool is_db_corrupted = false;
+/* LCOV_EXCL_START */
static int __check_integrity_cb(void *pid, int argc, char **argv, char **notUsed)
{
if (strcmp(argv[0], "ok") != 0) {
INFO("db integrity result : %s" , argv[0]);
return 0;
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
static int __recover_corrupted_db(sqlite3 *db)
{
int ret = BADGE_ERROR_NONE;
return ret;
}
+/* LCOV_EXCL_STOP */
-EXPORT_API
-int badge_db_init()
+/* LCOV_EXCL_START */
+EXPORT_API int badge_db_init()
{
int ret = BADGE_ERROR_NONE;
int sql_ret;
return ret;
}
+/* LCOV_EXCL_STOP */
EXPORT_API
int badge_db_is_existing(const char *pkgname, bool *existing, uid_t uid)
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", ret,
sqlite3_errmsg(db));
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
if (stmt != NULL) {
sqlite3_finalize(stmt);
} else {
+ /* LCOV_EXCL_START */
ERR("sqlite3_step failed [%d][%s]", ret,
sqlite3_errmsg(db));
sqlite3_finalize(stmt);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
} else {
return BADGE_ERROR_FROM_DB;
sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %q WHERE " \
"pkgname = %Q AND uid = %d",
BADGE_TABLE_NAME, pkgname, uid);
-
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %q WHERE " \
"pkgname = %Q AND uid = %d",
BADGE_OPTION_TABLE_NAME, pkgname, uid);
-
if (!sqlbuf) {
/* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = badge_db_exec(db, sqlbuf, NULL);
if (ret != BADGE_ERROR_NONE) {
- ERR("Failed to remove badge[%s], err[%d]",
- appid, ret);
+ /* LCOV_EXCL_START */
+ ERR("Failed to remove badge[%s], err[%d]", appid, ret);
result = ret;
goto return_close_db;
+ /* LCOV_EXCL_STOP */
}
/* treating option table */
BADGE_SETTING_DB_TABLE, pkgname, uid,
tzplatform_getuid(TZ_SYS_GLOBALAPP_USER));
if (!sql_query) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
sql_ret = sqlite3_get_table(db, sql_query, &query_result, &row_count, &col_count, NULL);
if (sql_ret != SQLITE_OK && sql_ret != -1) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_get_table failed [%d][%s]", sql_ret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
if (!row_count) {
struct _badge_cb_data *bd = NULL;
bd = (struct _badge_cb_data *)malloc(sizeof(struct _badge_cb_data));
if (bd == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed malloc badge_cb_data");
return NULL;
+ /* LCOV_EXCL_STOP */
}
bd->callback = callback;
badge = (badge_h *)malloc(sizeof(struct _badge_h));
if (!badge) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc handle");
if (err)
*err = BADGE_ERROR_OUT_OF_MEMORY;
return NULL;
+ /* LCOV_EXCL_STOP */
}
badge->pkgname = strdup(pkgname);
task_list *list_new;
list_new = (task_list *) malloc(sizeof(task_list));
-
if (list_new == NULL)
return BADGE_ERROR_OUT_OF_MEMORY;
result_setting = (struct badge_setting *)malloc(sizeof(struct badge_setting));
if (result_setting == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed memory allocation.");
g_object_unref(reply);
return BADGE_ERROR_OUT_OF_MEMORY;
+ /* LCOV_EXCL_STOP */
}
badge_ipc_make_setting_from_gvariant(result_setting, setting_body);
*setting = result_setting;
sqlret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sqlret != SQLITE_OK || !db) {
+ /* LCOV_EXCL_START */
ERR("Failed to db_util_open [%d]", sqlret);
if (sqlret == SQLITE_PERM)
return BADGE_ERROR_PERMISSION_DENIED;
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sqlbuf = sqlite3_mprintf("SELECT count(*) FROM %q WHERE " \
sql_ret = sqlite3_open_v2(BADGE_DB_PATH, &db, SQLITE_OPEN_READWRITE, NULL);
if (ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("db_util_open failed [%s][%d]", BADGE_DB_PATH, sql_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
is_package_in_setting_table = _is_package_in_setting_table(db, pkgname, NULL, uid);
sqlite3_exec(db, "BEGIN immediate;", NULL, NULL, NULL);
query = sqlite3_mprintf("DELETE FROM badge_setting "
- "WHERE uid = %d AND pkgname = %Q ",
- uid, pkgname);
+ "WHERE uid = %d AND pkgname = %Q ",
+ uid, pkgname);
if (query == NULL) {
+ /* LCOV_EXCL_START */
ERR("Out of memory");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, query, NULL);
if (ret != BADGE_ERROR_NONE) {
+ /* LCOV_EXCL_START */
ERR("DB Error");
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
return ret;
}
+/* LCOV_EXCL_START */
EXPORT_API int badge_setting_refresh_setting_table(uid_t uid)
{
int ret = BADGE_ERROR_NONE;
pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&filter);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_create failed [%d]", pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
- /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(filter,
PMINFO_APPINFO_PROP_PRIVILEGE, BADGE_PRIVILEGE);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_add_string failed [%d]",
pkgmgr_ret);
goto out;
- /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_bool(filter,
PMINFO_APPINFO_PROP_APP_NODISPLAY, false);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_add_bool failed [%d]",
pkgmgr_ret);
goto out;
- /* LCOV_EXCL_STOP */
}
info.db = db;
pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(filter,
app_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
- /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_usr_filter_foreach_appinfo failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
- /* LCOV_EXCL_STOP */
}
out:
return ret;
}
+/* LCOV_EXCL_STOP */
+/* LCOV_EXCL_START */
EXPORT_API int badge_setting_arrange_tables(uid_t uid)
{
int ret = BADGE_ERROR_NONE;
"(SELECT pkgname FROM %Q) AND uid = %d",
BADGE_TABLE_NAME, BADGE_SETTING_DB_TABLE, uid);
if (sqlbuf == NULL) {
- /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
- /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, sqlbuf, NULL);
BADGE_OPTION_TABLE_NAME, BADGE_SETTING_DB_TABLE,
uid);
if (sqlbuf == NULL) {
- /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
- /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, sqlbuf, NULL);
return ret;
}
+/* LCOV_EXCL_STOP */