+static int __check_appinfo_for_uid_table(const char *appid, uid_t uid,
+ const char *except_col_name)
+{
+ int ret = -1;
+ char query[MAX_QUERY_LEN] = { '\0', };
+ sqlite3_stmt *stmt;
+ char *val = NULL;
+
+ if (appid == NULL)
+ return -1;
+
+ if (except_col_name == NULL) {
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "SELECT COUNT(*) FROM " \
+ "package_app_info_for_uid WHERE app_id=%Q AND uid='%d'", appid, (int)uid);
+ } else if (strcmp(except_col_name, "is_disabled") == 0) {
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "SELECT COUNT(*) FROM " \
+ "package_app_info_for_uid WHERE app_id=%Q AND uid='%d' " \
+ "AND is_splash_screen_disabled='false'", appid, (int)uid);
+ } else if (strcmp(except_col_name, "is_splash_screen_disabled") == 0) {
+ sqlite3_snprintf(MAX_QUERY_LEN, query, "SELECT COUNT(*) FROM " \
+ "package_app_info_for_uid WHERE app_id=%Q AND uid='%d' " \
+ "AND is_disabled='false'", appid, (int)uid);
+ }
+
+ ret = sqlite3_prepare_v2(pkgmgr_parser_db, query, strlen(query), &stmt, NULL);
+ if (ret != SQLITE_OK) {
+ LOGE("prepare failed: %s", sqlite3_errmsg(pkgmgr_parser_db));
+ return PMINFO_R_ERROR;
+ }
+
+ if (sqlite3_step(stmt) != SQLITE_ROW) {
+ LOGE("failed to step");
+ sqlite3_finalize(stmt);
+ return PMINFO_R_ERROR;
+ }
+
+ val = (const char *)sqlite3_column_text(stmt, 0);
+ ret = atoi(val);
+ sqlite3_finalize(stmt);
+ return ret;
+}
+