diff --git a/README_EN.md b/README_EN.md new file mode 100644 index 0000000000000000000000000000000000000000..34ca24335a0b18782bb54b325c76fafa93031f09 --- /dev/null +++ b/README_EN.md @@ -0,0 +1,68 @@ +# Database Update + +### Overview + +This sample shows how to perform operations on a relational database (RDB) store, including adding, deleting, modifying, and querying data and performing database transactions. + +For details, see RDB store. + + +### Preview +![image](screenshots/device/DataBaseUpgrade_en.gif) + +### How to Use + +1. Tap the drop-down list box, select an option, and enter the field to add. +2. Tap **Update**. The progress bar is displayed. If you tap the cross (x) icon before the progress bar reaches 100%, a transaction rollback is performed. As a result, the user information is not updated. +3. Tap **Update**. The progress bar is displayed. If the progress bar reaches 100%, the transaction is committed and the user information and the backup RDB store are updated. + +4. Tap **Roll back**. The RDB store will be rolled back to the previous version. + + You may need to roll back an RDB store when an error occurs during database execution. The RDB store can be rolled back to its previous version only. If the RDB store is updated, you can roll back to the latest version. + + + +### Project Directory +``` +├──entry/src/main/ets/ +│ ├──common +│ │ ├──constants +│ │ │ └──CommonConstants.ets // Common constants +│ │ └──utils +│ │ ├──CommonUtils.ets // Utility for displaying pop-up dialogs +│ │ ├──DBUtils.ets // Utility for database operations +│ │ └──Logger.ets // Logging utility +│ ├──entryability +│ │ └──EntryAbility.ets // Entry ability +│ ├──pages +│ │ └──Index.ets // Home page +│ ├──view +│ │ └──ProgressDialog.ets // Implementation of the progress bar. +│ └──viewmodel +│ └──userInfo.ets // Class holding user information +└──entry/src/main/resources // Static resources of the app +``` +### How to Implement + +* The functionalities in this sample are based on the RDB store. +* The operation of adding field values is implemented based on **executeSql**. +* The transaction operations are implemented by **commit()** and **rollback()**. +* Version rollback is implemented based on RDB backup and restore. When the version is updated, the database is backed up. When the version is rolled back, the database is restored. + +### Required Permissions + +N/A + +### Dependencies + +N/A + +### Constraints + +1. The sample app is supported only on Huawei phones running the standard system. + +2. The HarmonyOS version must be HarmonyOS NEXT Developer Beta1 or later. + +3. The DevEco Studio version must be DevEco Studio NEXT Developer Beta1 or later. + +4. The HarmonyOS SDK version must be HarmonyOS NEXT Developer Beta1 SDK or later. diff --git a/entry/src/main/resources/base/element/string.json b/entry/src/main/resources/base/element/string.json index 623d7d074276846633d3be3a16411b02763c14e0..651a4dc29e9ef85734b10c04aa7939df70ea82d5 100644 --- a/entry/src/main/resources/base/element/string.json +++ b/entry/src/main/resources/base/element/string.json @@ -22,11 +22,11 @@ }, { "name": "input_field", - "value": "Please select the name of the field you want to add." + "value": "Select the field to add." }, { "name": "field_value", - "value": "field value" + "value": "Field value" }, { "name": "username", @@ -34,23 +34,23 @@ }, { "name": "account", - "value": "account" + "value": "Account" }, { "name": "nickname", - "value": "nickname" + "value": "Nickname" }, { "name": "age", - "value": "age" + "value": "Age" }, { "name": "version_update", - "value": "version update" + "value": "Update" }, { "name": "version_rollback", - "value": "version rollback" + "value": "Roll back" }, { "name": "rollback_failed", @@ -62,7 +62,7 @@ }, { "name": "user_info", - "value": "User information display" + "value": "User info" }, { "name": "updating", diff --git a/entry/src/main/resources/en_US/element/string.json b/entry/src/main/resources/en_US/element/string.json index 0dd6369d6c1763cac30972d0acb07dc00af8bbd5..651a4dc29e9ef85734b10c04aa7939df70ea82d5 100644 --- a/entry/src/main/resources/en_US/element/string.json +++ b/entry/src/main/resources/en_US/element/string.json @@ -22,11 +22,11 @@ }, { "name": "input_field", - "value": "Please select the name of the field you want to add." + "value": "Select the field to add." }, { "name": "field_value", - "value": "field value" + "value": "Field value" }, { "name": "username", @@ -34,22 +34,23 @@ }, { "name": "account", - "value": "account" + "value": "Account" }, { "name": "nickname", - "value": "nickname" - },{ + "value": "Nickname" + }, + { "name": "age", - "value": "age" + "value": "Age" }, { "name": "version_update", - "value": "version update" + "value": "Update" }, { "name": "version_rollback", - "value": "version rollback" + "value": "Roll back" }, { "name": "rollback_failed", @@ -61,7 +62,7 @@ }, { "name": "user_info", - "value": "User information display" + "value": "User info" }, { "name": "updating", diff --git a/screenshots/device/DataBaseUpgrade_en.gif b/screenshots/device/DataBaseUpgrade_en.gif new file mode 100644 index 0000000000000000000000000000000000000000..4e2319bf322bce0df21efa72278de0f441afc452 Binary files /dev/null and b/screenshots/device/DataBaseUpgrade_en.gif differ