mirror of
https://gitee.com/openharmony/distributeddatamgr_relational_store
synced 2024-11-27 09:11:59 +00:00
repair errcode
Signed-off-by: leiiyb <leiyanbo@huawei.com>
This commit is contained in:
parent
e3bc8dff58
commit
61d980efe9
@ -1097,7 +1097,7 @@ napi_value RdbStoreProxy::SetDistributedTables(napi_env env, napi_callback_info
|
||||
}
|
||||
int res = obj->rdbStore_->SetDistributedTables(context->tablesName);
|
||||
LOG_DEBUG("RdbStoreProxy::SetDistributedTables res is : %{public}d", res);
|
||||
return (res == E_OK || res == E_NOT_SUPPORTED) ? OK : ERR;
|
||||
return (res == E_OK || res == E_NOT_SUPPORT) ? OK : ERR;
|
||||
};
|
||||
auto output = [context](napi_env env, napi_value &result) -> int {
|
||||
napi_status status = napi_get_undefined(env, &result);
|
||||
|
@ -50,7 +50,7 @@ static constexpr JsErrorCode JS_ERROR_CODE_MSGS[] = {
|
||||
{ NativeRdb::E_SQLITE_MISMATCH, 14800033, "SQLite: Data type mismatch." },
|
||||
{ NativeRdb::E_SQLITE_MISUSE, 14800034, "SQLite: Library used incorrectly." },
|
||||
{ NativeRdb::E_CONFIG_INVALID_CHANGE, 14800017, "Config changed." },
|
||||
{ NativeRdb::E_NOT_SUPPORTED, 801, "Capability not supported." },
|
||||
{ NativeRdb::E_NOT_SUPPORT, 801, "Capability not support." },
|
||||
};
|
||||
|
||||
const std::optional<JsErrorCode> GetJsErrorCode(int32_t errorCode)
|
||||
|
@ -309,7 +309,7 @@ int CacheResultSet::GetAssets(int32_t col, ValueObject::Assets &value)
|
||||
|
||||
int CacheResultSet::GetFloat32Array(int32_t index, ValueObject::FloatVector &vecs)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int CacheResultSet::Get(int32_t col, ValueObject &value)
|
||||
|
@ -113,7 +113,7 @@ int RdConnection::InnerOpen(const RdbStoreConfig &config)
|
||||
|
||||
int32_t RdConnection::OnInitialize()
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
std::pair<int32_t, RdConnection::Stmt> RdConnection::CreateStatement(const std::string& sql, Connection::SConn conn)
|
||||
@ -149,32 +149,32 @@ bool RdConnection::IsWriter() const
|
||||
|
||||
int32_t RdConnection::ReSetKey(const RdbStoreConfig& config)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::TryCheckPoint()
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::LimitWalSize()
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::ConfigLocale(const std::string& localeStr)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::CleanDirtyData(const std::string& table, uint64_t cursor)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::SubscribeTableChanges(const Connection::Notifier& notifier)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::GetMaxVariable() const
|
||||
@ -184,24 +184,24 @@ int32_t RdConnection::GetMaxVariable() const
|
||||
|
||||
int32_t RdConnection::GetJournalMode()
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::ClearCache()
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::Subscribe(const std::string& event,
|
||||
const std::shared_ptr<DistributedRdb::RdbStoreObserver>& observer)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::Unsubscribe(const std::string& event,
|
||||
const std::shared_ptr<DistributedRdb::RdbStoreObserver>& observer)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t RdConnection::Backup(const std::string &databasePath, const std::vector<uint8_t> &destEncryptKey)
|
||||
|
@ -112,11 +112,11 @@ std::pair<int32_t, std::shared_ptr<RdbService>> RdbManagerImpl::GetRdbService(co
|
||||
auto remote = distributedDataMgr_->GetFeatureInterface(DistributedRdb::RdbService::SERVICE_NAME);
|
||||
if (remote == nullptr) {
|
||||
LOG_ERROR("get rdb service failed");
|
||||
return { E_NOT_SUPPORTED, nullptr };
|
||||
return { E_NOT_SUPPORT, nullptr };
|
||||
}
|
||||
|
||||
if (!remote->IsProxyObject()) {
|
||||
return { E_NOT_SUPPORTED, nullptr };
|
||||
return { E_NOT_SUPPORT, nullptr };
|
||||
}
|
||||
|
||||
sptr<RdbServiceProxy> rdbService = iface_cast<RdbServiceProxy>(remote);
|
||||
|
@ -143,7 +143,7 @@ void RdbStoreImpl::AfterOpen(const RdbStoreConfig &config)
|
||||
void RdbStoreImpl::UploadSchema(const DistributedRdb::RdbSyncerParam ¶m, uint32_t retry)
|
||||
{
|
||||
auto [err, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(param);
|
||||
if (err == E_NOT_SUPPORTED) {
|
||||
if (err == E_NOT_SUPPORT) {
|
||||
return;
|
||||
}
|
||||
if (err != E_OK || service == nullptr) {
|
||||
@ -301,7 +301,7 @@ RdbStore::ModifyTime RdbStoreImpl::GetModifyTimeByRowId(const std::string &logTa
|
||||
|
||||
int RdbStoreImpl::CleanDirtyData(const std::string &table, uint64_t cursor)
|
||||
{
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
if (table.empty()) {
|
||||
@ -336,8 +336,7 @@ RdbStoreImpl::RdbStoreImpl(const RdbStoreConfig &config, int &errCode)
|
||||
}
|
||||
if (connectionPool_ == nullptr || errCode != E_OK) {
|
||||
connectionPool_ = nullptr;
|
||||
LOG_ERROR("Create connPool failed, err is %{public}d, path:%{public}s",
|
||||
errCode, path_.c_str());
|
||||
LOG_ERROR("Create connPool failed, err is %{public}d, path:%{public}s", errCode, path_.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@ -377,7 +376,7 @@ int RdbStoreImpl::BatchInsert(int64_t &outInsertNum, const std::string &table, c
|
||||
int RdbStoreImpl::BatchInsertEntry(int64_t &outInsertNum, const std::string &table,
|
||||
const std::vector<ValuesBucket> &values)
|
||||
{
|
||||
if (((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR))) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
if (values.empty()) {
|
||||
@ -478,7 +477,7 @@ int RdbStoreImpl::InsertWithConflictResolutionEntry(int64_t &outRowId, const std
|
||||
{
|
||||
SqlStatistic sqlStatistic("", SqlStatistic::Step::STEP_TOTAL);
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
if (table.empty()) {
|
||||
@ -592,7 +591,7 @@ int RdbStoreImpl::UpdateWithConflictResolutionEntry(int &changedRows, const std:
|
||||
{
|
||||
SqlStatistic sqlStatistic("", SqlStatistic::Step::STEP_TOTAL);
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
if (table.empty()) {
|
||||
@ -662,7 +661,7 @@ int RdbStoreImpl::Delete(int &deletedRows, const std::string &table, const std::
|
||||
const std::vector<ValueObject> &bindArgs)
|
||||
{
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
if (table.empty()) {
|
||||
@ -747,7 +746,7 @@ std::shared_ptr<ResultSet> RdbStoreImpl::RemoteQuery(const std::string &device,
|
||||
std::vector<std::string> selectionArgs = predicates.GetWhereArgs();
|
||||
std::string sql = SqliteSqlBuilder::BuildQueryString(predicates, columns);
|
||||
auto [err, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(syncerParam_);
|
||||
if (err == E_NOT_SUPPORTED) {
|
||||
if (err == E_NOT_SUPPORT) {
|
||||
errCode = err;
|
||||
return nullptr;
|
||||
}
|
||||
@ -831,7 +830,7 @@ int RdbStoreImpl::ExecuteSqlEntry(const std::string &sql, const std::vector<Valu
|
||||
{
|
||||
SqlStatistic sqlStatistic("", SqlStatistic::Step::STEP_TOTAL);
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
if (config_.GetDBType() == DB_VECTOR) {
|
||||
if (config_.GetDBType() == DB_VECTOR || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
int ret = CheckAttach(sql);
|
||||
@ -916,8 +915,12 @@ std::pair<int32_t, ValueObject> RdbStoreImpl::HandleDifferentSqlTypes(std::share
|
||||
std::pair<int32_t, ValueObject> RdbStoreImpl::ExecuteEntry(const std::string &sql,
|
||||
const std::vector<ValueObject> &bindArgs, int64_t trxId)
|
||||
{
|
||||
SqlStatistic sqlStatistic("", SqlStatistic::Step::STEP_TOTAL);
|
||||
ValueObject object;
|
||||
if (config_.IsReadOnly()) {
|
||||
return { E_NOT_SUPPORT, object };
|
||||
}
|
||||
|
||||
SqlStatistic sqlStatistic("", SqlStatistic::Step::STEP_TOTAL);
|
||||
int sqlType = SqliteUtils::GetSqlStatementType(sql);
|
||||
if (!SqliteUtils::IsSupportSqlForExecute(sqlType)) {
|
||||
LOG_ERROR("Not support the sqlType: %{public}d, sql: %{public}s", sqlType, sql.c_str());
|
||||
@ -990,7 +993,7 @@ int RdbStoreImpl::ExecuteAndGetString(
|
||||
int RdbStoreImpl::ExecuteForLastInsertedRowId(int64_t &outValue, const std::string &sql,
|
||||
const std::vector<ValueObject> &bindArgs)
|
||||
{
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
auto [errCode, statement] = GetStatement(sql, false);
|
||||
@ -1008,7 +1011,7 @@ int RdbStoreImpl::ExecuteForLastInsertedRowId(int64_t &outValue, const std::stri
|
||||
int RdbStoreImpl::ExecuteForChangedRowCount(int64_t &outValue, const std::string &sql,
|
||||
const std::vector<ValueObject> &bindArgs)
|
||||
{
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
auto [errCode, statement] = GetStatement(sql, false);
|
||||
@ -1109,7 +1112,7 @@ int RdbStoreImpl::InnerBackup(const std::string &databasePath, const std::vector
|
||||
return E_BASE;
|
||||
}
|
||||
if (isEncrypt_) {
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
return conn->Backup(databasePath, {});
|
||||
}
|
||||
@ -1150,7 +1153,7 @@ std::pair<int32_t, RdbStoreImpl::Stmt> RdbStoreImpl::BeginExecuteSql(const std::
|
||||
{
|
||||
int type = SqliteUtils::GetSqlStatementType(sql);
|
||||
if (SqliteUtils::IsSpecial(type)) {
|
||||
return { E_NOT_SUPPORTED, nullptr };
|
||||
return { E_NOT_SUPPORT, nullptr };
|
||||
}
|
||||
|
||||
bool assumeReadOnly = SqliteUtils::IsSqlReadOnly(type);
|
||||
@ -1242,7 +1245,7 @@ std::pair<int32_t, int32_t> RdbStoreImpl::Attach(
|
||||
|
||||
// encrypted databases are not supported to attach a non encrypted database.
|
||||
if (!config.IsEncrypt() && isEncrypt_) {
|
||||
return { E_NOT_SUPPORTED, 0 };
|
||||
return { E_NOT_SUPPORT, 0 };
|
||||
}
|
||||
|
||||
if (attachedInfo_.Contains(attachName)) {
|
||||
@ -1342,7 +1345,7 @@ int RdbStoreImpl::GetVersion(int &version)
|
||||
*/
|
||||
int RdbStoreImpl::SetVersion(int version)
|
||||
{
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
@ -1360,7 +1363,7 @@ int RdbStoreImpl::BeginTransaction()
|
||||
{
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
std::lock_guard<std::mutex> lockGuard(connectionPool_->GetTransactionStackMutex());
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
// size + 1 means the number of transactions in process
|
||||
@ -1419,7 +1422,7 @@ int RdbStoreImpl::RollBack()
|
||||
{
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
std::lock_guard<std::mutex> lockGuard(connectionPool_->GetTransactionStackMutex());
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
size_t transactionId = connectionPool_->GetTransactionStack().size();
|
||||
@ -1454,7 +1457,7 @@ int RdbStoreImpl::RollBack()
|
||||
int RdbStoreImpl::ExecuteByTrxId(const std::string &sql, int64_t trxId, bool closeConnAfterExecute,
|
||||
const std::vector<ValueObject> &bindArgs)
|
||||
{
|
||||
if (!config_.IsVector()) {
|
||||
if ((!config_.IsVector()) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
if (trxId == 0) {
|
||||
@ -1501,7 +1504,7 @@ int RdbStoreImpl::Commit()
|
||||
{
|
||||
DISTRIBUTED_DATA_HITRACE(std::string(__FUNCTION__));
|
||||
std::lock_guard<std::mutex> lockGuard(connectionPool_->GetTransactionStackMutex());
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR)) {
|
||||
if ((config_.GetRoleType() == VISITOR) || (config_.GetDBType() == DB_VECTOR) || (config_.IsReadOnly())) {
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
size_t transactionId = connectionPool_->GetTransactionStack().size();
|
||||
@ -1828,7 +1831,7 @@ int RdbStoreImpl::InnerSync(const DistributedRdb::RdbService::Option &option,
|
||||
const DistributedRdb::PredicatesMemo &predicates, const RdbStore::AsyncDetail &async)
|
||||
{
|
||||
auto [errCode, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(syncerParam_);
|
||||
if (errCode == E_NOT_SUPPORTED) {
|
||||
if (errCode == E_NOT_SUPPORT) {
|
||||
return errCode;
|
||||
}
|
||||
if (errCode != E_OK) {
|
||||
@ -2150,7 +2153,7 @@ void RdbStoreImpl::InitDelayNotifier()
|
||||
delayNotifier_->SetExecutorPool(pool_);
|
||||
delayNotifier_->SetTask([param = syncerParam_](const DistributedRdb::RdbChangedData& rdbChangedData) -> int {
|
||||
auto [errCode, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(param);
|
||||
if (errCode == E_NOT_SUPPORTED) {
|
||||
if (errCode == E_NOT_SUPPORT) {
|
||||
return errCode;
|
||||
}
|
||||
if (errCode != E_OK || service == nullptr) {
|
||||
|
@ -152,7 +152,7 @@ int32_t RdbStoreManager::GetParamFromService(DistributedRdb::RdbSyncerParam &par
|
||||
{
|
||||
#if !defined(WINDOWS_PLATFORM) && !defined(MAC_PLATFORM) && !defined(ANDROID_PLATFORM) && !defined(IOS_PLATFORM)
|
||||
auto [err, service] = DistributedRdb::RdbManagerImpl::GetInstance().GetRdbService(param);
|
||||
if (err == E_NOT_SUPPORTED) {
|
||||
if (err == E_NOT_SUPPORT) {
|
||||
return E_ERROR;
|
||||
}
|
||||
if (err != E_OK || service == nullptr) {
|
||||
|
@ -1008,12 +1008,12 @@ int32_t SqliteConnection::UnsubscribeLocalDetailAll(const std::string &event)
|
||||
|
||||
int32_t SqliteConnection::Backup(const std::string &databasePath, const std::vector<uint8_t> &destEncryptKey)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
int32_t SqliteConnection::Restore(const std::string &databasePath, const std::vector<uint8_t> &destEncryptKey)
|
||||
{
|
||||
return E_NOT_SUPPORTED;
|
||||
return E_NOT_SUPPORT;
|
||||
};
|
||||
} // namespace NativeRdb
|
||||
} // namespace OHOS
|
||||
|
@ -33,7 +33,7 @@ constexpr int E_BASE = DISTRIBUTEDDATAMGR_RDB_ERR_OFFSET;
|
||||
/**
|
||||
* @brief The error when the capability not supported.
|
||||
*/
|
||||
constexpr int E_NOT_SUPPORTED = (E_BASE + 801);
|
||||
constexpr int E_NOT_SUPPORT = (E_BASE + 801);
|
||||
|
||||
/**
|
||||
* @brief The error code for common exceptions.
|
||||
@ -243,7 +243,7 @@ constexpr int E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40);
|
||||
/**
|
||||
* @brief The error for not supported the current operation.
|
||||
*/
|
||||
constexpr int E_NOT_SUPPORT = (E_BASE + 41);
|
||||
constexpr int E_NOT_SUPPORTED = (E_BASE + 41);
|
||||
|
||||
/**
|
||||
* @brief The error for the current parcel is invalid.
|
||||
|
@ -74,7 +74,7 @@ static constexpr NdkErrorCode ERROR_CODE_MAP[] = {
|
||||
{ OHOS::NativeRdb::E_ARGS_READ_CON_OVERLOAD, RDB_E_ARGS_READ_CON_OVERLOAD },
|
||||
{ OHOS::NativeRdb::E_WAL_SIZE_OVER_LIMIT, RDB_E_WAL_SIZE_OVER_LIMIT },
|
||||
{ OHOS::NativeRdb::E_CON_OVER_LIMIT, RDB_E_CON_OVER_LIMIT },
|
||||
{ OHOS::NativeRdb::E_NOT_SUPPORTED, RDB_E_NOT_SUPPORTED },
|
||||
{ OHOS::NativeRdb::E_NOT_SUPPORT, RDB_E_NOT_SUPPORTED },
|
||||
};
|
||||
|
||||
int ConvertorErrorCode::NativeToNdk(int nativeErrCode)
|
||||
|
@ -19,7 +19,7 @@ import ability_featureAbility from '@ohos.ability.featureAbility'
|
||||
|
||||
const TAG = "[RELATIONAL_STORE_JSKITS_TEST]"
|
||||
const STORE_NAME = "distributed_rdb.db"
|
||||
const E_NOT_SUPPORTED = 801;
|
||||
const E_NOT_SUPPORT = 801;
|
||||
var rdbStore = undefined;
|
||||
var context = ability_featureAbility.getContext()
|
||||
|
||||
@ -96,7 +96,7 @@ describe('rdbStoreDistributedTest', function () {
|
||||
expect(rdbStore).assertEqual(rdbStore)
|
||||
} catch (err) {
|
||||
console.log(TAG + `set none to be distributed table failed, err is ${err.code}.`);
|
||||
expect(E_NOT_SUPPORTED).assertEqual(err.code);
|
||||
expect(E_NOT_SUPPORT).assertEqual(err.code);
|
||||
}
|
||||
done()
|
||||
console.log(TAG + "************* testRdbStoreDistributed002 end *************");
|
||||
@ -115,7 +115,7 @@ describe('rdbStoreDistributedTest', function () {
|
||||
expect(rdbStore).assertEqual(rdbStore)
|
||||
} catch (err) {
|
||||
console.log(TAG + `set employee to be distributed table failed, err is ${err.code}.`);
|
||||
expect(E_NOT_SUPPORTED).assertEqual(err.code);
|
||||
expect(E_NOT_SUPPORT).assertEqual(err.code);
|
||||
}
|
||||
done()
|
||||
console.log(TAG + "************* testRdbStoreDistributed003 end *************");
|
||||
@ -134,7 +134,7 @@ describe('rdbStoreDistributedTest', function () {
|
||||
expect(rdbStore).assertEqual(rdbStore)
|
||||
} catch (err) {
|
||||
console.log(TAG + `set employee and product to be distributed table failed, err is ${err.code}.`);
|
||||
expect(E_NOT_SUPPORTED).assertEqual(err.code);
|
||||
expect(E_NOT_SUPPORT).assertEqual(err.code);
|
||||
}
|
||||
done()
|
||||
console.log(TAG + "************* testRdbStoreDistributed004 end *************");
|
||||
|
@ -124,7 +124,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `insert failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest0002 end *************");
|
||||
})
|
||||
@ -146,7 +146,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `update failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest0003 end *************");
|
||||
})
|
||||
@ -167,7 +167,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `delete failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest0004 end *************");
|
||||
})
|
||||
@ -187,7 +187,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `begin transaction failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest0005 end *************");
|
||||
})
|
||||
@ -251,7 +251,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `get user_version failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest0008 end *************");
|
||||
})
|
||||
@ -272,7 +272,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `set user_version failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest009 end *************");
|
||||
})
|
||||
@ -292,7 +292,7 @@ describe('rdbStoreReadOnlyTest', function () {
|
||||
expect().assertFail();
|
||||
} catch (err) {
|
||||
console.error(TAG, `set user_version failed, errCode:${err.code}, message:${err.message}`);
|
||||
expect(err.code == 14800015).assertTrue();
|
||||
expect(err.code == 801).assertTrue();
|
||||
}
|
||||
console.info(TAG + "************* readOnlyTest0010 end *************");
|
||||
})
|
||||
|
@ -142,7 +142,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0002, TestSize.Level1)
|
||||
ValuesBucket values;
|
||||
values.PutString("name", "liSi");
|
||||
int ret = store->Insert(id, "test", values);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -159,7 +159,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0003, TestSize.Level1)
|
||||
// salary is 300.5
|
||||
values.PutDouble("salary", 300.5);
|
||||
auto ret = store->Update(changedRows, "test", values);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -173,7 +173,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0004, TestSize.Level1)
|
||||
|
||||
int deletedRows;
|
||||
auto ret = store->Delete(deletedRows, "test", "id = 1");
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -186,13 +186,13 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0005, TestSize.Level1)
|
||||
std::shared_ptr<RdbStore> &store = RdbReadOnlyTest::readOnlyStore;
|
||||
|
||||
auto ret = store->BeginTransaction();
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
|
||||
ret = store->Commit();
|
||||
EXPECT_EQ(E_OK, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
|
||||
ret = store->RollBack();
|
||||
EXPECT_EQ(E_NO_TRANSACTION_IN_SESSION, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -210,7 +210,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0006, TestSize.Level1)
|
||||
values.PutString("name", "zhangSan");
|
||||
valuesBuckets.push_back(std::move(values));
|
||||
int error = store->BatchInsert(number, "test", valuesBuckets);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, error);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, error);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -245,10 +245,10 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0008, TestSize.Level1)
|
||||
std::shared_ptr<RdbStore> &store = RdbReadOnlyTest::readOnlyStore;
|
||||
|
||||
auto [ret, object] = store->Execute("PRAGMA user_version");
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
|
||||
std::tie(ret, object) = store->Execute("PRAGMA user_version=2");
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -280,10 +280,10 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0010, TestSize.Level1)
|
||||
std::shared_ptr<RdbStore> &store = RdbReadOnlyTest::readOnlyStore;
|
||||
|
||||
auto ret = store->ExecuteSql("PRAGMA user_version");
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
|
||||
ret = store->ExecuteSql("SELECT * FROM test");
|
||||
EXPECT_EQ(E_OK, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -299,7 +299,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0011, TestSize.Level1)
|
||||
ValuesBucket values;
|
||||
values.PutString("name", "zhangSan");
|
||||
int ret = store->Replace(id, "test", values);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,7 +347,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0014, TestSize.Level1)
|
||||
|
||||
int64_t outValue;
|
||||
int ret = store->ExecuteForLastInsertedRowId(outValue, "", {});
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -361,7 +361,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0015, TestSize.Level1)
|
||||
|
||||
int64_t outValue;
|
||||
int ret = store->ExecuteForChangedRowCount(outValue, "", {});
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -391,7 +391,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0017, TestSize.Level1)
|
||||
|
||||
int version = 2;
|
||||
auto ret = store->SetVersion(version);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -425,7 +425,7 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0018, TestSize.Level1)
|
||||
ValueObject obj;
|
||||
// id is 1
|
||||
std::tie(ret, obj) = store->Execute("PRAGMA user_version", {}, 1);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -501,6 +501,6 @@ HWTEST_F(RdbReadOnlyTest, RdbStore_ReadOnly_0022, TestSize.Level1)
|
||||
|
||||
uint64_t cursor = 1;
|
||||
auto ret = store->CleanDirtyData("test", cursor);
|
||||
EXPECT_EQ(E_DATABASE_BUSY, ret);
|
||||
EXPECT_EQ(E_NOT_SUPPORT, ret);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user