+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
-// copyright
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#define _GNU_SOURCE
#include <stdio.h>
int ret;
pkgmgr_certinfo_x *info = (pkgmgr_certinfo_x *)certinfo;
- if (pkgid == NULL || certinfo == NULL)
+ if (db == NULL || pkgid == NULL || certinfo == NULL)
return PMINFO_R_EINVAL;
ret = _pkginfo_get_certinfo(db, pkgid, info);
if (ret != PMINFO_R_OK)
int ret;
pkgmgr_certinfo_x *info = (pkgmgr_certinfo_x *)handle;
- if (pkgid == NULL || handle == NULL) {
+ if (db == NULL || pkgid == NULL || handle == NULL) {
_LOGE("invalid parameter");
return PMINFO_R_EINVAL;
}
int ret;
sqlite3_stmt *stmt;
+ if (db == NULL || pkgid == NULL)
+ return PMINFO_R_EINVAL;
+
query = sqlite3_mprintf("UPDATE package_cert_info "
"SET package_count = package_count - 1 "
"WHERE package=%Q", pkgid);
-// copyright
+/*
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
#define _GNU_SOURCE
#include <stdio.h>
static const char query_from_clause[] = " FROM package_info as pi";
int ret = PMINFO_R_ERROR;
int idx = 0;
- //char *dbpath;
char *tmp_record = NULL;
char *constraints = NULL;
char query[MAX_QUERY_LEN] = { '\0' };
package_x *info = NULL;
author_x *author = NULL;
GList *bind_params = NULL;
- //sqlite3 *db;
sqlite3_stmt *stmt = NULL;
bool is_check_storage = true;
const uid_t global_user_uid = GLOBAL_USER;
-#if 0
- dbpath = getUserPkgParserDBPathUID(uid);
- if (dbpath == NULL)
- return PMINFO_R_ERROR;
- ret = __open_db(dbpath, &db, SQLITE_OPEN_READONLY);
- if (ret != SQLITE_OK) {
- _LOGD("failed to open db(%s): %d", dbpath, ret);
- free(dbpath);
- return PMINFO_R_ERROR;
+ if (db == NULL || locale == NULL || filter == NULL) {
+ LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
}
- free(dbpath);
-#endif
+
is_check_storage = __check_package_storage_status(filter);
snprintf(query, MAX_QUERY_LEN - 1, "%s", query_raw);
sqlite3_stmt *stmt = NULL;
char *result = NULL;
+ if (db == NULL || query == NULL) {
+ LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
ret = sqlite3_prepare_v2(db, query, strlen(query), &stmt, NULL);
if (ret != SQLITE_OK) {
LOGE("prepare failed: %s", sqlite3_errmsg(db));
char *item;
int ret;
+ if (db == NULL || pkgid == NULL) {
+ LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
queue = g_queue_new();
if (queue == NULL) {
LOGE("out of memory");
int i;
int j;
query_args *tmp_ptr = NULL;
+
+ if (db == NULL || queries == NULL) {
+ _LOGE("Invalid parameter");
+ return PMINFO_R_EINVAL;
+ }
+
__BEGIN_TRANSACTION(db);
for (i = 0; i < g_list_length(queries); ++i) {
tmp_ptr = (query_args *)g_list_nth_data(params_list, i);