提交 213e2d17 编写于 作者: P PaDoBoo

ohos Handling API interface integrity and consistency

Signed-off-by: NPaDoBoo <xuejianwu@huawei.com>
上级 303ce5f5
...@@ -30,7 +30,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number, callback: A ...@@ -30,7 +30,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number, callback: A
- 示例: - 示例:
``` ```
示例一:Stage or FA 模式 //示例一:Stage or FA 模式
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
...@@ -41,7 +41,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number, callback: A ...@@ -41,7 +41,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number, callback: A
console.info('create table done.') console.info('create table done.')
}) })
} }
示例二:FA Only模式 //示例二:FA Only模式
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
const STORE_CONFIG = { name: "RdbTest.db"} const STORE_CONFIG = { name: "RdbTest.db"}
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
...@@ -73,7 +73,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number): Promise&lt ...@@ -73,7 +73,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number): Promise&lt
- 示例: - 示例:
``` ```
示例一:Stage or FA 模式 //示例一:Stage or FA 模式
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
...@@ -91,7 +91,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number): Promise&lt ...@@ -91,7 +91,7 @@ getRdbStore(context?: Context, config: StoreConfig, version: number): Promise&lt
console.log("getRdbStore err.") console.log("getRdbStore err.")
}) })
} }
示例二:FA Only模式 //示例二:FA Only模式
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
const STORE_CONFIG = { name: "RdbTest.db" } const STORE_CONFIG = { name: "RdbTest.db" }
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
...@@ -125,7 +125,7 @@ deleteRdbStore(context?: Context, name: string, callback: AsyncCallback&lt;void& ...@@ -125,7 +125,7 @@ deleteRdbStore(context?: Context, name: string, callback: AsyncCallback&lt;void&
- 示例: - 示例:
``` ```
示例一:Stage or FA 模式 //示例一:Stage or FA 模式
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
...@@ -133,7 +133,7 @@ deleteRdbStore(context?: Context, name: string, callback: AsyncCallback&lt;void& ...@@ -133,7 +133,7 @@ deleteRdbStore(context?: Context, name: string, callback: AsyncCallback&lt;void&
console.info('delete store done.') console.info('delete store done.')
}) })
} }
示例二:FA Only模式 //示例二:FA Only模式
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
data_rdb.deleteRdbStore("RdbTest.db", function (err, rdbStore) { data_rdb.deleteRdbStore("RdbTest.db", function (err, rdbStore) {
console.info('delete store done.') console.info('delete store done.')
...@@ -161,7 +161,7 @@ deleteRdbStore(context?: Context, name: string): Promise&lt;void&gt; ...@@ -161,7 +161,7 @@ deleteRdbStore(context?: Context, name: string): Promise&lt;void&gt;
- 示例: - 示例:
``` ```
示例一:Stage or FA 模式 //示例一:Stage or FA 模式
import Ability from '@ohos.application.Ability' import Ability from '@ohos.application.Ability'
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
export default class MainAbility extends Ability { export default class MainAbility extends Ability {
...@@ -172,7 +172,7 @@ deleteRdbStore(context?: Context, name: string): Promise&lt;void&gt; ...@@ -172,7 +172,7 @@ deleteRdbStore(context?: Context, name: string): Promise&lt;void&gt;
console.log("deleteRdbStore err.") console.log("deleteRdbStore err.")
}) })
} }
示例二:FA Only模式 //示例二:FA Only模式
import data_rdb from '@ohos.data.rdb' import data_rdb from '@ohos.data.rdb'
let promisedeleteRdb = data_rdb.deleteRdbStore("RdbTest.db") let promisedeleteRdb = data_rdb.deleteRdbStore("RdbTest.db")
promisedeleteRdb.then(()=>{ promisedeleteRdb.then(()=>{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册