From e5377d99e9c723372f6366afe691213bf5c6006e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=91=9B=E4=BA=9A=E8=8A=B3?= Date: Fri, 22 Jul 2022 03:05:37 +0000 Subject: [PATCH] =?UTF-8?q?zh-cn/application-dev/reference/apis/js-apis-ap?= =?UTF-8?q?plication-DataShareExtensionAbility.md=EF=BC=9A=E7=A4=BA?= =?UTF-8?q?=E4=BE=8B=E4=BB=A3=E7=A0=81=E9=97=AE=E9=A2=98=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=EF=BC=8C=E9=9C=80=E5=90=8C=E6=AD=A5=E7=BF=BB=E8=AF=91=20Signed?= =?UTF-8?q?-off-by:=20@ge-yafang=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s-application-DataShareExtensionAbility.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md index 886f1363ec..2570b834f9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md @@ -145,6 +145,15 @@ insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback<numbe **示例:** ```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 { insert(uri, valueBucket, callback) { if (value == null) { @@ -181,6 +190,15 @@ update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueB **示例:** ```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 { update(uri, predicates, valueBucket, callback) { if (predicates == null || predicates == undefined) { @@ -214,6 +232,15 @@ delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callba **示例:** ```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 { delete(uri, predicates, callback) { if (predicates == null || predicates == undefined) { @@ -248,6 +275,15 @@ query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns **示例:** ```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 { query(uri, predicates, columns, callback) { if (predicates == null || predicates == undefined) { @@ -311,6 +347,15 @@ batchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: Asy **示例:** ```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 { batchInsert(uri, valueBuckets, callback) { if (valueBuckets == null || valueBuckets.length == undefined) { -- GitLab