!1613 增加设置搜索启停接口

Merge pull request !1613 from lott14/master
This commit is contained in:
openharmony_ci 2024-08-24 16:51:34 +00:00 committed by Gitee
commit 111edf3ece
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
7 changed files with 40 additions and 0 deletions

View File

@ -74,6 +74,8 @@ public:
int32_t NotifyDataChange(const RdbSyncerParam& param, const RdbChangedData &clientChangedData,
uint32_t delay = 0) override;
int32_t SetSearchable(const RdbSyncerParam& param, bool isSearchable) override;
std::pair<int32_t, std::shared_ptr<ResultSet>> QuerySharingResource(const RdbSyncerParam &param,
const PredicatesMemo &predicates, const std::vector<std::string> &columns) override;
int32_t Disable(const RdbSyncerParam& param) override;

View File

@ -176,6 +176,8 @@ public:
int Notify(const std::string &event) override;
int SetSearchable(bool isSearchable) override;
ModifyTime GetModifyTime(const std::string& table, const std::string& columnName,
std::vector<PRIKey>& keys) override;

View File

@ -498,6 +498,19 @@ void RdbServiceProxy::OnSyncComplete(const std::string &storeName, Details &&res
});
}
int32_t RdbServiceProxy::SetSearchable(const RdbSyncerParam& param, bool isSearchable)
{
MessageParcel reply;
int32_t status = IPC_SEND(static_cast<uint32_t>(RdbServiceCode::RDB_SERVICE_CMD_SET_SEARCHABLE),
reply, param, isSearchable);
if (status != RDB_OK) {
LOG_ERROR("RdbServiceProxy SetSearchable fail, status:%{public}d, "
"bundleName:%{public}s, storeName:%{public}s",
status, param.bundleName_.c_str(), SqliteUtils::Anonymous(param.storeName_).c_str());
}
return status;
}
int32_t RdbServiceProxy::NotifyDataChange(const RdbSyncerParam &param, const RdbChangedData &rdbChangedData,
uint32_t delay)
{

View File

@ -2170,6 +2170,16 @@ int RdbStoreImpl::Notify(const std::string &event)
return E_OK;
}
int RdbStoreImpl::SetSearchable(bool isSearchable)
{
auto [errCode, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(syncerParam_);
if (errCode != E_OK || service == nullptr) {
LOG_ERROR("GetRdbService is failed, err is %{public}d.", errCode);
return errCode;
}
return service->SetSearchable(syncerParam_, isSearchable);
}
int RdbStoreImpl::RegisterAutoSyncCallback(std::shared_ptr<DetailProgressObserver> observer)
{
if (config_.GetDBType() == DB_VECTOR) {

View File

@ -79,6 +79,7 @@ enum class RdbServiceInterfaceCode {
RDB_SERVICE_CMD_REGISTER_AUTOSYNC_PROGRESS_OBSERVER,
RDB_SERVICE_CMD_UNREGISTER_AUTOSYNC_PROGRESS_OBSERVER,
RDB_SERVICE_CMD_NOTIFY_DATA_CHANGE,
RDB_SERVICE_CMD_SET_SEARCHABLE,
RDB_SERVICE_CMD_QUERY_SHARING_RESOURCE,
RDB_SERVICE_CMD_DISABLE,
RDB_SERVICE_CMD_ENABLE,

View File

@ -76,6 +76,8 @@ public:
virtual int32_t NotifyDataChange(
const RdbSyncerParam &param, const RdbChangedData &rdbChangedData, uint32_t delay = 0) = 0;
virtual int32_t SetSearchable(const RdbSyncerParam& param, bool isSearchable) = 0;
virtual int32_t Disable(const RdbSyncerParam &param) = 0;
virtual int32_t Enable(const RdbSyncerParam &param) = 0;

View File

@ -664,6 +664,16 @@ public:
{
return E_ERROR;
}
/**
* @brief Set search enable or disable.
*
* @param isSearchable Indicates enable or disable.
*/
virtual int SetSearchable(bool isSearchable)
{
return E_ERROR;
}
};
} // namespace OHOS::NativeRdb
#endif