未验证 提交 e5377d99 编写于 作者: 葛亚芳 提交者: Gitee

zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbi...

zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md:示例代码问题修改,需同步翻译
Signed-off-by: N@ge-yafang <geyafang@huawei.com>
上级 02638666
...@@ -145,6 +145,15 @@ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback&lt;numbe ...@@ -145,6 +145,15 @@ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback&lt;numbe
**示例:** **示例:**
```ts ```ts
import rdb from '@ohos.data.rdb';
let DB_NAME = "DB00.db";
let TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
insert(uri, valueBucket, callback) { insert(uri, valueBucket, callback) {
if (value == null) { if (value == null) {
...@@ -181,6 +190,15 @@ update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueB ...@@ -181,6 +190,15 @@ update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueB
**示例:** **示例:**
```ts ```ts
import rdb from '@ohos.data.rdb';
let DB_NAME = "DB00.db";
let TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
update(uri, predicates, valueBucket, callback) { update(uri, predicates, valueBucket, callback) {
if (predicates == null || predicates == undefined) { if (predicates == null || predicates == undefined) {
...@@ -214,6 +232,15 @@ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callba ...@@ -214,6 +232,15 @@ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callba
**示例:** **示例:**
```ts ```ts
import rdb from '@ohos.data.rdb';
let DB_NAME = "DB00.db";
let TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
delete(uri, predicates, callback) { delete(uri, predicates, callback) {
if (predicates == null || predicates == undefined) { if (predicates == null || predicates == undefined) {
...@@ -248,6 +275,15 @@ query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns ...@@ -248,6 +275,15 @@ query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns
**示例:** **示例:**
```ts ```ts
import rdb from '@ohos.data.rdb';
let DB_NAME = "DB00.db";
let TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
query(uri, predicates, columns, callback) { query(uri, predicates, columns, callback) {
if (predicates == null || predicates == undefined) { if (predicates == null || predicates == undefined) {
...@@ -311,6 +347,15 @@ batchInsert?(uri: string, valueBuckets: Array&lt;ValuesBucket&gt;, callback: Asy ...@@ -311,6 +347,15 @@ batchInsert?(uri: string, valueBuckets: Array&lt;ValuesBucket&gt;, callback: Asy
**示例:** **示例:**
```ts ```ts
import rdb from '@ohos.data.rdb';
let DB_NAME = "DB00.db";
let TBL_NAME = "TBL00";
let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
+ TBL_NAME
+ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility { export default class DataShareExtAbility extends DataShareExtensionAbility {
batchInsert(uri, valueBuckets, callback) { batchInsert(uri, valueBuckets, callback) {
if (valueBuckets == null || valueBuckets.length == undefined) { if (valueBuckets == null || valueBuckets.length == undefined) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册