#include "cert_get_db_handler.hh"
+#include <vector>
+
+ #include "pkgmgrinfo_debug.h"
#include "pkgmgrinfo_internal.h"
namespace pkgmgr_common {
#include "depinfo_db_handler.hh"
+#include <vector>
+
+ #include "pkgmgrinfo_debug.h"
#include "pkgmgrinfo_internal.h"
namespace pkgmgr_common {
SetOpType(OPERATION_TYPE_READ);
SetDBType(DB_TYPE_FILE_PKGDB);
- if (!Connect()) return PMINFO_R_ERROR;
+ if (!Connect()) {
+ _LOGE("Failed to connect database");
+ return PMINFO_R_ERROR;
+ }
GList *list = nullptr;
- int ret = pkginfo_internal_filter_get_depends_on(
- GetConnection(), pkgid_.c_str(), &list);
-
+ std::vector<sqlite3*> conn_list = GetConnection();
+ int ret;
+ for (auto& conn : conn_list) {
+ ret = pkginfo_internal_filter_get_depends_on(
+ conn, pkgid_.c_str(), &list);
+ if (ret == PMINFO_R_ERROR)
+ break;
+ }
return ret;
}
#include "pkg_get_db_handler.hh"
+#include <vector>
+
+ #include "pkgmgrinfo_debug.h"
#include "pkgmgrinfo_internal.h"
namespace {
#include "db_handle_provider.hh"
#include "pkg_set_db_handler.hh"
+#include <vector>
+
+ #include "pkgmgrinfo_debug.h"
#include "pkgmgr_parser_db.h"
namespace pkgmgr_common {
int ret = 0;
DBHandleProvider::GetInst(uid_).SetMemoryMode(true);
+ std::vector<sqlite3*> conn_list = GetConnection();
+ sqlite3* conn = conn_list.front();
if (write_type_ == Insert) {
- ret = pkgmgr_parser_insert_pkg_info(GetConnection(), package_, uid_);
+ ret = pkgmgr_parser_insert_pkg_info(conn, package_, uid_);
} else if (write_type_ == Update) {
- ret = pkgmgr_parser_update_pkg_info(GetConnection(), package_, uid_);
+ ret = pkgmgr_parser_update_pkg_info(conn, package_, uid_);
} else if (write_type_ == Delete) {
- ret = pkgmgr_parser_delete_pkg_info(GetConnection(), package_->package, uid_);
+ ret = pkgmgr_parser_delete_pkg_info(conn, package_->package, uid_);
} else {
-
+ _LOGE("Unknown db write type");
}
if (ret != PM_PARSER_R_OK) {
#include "query_handler.hh"
+#include <vector>
+
+ #include "pkgmgrinfo_debug.h"
#include "pkgmgrinfo_internal.h"
namespace pkgmgr_common {
GList* list =nullptr;
int row = 0;
int col = 0;
- if (query_.size() == 0)
+ if (query_.size() == 0) {
+ _LOGE("Empty query");
return PMINFO_R_ERROR;
+ }
+ int ret;
+ std::vector<sqlite3*> conn_list = GetConnection();
if (GetOpType() == OPERATION_TYPE_READ) {
- int ret = get_query_result(GetConnection(), query_[0].c_str(), &list, &row, &col);
- if (ret != PMINFO_R_OK) {
- _LOGE("Failed to execute query");
- return ret;
- }
-
- result_.clear();
- result_.resize(row);
- GList* tmp = list;
- for (int i = 0; i < row; ++i) {
- for (int j = 0; j < col; ++j) {
- result_[i].emplace_back(reinterpret_cast<char *>(tmp->data));
- tmp = tmp->next;
+ for (auto& conn : conn_list) {
+ ret = get_query_result(conn, query_[0].c_str(), &list, &row, &col);
+ if (ret == PMINFO_R_ERROR) {
- // TODO: error log
++ _LOGE("Failed to execute query");
+ return ret;
+ }
-
++
+ result_.clear();
+ result_.resize(row);
+ GList* tmp = list;
+ for (int i = 0; i < row; ++i) {
+ for (int j = 0; j < col; ++j) {
+ result_[i].emplace_back(reinterpret_cast<char *>(tmp->data));
+ tmp = tmp->next;
+ }
}
- }
- g_list_free(list);
+ g_list_free(list);
+ }
return ret;
} else {
const char **queries = (const char **)calloc(query_.size(), sizeof(char *));