mirror of
https://gitee.com/openharmony/applications_settings_data
synced 2024-11-23 06:40:11 +00:00
修改判断
Signed-off-by: 侯志雄 <houzhixiong1@h-partners.com>
This commit is contained in:
parent
a8515b16d0
commit
83aeebe661
@ -39,8 +39,10 @@ export default class UserChangeStaticSubscriber extends StaticSubscriberExtensio
|
|||||||
|
|
||||||
this.init();
|
this.init();
|
||||||
let rdb = await SettingsDBHelper.getInstance().getRdbStore();
|
let rdb = await SettingsDBHelper.getInstance().getRdbStore();
|
||||||
|
Log.info(`rdb ${rdb}`)
|
||||||
switch (event.event) {
|
switch (event.event) {
|
||||||
case commonEventManager.Support.COMMON_EVENT_USER_ADDED:
|
case commonEventManager.Support.COMMON_EVENT_USER_ADDED:
|
||||||
|
Log.info(`case1 ${event.event}`)
|
||||||
// 创建对应用户的数据表
|
// 创建对应用户的数据表
|
||||||
await rdb?.executeSql(SettingsDBHelper.CURRENT_USER_TABLE_CREATE_PREFIX + event.code +
|
await rdb?.executeSql(SettingsDBHelper.CURRENT_USER_TABLE_CREATE_PREFIX + event.code +
|
||||||
SettingsDBHelper.TABLE_CREATE_SUFFIX, []);
|
SettingsDBHelper.TABLE_CREATE_SUFFIX, []);
|
||||||
@ -69,11 +71,13 @@ export default class UserChangeStaticSubscriber extends StaticSubscriberExtensio
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
case commonEventManager.Support.COMMON_EVENT_USER_REMOVED:
|
case commonEventManager.Support.COMMON_EVENT_USER_REMOVED:
|
||||||
|
Log.info(`case2 ${event.event}`)
|
||||||
// 删除对应用户的数据表
|
// 删除对应用户的数据表
|
||||||
rdb?.executeSql(CURRENT_USER_TABLE_DROP + event.code, []);
|
rdb?.executeSql(CURRENT_USER_TABLE_DROP + event.code, []);
|
||||||
rdb?.executeSql(CURRENT_SECURE_USER_TABLE_DROP + event.code, []);
|
rdb?.executeSql(CURRENT_SECURE_USER_TABLE_DROP + event.code, []);
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
|
Log.info(`default ${event.event}`)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ class SettingsDBHelper {
|
|||||||
this.isFirstStartup = await storage.get('isFirstStartup', true);
|
this.isFirstStartup = await storage.get('isFirstStartup', true);
|
||||||
storage = await dataStorage.getPreferences(this.context as Context, SETTINGSDATA_PREFERENCE_USER);
|
storage = await dataStorage.getPreferences(this.context as Context, SETTINGSDATA_PREFERENCE_USER);
|
||||||
this.maxUserNO = await storage.get('MAXUSERNO', 100);
|
this.maxUserNO = await storage.get('MAXUSERNO', 100);
|
||||||
Log.info(`firstStartupConfig isFirstStartUp = ${this.isFirstStartup} max user no: ${this.maxUserNO}`);
|
Log.info(`firstStartupConfig isFirstStartUp = ${this.isFirstStartup} max user no: ${this.maxUserNO} rdbStore: ${this.rdbStore}`);
|
||||||
// 总是创建以下三张表 if not exists
|
// 总是创建以下三张表 if not exists
|
||||||
// 创建公共数据表
|
// 创建公共数据表
|
||||||
await this.rdbStore?.executeSql(SettingsDBHelper.SHARED_TABLE_CREATE_PREFIX +
|
await this.rdbStore?.executeSql(SettingsDBHelper.SHARED_TABLE_CREATE_PREFIX +
|
||||||
|
Loading…
Reference in New Issue
Block a user