getRdbStore调用方式修改

Signed-off-by: yuxiaoya2 <yuxiaoya@huawei.com>
Change-Id: Idbe1fe836eb33f0d36fea4e09d17abdb96d9fb15
This commit is contained in:
yuxiaoya2 2024-03-25 20:16:38 +08:00
parent c51285dcb0
commit 4930a47143

View File

@ -1523,8 +1523,12 @@ export default function rdbSyncFirstLevelTest(){
const CREATE_TABLE_TEST_S2 = "CREATE TABLE IF NOT EXISTS test (" + "id INTEGER PRIMARY KEY AUTOINCREMENT, " + "name TEXT NOT NULL, " + "age INTEGER, " + "salary REAL, " + "blobType BLOB)";
let context:common.UIAbilityContext | undefined = AppStorage.get('context') as common.UIAbilityContext;
rdbSecondStore = await data_Rdb.getRdbStore(context, STORE_CONFIGS2);
console.info("testRdbSyncStageEtsTest0190 create RemoteS2Rdb.db success");
await data_Rdb.getRdbStore(context, STORE_CONFIGS2).then(async (store: data_Rdb.RdbStore) => {
rdbSecondStore = store;
console.info("testRdbSyncStageEtsTest0190 create RemoteS2Rdb.db success");
}).catch((err: BusinessError) => {
console.error(`testRdbSyncStageEtsTest0190 create RemoteS2Rdb.db failed, code is ${err.code},message is ${err.message}`);
})
rdbSecondStore.executeSql(CREATE_TABLE_TEST_S2, null);
console.info(logTag + "create RemoteS2Rdb.db table success");
//setDistributedTables