#include <shared_mutex>
#include <vector>
+#include "utils/logging.hh"
+
#include "pkgmgrinfo_debug.h"
#include "pkgmgrinfo_internal.h"
namespace database {
CertGetDBHandler::CertGetDBHandler(uid_t uid, int pid)
- : AbstractDBHandler(uid, pid), uid_(uid) {}
+ : AbstractDBHandler(uid, pid), uid_(uid), handle_(nullptr) {}
CertGetDBHandler::~CertGetDBHandler() {}
}
int CertGetDBHandler::Execute() {
- std::shared_lock<std::shared_timed_mutex> s(lock_);
+ std::shared_lock<std::shared_mutex> s(lock_);
+
SetOpType(pkgmgr_common::DBOperationType::OPERATION_TYPE_READ);
SetDBType(pkgmgr_common::DBType::DB_TYPE_FILE_CERTDB);
+
if (!Connect()) {
- _LOGE("Failed to connect database");
+ LOG(ERROR) << "Failed to connect database";
return PMINFO_R_ERROR;
}
if (ret != PMINFO_R_OK)
return ret;
- handle_ = static_cast<pkgmgr_certinfo_x*>(handle);
- sqlite3* conn = GetConnection().front().first;
- ret = certinfo_internal_get(conn, pkgid_.c_str(), uid_, handle_);
+ handle_ = reinterpret_cast<pkgmgr_certinfo_x*>(handle);
+ const auto& db = GetConnection().front().first;
- return ret;
+ return internal::CertInfoGet(db, pkgid_, uid_, handle_);
}
} // namespace database