Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
821a40ac
D
Docs
项目概览
OpenHarmony
/
Docs
1 年多 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
821a40ac
编写于
6月 19, 2023
作者:
S
srr101
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
资料格式修改挑单至3.2release
Signed-off-by:
N
srr101
<
songruirui1@huawei.com
>
上级
ba68cfde
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
32 addition
and
34 deletion
+32
-34
zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
...nce/apis/js-apis-application-dataShareExtensionAbility.md
+10
-12
zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md
...ion-dev/reference/apis/js-apis-data-DataShareResultSet.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md
.../application-dev/reference/apis/js-apis-data-dataShare.md
+19
-19
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
浏览文件 @
821a40ac
...
...
@@ -78,10 +78,10 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
name
:
DB_NAME
,
securityLevel
:
rdb
.
SecurityLevel
.
S1
},
function
(
err
,
data
)
{
console
.
log
(
'
getRdbStore done, data :
'
+
data
);
console
.
info
(
`getRdbStore done, data :
${
data
}
`
);
rdbStore
=
data
;
rdbStore
.
executeSql
(
DDL_TBL_CREATE
,
[],
function
(
err
)
{
console
.
log
(
'
executeSql done, error message :
'
+
err
);
console
.
error
(
`executeSql done, error message :
${
err
}
`
);
});
if
(
callback
)
{
callback
();
...
...
@@ -122,11 +122,11 @@ let rdbStore;
export
default
class
DataShareExtAbility
extends
DataShareExtensionAbility
{
insert
(
uri
,
valueBucket
,
callback
)
{
if
(
valueBucket
===
null
)
{
console
.
info
(
'
invalid valueBuckets
'
);
console
.
error
(
'
invalid valueBuckets
'
);
return
;
}
rdbStore
.
insert
(
TBL_NAME
,
valueBucket
,
function
(
err
,
ret
)
{
console
.
info
(
'
callback ret:
'
+
ret
);
console
.
info
(
`callback ret:
${
ret
}
`
);
if
(
callback
!==
undefined
)
{
callback
(
err
,
ret
);
}
...
...
@@ -256,7 +256,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
}
rdbStore
.
query
(
TBL_NAME
,
predicates
,
columns
,
function
(
err
,
resultSet
)
{
if
(
resultSet
!==
undefined
)
{
console
.
info
(
'
resultSet.rowCount:
'
+
resultSet
.
rowCount
);
console
.
info
(
`resultSet.rowCount:
${
resultSet
.
rowCount
}
`
);
}
if
(
callback
!==
undefined
)
{
callback
(
err
,
resultSet
);
...
...
@@ -297,14 +297,12 @@ let rdbStore;
export
default
class
DataShareExtAbility
extends
DataShareExtensionAbility
{
batchInsert
(
uri
,
valueBuckets
,
callback
)
{
if
(
valueBuckets
===
null
||
valueBuckets
.
length
===
undefined
)
{
console
.
info
(
'
invalid valueBuckets
'
);
console
.
error
(
'
invalid valueBuckets
'
);
return
;
}
let
resultNum
=
valueBuckets
.
length
;
valueBuckets
.
forEach
(
vb
=>
{
rdbStore
.
insert
(
TBL_NAME
,
vb
,
function
(
err
,
ret
)
{
rdbStore
.
batchInsert
(
TBL_NAME
,
valueBuckets
,
function
(
err
,
ret
)
{
if
(
callback
!==
undefined
)
{
callback
(
err
,
re
sultNum
);
callback
(
err
,
re
t
);
}
});
});
...
...
@@ -333,7 +331,7 @@ normalizeUri?(uri: string, callback: AsyncCallback<string>): void
export
default
class
DataShareExtAbility
extends
DataShareExtensionAbility
{
normalizeUri
(
uri
,
callback
)
{
let
err
=
{
'
code
'
:
0
};
let
ret
=
'
normalize+
'
+
uri
;
let
ret
=
`normalize:
${
uri
}
`
;
callback
(
err
,
ret
);
}
};
...
...
@@ -360,7 +358,7 @@ denormalizeUri?(uri: string, callback: AsyncCallback<string>): void
export
default
class
DataShareExtAbility
extends
DataShareExtensionAbility
{
denormalizeUri
(
uri
,
callback
)
{
let
err
=
{
'
code
'
:
0
};
let
ret
=
'
denormalize+
'
+
uri
;
let
ret
=
`denormalize
${
uri
}
`
;
callback
(
err
,
ret
);
}
};
...
...
zh-cn/application-dev/reference/apis/js-apis-data-DataShareResultSet.md
浏览文件 @
821a40ac
...
...
@@ -27,7 +27,7 @@ let dataShareHelper;
let
uri
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
await
dataShare
.
createDataShareHelper
(
this
.
context
,
uri
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
console
.
info
(
"
createDataShareHelper fail, error message :
"
+
err
);
console
.
error
(
"
createDataShareHelper fail, error message :
"
+
err
);
}
else
{
console
.
info
(
"
createDataShareHelper end, data :
"
+
data
);
dataShareHelper
=
data
;
...
...
@@ -39,10 +39,10 @@ let da = new dataSharePredicates.DataSharePredicates();
let
resultSet
;
da
.
equalTo
(
"
name
"
,
"
ZhangSan
"
);
dataShareHelper
.
query
(
uri
,
da
,
columns
).
then
((
data
)
=>
{
console
.
log
(
"
query end, data :
"
+
data
);
console
.
info
(
"
query end, data :
"
+
data
);
resultSet
=
data
;
}).
catch
((
err
)
=>
{
console
.
log
(
"
query fail, error message :
"
+
err
);
console
.
error
(
"
query fail, error message :
"
+
err
);
});
```
...
...
zh-cn/application-dev/reference/apis/js-apis-data-dataShare.md
浏览文件 @
821a40ac
...
...
@@ -70,7 +70,7 @@ let uri = ("datashare:///com.samples.datasharetest.DataShare");
let
dataShareHelper
;
try
{
dataShare
.
createDataShareHelper
(
this
.
context
,
uri
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
if
(
err
!=
=
undefined
)
{
console
.
error
(
`createDataShareHelper error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
...
...
@@ -422,7 +422,7 @@ let da = new dataSharePredicates.DataSharePredicates();
da
.
equalTo
(
"
name
"
,
"
ZhangSan
"
);
try
{
dataShareHelper
.
query
(
uri
,
da
,
columns
).
then
((
data
)
=>
{
console
.
log
(
"
query succeed, rowCount :
"
+
data
.
rowCount
);
console
.
info
(
"
query succeed, rowCount :
"
+
data
.
rowCount
);
}).
catch
((
err
)
=>
{
console
.
error
(
`query error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -465,11 +465,11 @@ const va = {
}
try
{
dataShareHelper
.
update
(
uri
,
da
,
va
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
if
(
err
!=
=
undefined
)
{
console
.
error
(
`update error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
log
(
"
update succeed, data :
"
+
data
);
console
.
info
(
"
update succeed, data :
"
+
data
);
});
}
catch
(
err
)
{
console
.
error
(
`update error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
...
...
@@ -515,7 +515,7 @@ const va = {
}
try
{
dataShareHelper
.
update
(
uri
,
da
,
va
).
then
((
data
)
=>
{
console
.
log
(
"
update succeed, data :
"
+
data
);
console
.
info
(
"
update succeed, data :
"
+
data
);
}).
catch
((
err
)
=>
{
console
.
error
(
`update error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -550,11 +550,11 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,})
try
{
dataShareHelper
.
batchInsert
(
uri
,
vbs
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
if
(
err
!=
=
undefined
)
{
console
.
error
(
`batchInsert error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
return
;
}
console
.
log
(
"
batchInsert succeed, data :
"
+
data
);
console
.
info
(
"
batchInsert succeed, data :
"
+
data
);
});
}
catch
(
err
)
{
console
.
error
(
`batchInsert error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
...
...
@@ -592,7 +592,7 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,})
try
{
dataShareHelper
.
batchInsert
(
uri
,
vbs
).
then
((
data
)
=>
{
console
.
log
(
"
batchInsert succeed, data :
"
+
data
);
console
.
info
(
"
batchInsert succeed, data :
"
+
data
);
}).
catch
((
err
)
=>
{
console
.
error
(
`batchInsert error: code:
${
err
.
code
}
, message:
${
err
.
message
}
`
);
});
...
...
@@ -622,10 +622,10 @@ normalizeUri(uri: string, callback: AsyncCallback<string>): void
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
let
uri
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
dataShareHelper
.
normalizeUri
(
uri
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
console
.
log
(
"
normalizeUri failed, error message :
"
+
err
);
if
(
err
!=
=
undefined
)
{
console
.
info
(
"
normalizeUri failed, error message :
"
+
err
);
}
else
{
console
.
log
(
"
normalizeUri =
"
+
data
);
console
.
info
(
"
normalizeUri =
"
+
data
);
}
});
```
...
...
@@ -656,9 +656,9 @@ normalizeUri(uri: string): Promise<string>
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
let
uri
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
dataShareHelper
.
normalizeUri
(
uri
).
then
((
data
)
=>
{
console
.
log
(
"
normalizeUri =
"
+
data
);
console
.
info
(
"
normalizeUri =
"
+
data
);
}).
catch
((
err
)
=>
{
console
.
log
(
"
normalizeUri failed, error message :
"
+
err
);
console
.
info
(
"
normalizeUri failed, error message :
"
+
err
);
});
```
...
...
@@ -683,10 +683,10 @@ denormalizeUri(uri: string, callback: AsyncCallback<string>): void
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
let
uri
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
dataShareHelper
.
denormalizeUri
(
uri
,
(
err
,
data
)
=>
{
if
(
err
!=
undefined
)
{
console
.
log
(
"
denormalizeUri failed, error message :
"
+
err
);
if
(
err
!=
=
undefined
)
{
console
.
error
(
"
denormalizeUri failed, error message :
"
+
err
);
}
else
{
console
.
log
(
"
denormalizeUri =
"
+
data
);
console
.
info
(
"
denormalizeUri =
"
+
data
);
}
});
```
...
...
@@ -717,9 +717,9 @@ denormalizeUri(uri: string): Promise<string>
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
let
uri
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
dataShareHelper
.
denormalizeUri
(
uri
).
then
((
data
)
=>
{
console
.
log
(
"
denormalizeUri =
"
+
data
);
console
.
info
(
"
denormalizeUri =
"
+
data
);
}).
catch
((
err
)
=>
{
console
.
log
(
"
denormalizeUri failed, error message :
"
+
err
);
console
.
error
(
"
denormalizeUri failed, error message :
"
+
err
);
});
```
...
...
@@ -744,7 +744,7 @@ notifyChange(uri: string, callback: AsyncCallback<void>): void
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
let
uri
=
(
"
datashare:///com.samples.datasharetest.DataShare
"
);
dataShareHelper
.
notifyChange
(
uri
,
()
=>
{
console
.
log
(
"
***** notifyChange *****
"
);
console
.
info
(
"
***** notifyChange *****
"
);
});
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录