SetOpType(OPERATION_TYPE_WRITE);
SetDBType(DB_TYPE_FILE_CERTDB);
- DBHandleProvider::GetInst(uid_).SetMemoryMode(true);
+ DBHandleProvider::GetInst(uid_).SetMemoryMode(GetPID(), true);
sqlite3 *conn = GetConnection().front();
int ret = certinfo_internal_set(conn, handle_->pkgid, handle_, uid_);
return memorydb;
}
-void DBHandleProvider::SetMemoryMode(bool flag) {
+void DBHandleProvider::SetMemoryMode(int pid, bool flag) {
std::unique_lock<std::mutex> u(lock_);
if (is_memory_ == flag)
return;
parser_memory_db_handle_.reset(nullptr);
cert_memory_db_handle_.reset(nullptr);
global_parser_memory_db_handle_.reset(nullptr);
+ std::vector<int>::iterator it =
+ std::find(pid_list_.begin(), pid_list_.end(), pid);
+ if (it != pid_list_.end())
+ pid_list_.erase(it);
+ else
+ LOGE("Given pid is not exists in pid list : %d", pid);
}
LOGD("Set Memory mode : %s", flag ? "Memory" : "File");
static DBHandleProvider& GetInst(uid_t uid);
std::vector<std::string> GetParserDBPath(int pid);
std::string GetCertDBPath(int pid);
- void SetMemoryMode(bool flag);
+ void SetMemoryMode(int pid, bool flag);
private:
DBHandleProvider(uid_t uid);
int ret = 0;
- DBHandleProvider::GetInst(uid_).SetMemoryMode(true);
+ DBHandleProvider::GetInst(uid_).SetMemoryMode(GetPID(), true);
std::vector<sqlite3*> conn_list = GetConnection();
sqlite3* conn = conn_list.front();
if (write_type_ == Insert) {
}
if (parcel->GetCmd() == CommandType::RemoveCache) {
- pkgmgr_common::DBHandleProvider::GetInst(parcel->GetUid()).SetMemoryMode(false);
+ pkgmgr_common::DBHandleProvider::GetInst(parcel->GetUid()).SetMemoryMode(GetPID(), false);
result_.WriteInt32(0);
}
}
CertGetDBHandler db(parcel->GetUid());
+ db.SetPID(GetPID());
db.SetLocale(locale);
db.SetPkgID(parcel->GetPkgId());
}
DepInfoGetDBHandler db(parcel->GetUid());
+ db.SetPID(GetPID());
db.SetPkgID(parcel->GetPkgID());
int ret = db.Execute();
}
PkgGetDBHandler db(parcel->GetUid());
+ db.SetPID(GetPID());
db.SetLocale(locale);
db.SetFilter(const_cast<pkgmgrinfo_filter_x*>(parcel->GetFilter()));
int ret = db.Execute();
}
QueryHandler db(parcel->GetUid());
+ db.SetPID(GetPID());
db.SetLocale(locale);
db.SetQuery(parcel->GetQueries());
db.SetDBType(parcel->GetDBType());
}
CertSetDBHandler db(parcel->GetUid());
+ db.SetPID(GetPID());
db.SetLocale(locale);
db.SetCertHandle(const_cast<pkgmgr_certinfo_x*>(parcel->GetCertInfo()));
}
PkgSetDBHandler db(parcel->GetUid());
+ db.SetPID(GetPID());
db.SetLocale(locale);
db.SetWriteType(parcel->GetWriteType());