sql_ret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sql_ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed db util open [%s][%d]", BADGE_DB_PATH, sql_ret);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sql_query = sqlite3_mprintf("SELECT pkgname, appid, allow_to_display FROM %s " \
"ORDER BY uid DESC;",
BADGE_SETTING_DB_TABLE, appid, 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) {
+ /* LCOV_EXCL_START */
DBG("No setting found for [%s]", appid);
ret = BADGE_ERROR_NOT_EXIST;
goto out;
+ /* LCOV_EXCL_STOP */
}
result_setting = (struct badge_setting *)malloc(sizeof(struct badge_setting));
if (result_setting == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc setting");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = col_count;
sql_ret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sql_ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("db_util_open failed [%s][%d]", BADGE_DB_PATH, sql_ret);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sqlbuf = sqlite3_mprintf("UPDATE %s SET allow_to_display = %d " \
pkgname, appid, uid);
if (!sqlbuf) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
ret = badge_db_exec(db, sqlbuf, NULL);
sql_ret = db_util_open(BADGE_DB_PATH, &db, 0);
if (sql_ret != SQLITE_OK || db == NULL) {
+ /* LCOV_EXCL_START */
ERR("Failed db util open [%s][%d]", BADGE_DB_PATH, sql_ret);
return BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
sql_query = sqlite3_mprintf("SELECT allow_to_display FROM %s WHERE appid = %Q " \
BADGE_SETTING_DB_TABLE, appid, 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) {
+ /* LCOV_EXCL_START */
DBG("No setting found for [%s]", appid);
ret = BADGE_ERROR_NOT_EXIST;
goto out;
+ /* LCOV_EXCL_STOP */
}
col_index = col_count;
"appid = %Q AND uid = %d",
BADGE_SETTING_DB_TABLE, appid, uid);
if (!sqlbuf) {
+ /* LCOV_EXCL_START */
ERR("Failed to alloc query");
ret = BADGE_ERROR_OUT_OF_MEMORY;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlret = sqlite3_prepare_v2(db, sqlbuf, -1, &stmt, NULL);
if (sqlret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlret = sqlite3_step(stmt);
sqlite3_ret = sqlite3_prepare_v2(db, "SELECT pkgname FROM badge_setting WHERE uid = ? AND pkgname = ?", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlite3_bind_int(db_statement, field_index++, uid);
}
if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_ROW) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_step failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
err = false;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
pkgmgr_ret = pkgmgrinfo_appinfo_filter_create(&handle);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_appinfo_filter_create failed [%d]", pkgmgr_ret);
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_appinfo_filter_add_string(handle, PMINFO_APPINFO_PROP_APP_PACKAGE, pkgname);
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(handle, 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 */
}
pkgmgr_ret = pkgmgrinfo_appinfo_usr_filter_foreach_appinfo(handle, app_info_callback, info, info->uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_foreach_appinfo failed [%d]",
pkgmgr_ret);
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&handle);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_add_string(handle, PMINFO_PKGINFO_PROP_PACKAGE_ID, pkgname);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_add_string failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
info.db = db;
info.uid = uid;
pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(handle, package_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
out:
sqlite3_ret = sqlite3_prepare_v2(db, "DELETE FROM badge_setting WHERE uid = ? AND pkgname = ? ", -1, &db_statement, NULL);
if (sqlite3_ret != SQLITE_OK) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_prepare_v2 failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
sqlite3_bind_int(db_statement, field_index++, uid);
sqlite3_ret = sqlite3_step(db_statement);
if (sqlite3_ret != SQLITE_OK && sqlite3_ret != SQLITE_DONE) {
+ /* LCOV_EXCL_START */
ERR("sqlite3_step failed [%d][%s]", sqlite3_ret,
sqlite3_errmsg(db));
ret = BADGE_ERROR_FROM_DB;
+ /* LCOV_EXCL_STOP */
}
out:
pkgmgr_ret = pkgmgrinfo_pkginfo_filter_create(&filter);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_filter_create failed [%d]", pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
info.db = db;
info.uid = uid;
pkgmgr_ret = pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo(filter, package_info_callback, &info, uid);
if (pkgmgr_ret != PMINFO_R_OK) {
+ /* LCOV_EXCL_START */
ERR("pkgmgrinfo_pkginfo_usr_filter_foreach_pkginfo failed [%d]",
pkgmgr_ret);
ret = BADGE_ERROR_FROM_DB;
goto out;
+ /* LCOV_EXCL_STOP */
}
out: