Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
381508e2
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看板
未验证
提交
381508e2
编写于
8月 26, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 26, 2023
浏览文件
操作
浏览文件
下载
差异文件
!22990 8.25 arkts warning
Merge pull request !22990 from maruiqazqaz/master
上级
46b2299b
a1513029
变更
2
展开全部
隐藏空白更改
内联
并排
Showing
2 changed file
with
503 addition
and
410 deletion
+503
-410
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
+58
-52
zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
...cation-dev/reference/apis/js-apis-data-relationalStore.md
+445
-358
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-data-rdb.md
浏览文件 @
381508e2
...
...
@@ -18,6 +18,8 @@
```
js
import
data_rdb
from
'
@ohos.data.rdb
'
;
import
{
BusinessError
}
from
"
@ohos.base
"
import
window
from
'
@ohos.window
'
;
```
## data_rdb.getRdbStore
...
...
@@ -43,11 +45,11 @@ FA模型示例:
```
js
// 获取context
import
featureAbility
from
'
@ohos.ability.featureAbility
'
let
context
=
featureAbility
.
getContext
()
let
context
:
Context
;
// 获取context后调用getRdbStore
const
STORE_CONFIG
=
{
name
:
"
RdbTest.db
"
}
data_rdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
,
function
(
err
,
rdbStore
)
{
data_rdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
,
(
err
,
rdbStore
)
=>
{
if
(
err
)
{
console
.
info
(
"
Get RdbStore failed, err:
"
+
err
)
return
...
...
@@ -62,22 +64,23 @@ Stage模型示例:
// 获取context
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
let
context
;
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
windowStage
){
context
=
this
.
context
}
let
context
:
Context
;
interface
storeConfig
{
name
:
string
}
// 获取context后调用getRdbStore
const
STORE_CONFIG
=
{
name
:
"
RdbTest.db
"
}
data_rdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
,
function
(
err
,
rdbStore
)
{
if
(
err
)
{
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
){
let
STORE_CONFIG
:
storeConfig
=
{
name
:
"
RdbTest.db
"
};
data_rdb
.
getRdbStore
(
this
.
context
,
STORE_CONFIG
,
1
,
(
err
:
BusinessError
,
rdbStore
:
data_rdb
.
RdbStore
)
=>
{
if
(
err
)
{
console
.
info
(
"
Get RdbStore failed, err:
"
+
err
)
return
}
console
.
log
(
"
Get RdbStore successfully.
"
)
})
}
console
.
log
(
"
Get RdbStore successfully.
"
)
})
}
}
```
## data_rdb.getRdbStore
...
...
@@ -109,7 +112,7 @@ FA模型示例:
```
js
// 获取context
import
featureAbility
from
'
@ohos.ability.featureAbility
'
let
context
=
featureAbility
.
getContext
()
let
context
:
Context
;
// 获取context后调用getRdbStore
const
STORE_CONFIG
=
{
name
:
"
RdbTest.db
"
}
...
...
@@ -127,20 +130,23 @@ Stage模型示例:
// 获取context
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
let
context
;
let
context
:
Context
;
interface
storeConfig
{
name
:
string
}
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
w
indowStage
){
context
=
this
.
context
}
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
){
context
=
this
.
context
}
}
// 获取context后调用getRdbStore
const
STORE_CONFIG
=
{
name
:
"
RdbTest.db
"
}
let
STORE_CONFIG
:
storeConfig
=
{
name
:
"
RdbTest.db
"
};
let
promise
=
data_rdb
.
getRdbStore
(
context
,
STORE_CONFIG
,
1
);
promise
.
then
(
async
(
rdbStore
)
=>
{
console
.
log
(
"
Get RdbStore successfully.
"
)
}).
catch
((
err
)
=>
{
console
.
log
(
"
Get RdbStore failed, err:
"
+
err
)
promise
.
then
(
async
(
rdbStore
:
data_rdb
.
RdbStore
)
=>
{
console
.
log
(
"
Get RdbStore successfully.
"
)
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
log
(
"
Get RdbStore failed, err:
"
+
err
)
})
```
...
...
@@ -167,15 +173,15 @@ FA模型示例:
```
js
// 获取context
import
featureAbility
from
'
@ohos.ability.featureAbility
'
let
context
=
featureAbility
.
getContext
()
let
context
:
Context
;
// 获取context后调用deleteRdbStore
data_rdb
.
deleteRdbStore
(
context
,
"
RdbTest.db
"
,
function
(
err
)
{
if
(
err
)
{
console
.
info
(
"
Delete RdbStore failed, err:
"
+
err
)
return
}
console
.
log
(
"
Delete RdbStore successfully.
"
)
data_rdb
.
deleteRdbStore
(
context
,
"
RdbTest.db
"
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
Delete RdbStore failed, err:
"
+
err
)
return
}
console
.
log
(
"
Delete RdbStore successfully.
"
)
})
```
...
...
@@ -185,20 +191,20 @@ Stage模型示例:
// 获取context
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
let
context
;
let
context
:
Context
;
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
w
indowStage
){
context
=
this
.
context
}
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
){
context
=
this
.
context
}
}
// 获取context后调用deleteRdbStore
data_rdb
.
deleteRdbStore
(
context
,
"
RdbTest.db
"
,
function
(
err
)
{
if
(
err
)
{
console
.
info
(
"
Delete RdbStore failed, err:
"
+
err
)
return
}
console
.
log
(
"
Delete RdbStore successfully.
"
)
data_rdb
.
deleteRdbStore
(
context
,
"
RdbTest.db
"
,
(
err
)
=>
{
if
(
err
)
{
console
.
info
(
"
Delete RdbStore failed, err:
"
+
err
)
return
}
console
.
log
(
"
Delete RdbStore successfully.
"
)
})
```
...
...
@@ -230,7 +236,7 @@ FA模型示例:
```
js
// 获取context
import
featureAbility
from
'
@ohos.ability.featureAbility
'
let
context
=
featureAbility
.
getContext
()
let
context
:
Context
;
// 获取context后调用deleteRdbStore
let
promise
=
data_rdb
.
deleteRdbStore
(
context
,
"
RdbTest.db
"
)
...
...
@@ -247,19 +253,19 @@ Stage模型示例:
// 获取context
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
let
context
;
let
context
:
Context
;
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
w
indowStage
){
context
=
this
.
context
}
onWindowStageCreate
(
windowStage
:
window
.
W
indowStage
){
context
=
this
.
context
}
}
// 获取context后调用deleteRdbStore
let
promise
=
data_rdb
.
deleteRdbStore
(
context
,
"
RdbTest.db
"
)
promise
.
then
(()
=>
{
console
.
log
(
"
Delete RdbStore successfully.
"
)
}).
catch
((
err
)
=>
{
console
.
info
(
"
Delete RdbStore failed, err:
"
+
err
)
console
.
log
(
"
Delete RdbStore successfully.
"
)
}).
catch
((
err
:
BusinessError
)
=>
{
console
.
info
(
"
Delete RdbStore failed, err:
"
+
err
)
})
```
...
...
@@ -371,8 +377,8 @@ inDevices(devices: Array<string>): RdbPredicates
```
js
import
deviceManager
from
'
@ohos.distributedHardware.deviceManager
'
;
let
dmInstance
=
null
;
let
deviceIds
=
[];
let
dmInstance
:
deviceManager
.
DeviceManager
=
null
;
let
deviceIds
:
Array
<
string
>
=
[];
deviceManager
.
createDeviceManager
(
"
com.example.appdatamgrverify
"
,
(
err
,
manager
)
=>
{
if
(
err
)
{
...
...
@@ -381,7 +387,7 @@ deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager)
}
dmInstance
=
manager
;
let
devices
=
dmInstance
.
getTrustedDeviceListSync
();
for
(
var
i
=
0
;
i
<
devices
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
devices
.
length
;
i
++
)
{
deviceIds
[
i
]
=
devices
[
i
].
deviceId
;
}
})
...
...
zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
浏览文件 @
381508e2
此差异已折叠。
点击以展开。
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录