中国优质的IT技术网站
专业IT技术创作平台
IT职业在线教育平台
如何设置关系型数据库的安全级别?
微信扫码分享
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}`); })