#鸿蒙学习大百科#如何设置关系型数据库的安全级别?

如何设置关系型数据库的安全级别?

HarmonyOS
2024-10-22 15:59:30
浏览
收藏 0
回答 1
待解决
回答 1
按赞同
/
按时间
风间爱小新V
import { BusinessError } from '@ohos.base';
import relationalStore from '@ohos.data.relationalStore';

let store: relationalStore.RdbStore;
let context = getContext(this);
const STORE_CONFIG: relationalStore.StoreConfig = {
  name: 'RdbTest.db',
  securityLevel: relationalStore.SecurityLevel.S1//安全级别
};
let promise = relationalStore.getRdbStore(context, STORE_CONFIG);
promise.then(async (rdbStore) => {
  store = rdbStore;
  console.info('Succeeded in getting RdbStore.')
}).catch((err: BusinessError) => {
  console.error(`Failed to get RdbStore. Code:${err.code},message:${err.message}`);
})
分享
微博
QQ
微信
回复
2024-10-22 21:54:37
相关问题