Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
2433310d
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
2433310d
编写于
11月 29, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 29, 2022
浏览文件
操作
浏览文件
下载
差异文件
!11914 [翻译完成】#I5ZV59
Merge pull request !11914 from Annie_wang/PR11268
上级
7b3f1d5a
50ea0c4a
变更
5
展开全部
显示空白变更内容
内联
并排
Showing
5 changed file
with
1177 addition
and
357 deletion
+1177
-357
en/application-dev/reference/apis/js-apis-data-preferences.md
...pplication-dev/reference/apis/js-apis-data-preferences.md
+356
-229
en/application-dev/reference/apis/js-apis-data-resultset.md
en/application-dev/reference/apis/js-apis-data-resultset.md
+689
-96
en/application-dev/reference/apis/js-apis-data-storage.md
en/application-dev/reference/apis/js-apis-data-storage.md
+32
-32
en/application-dev/reference/errorcodes/errorcode-data-rdb.md
...pplication-dev/reference/errorcodes/errorcode-data-rdb.md
+79
-0
en/application-dev/reference/errorcodes/errorcode-preferences.md
...ication-dev/reference/errorcodes/errorcode-preferences.md
+21
-0
未找到文件。
en/application-dev/reference/apis/js-apis-data-preferences.md
浏览文件 @
2433310d
此差异已折叠。
点击以展开。
en/application-dev/reference/apis/js-apis-data-resultset.md
浏览文件 @
2433310d
此差异已折叠。
点击以展开。
en/application-dev/reference/apis/js-apis-data-storage.md
浏览文件 @
2433310d
...
...
@@ -22,10 +22,10 @@ import data_storage from '@ohos.data.storage';
**System capability**
: SystemCapability.DistributedDataManager.Preferences.Core
| Name
| Type | Readable | Writable | Description
|
| ---------------- | ------
| -------- | -------- | ----------------------
------------------------------------- |
| MAX_KEY_LENGTH |
string | Yes | No | Maximum length of a key. It must be less than 80 bytes.
|
| MAX_VALUE_LENGTH |
string | Yes | No | Maximum length of a value. It must be less than 8192 bytes.
|
| Name
| Type| Readable| Writable| Description
|
| ---------------- | ------
-- | ---- | ---- |
------------------------------------- |
| MAX_KEY_LENGTH |
number | Yes | No | Maximum length of a key. It must be less than 80 bytes.
|
| MAX_VALUE_LENGTH |
number | Yes | No | Maximum length of a value. It must be less than 8192 bytes.
|
## data_storage.getStorageSync
...
...
@@ -53,8 +53,8 @@ Reads the specified file and loads its data to the **Storage** instance for data
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -86,8 +86,8 @@ Reads the specified file and loads its data to the **Storage** instance for data
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -129,8 +129,8 @@ Reads the specified file and loads its data to the **Storage** instance for data
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -165,8 +165,8 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -195,8 +195,8 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -237,8 +237,8 @@ Deletes the singleton **Storage** instance of a file from the memory, and delete
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -271,8 +271,8 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -302,8 +302,8 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -344,8 +344,8 @@ Removes the singleton **Storage** instance of a file from the cache. The removed
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
var
path
;
var
context
=
featureAbility
.
getContext
();
let
path
;
let
context
=
featureAbility
.
getContext
();
context
.
getFilesDir
().
then
((
filePath
)
=>
{
path
=
filePath
;
console
.
info
(
"
======================>getFilesDirPromise====================>
"
);
...
...
@@ -864,15 +864,15 @@ Subscribes to data changes. The **StorageObserver** needs to be implemented. Whe
**Parameters**
| Name | Type | Description |
| -------- | --------------------------------------------------- | ---------------------------------------- |
| type | string | Event type. The value
**change**
indicates data change events.|
| callback | Callback
<
[StorageObserver](#storageobserver)
>
| Callback used to return data changes. |
| Name | Type |
Mandatory|
Description |
| -------- | --------------------------------------------------- | ------
|------
---------------------------------- |
| type | string |
Yes|
Event type. The value
**change**
indicates data change events.|
| callback | Callback
<
[StorageObserver](#storageobserver)
>
|
Yes|
Callback used to return data changes. |
**Example**
```
js
var
observer
=
function
(
key
)
{
let
observer
=
function
(
key
)
{
console
.
info
(
"
The key of
"
+
key
+
"
changed.
"
);
}
storage
.
on
(
'
change
'
,
observer
);
...
...
@@ -891,15 +891,15 @@ Unsubscribes from data changes.
**Parameters**
| Name | Type |
Description
|
| -------- | --------------------------------------------------- | ---------------------------------------- |
| type | string | Event type. The value
**change**
indicates data change events.|
| callback | Callback
<
[StorageObserver](#storageobserver)
>
| Callback used to return data changes. |
| Name | Type |
Mandatory| Description
|
| -------- | --------------------------------------------------- | ------
|------
---------------------------------- |
| type | string |
Yes|
Event type. The value
**change**
indicates data change events.|
| callback | Callback
<
[StorageObserver](#storageobserver)
>
|
Yes|
Callback used to return data changes. |
**Example**
```
js
var
observer
=
function
(
key
)
{
let
observer
=
function
(
key
)
{
console
.
info
(
"
The key of
"
+
key
+
"
changed.
"
);
}
storage
.
off
(
'
change
'
,
observer
);
...
...
en/application-dev/reference/errorcodes/errorcode-data-rdb.md
0 → 100644
浏览文件 @
2433310d
# RDB Error Codes
## 14800010 Invalid RDB Name
**Error Message**
Invalid database name.
**Description**
The RDB store name is invalid.
**Possible Causes**
The RDB store name is empty or exceeds 1024 bytes.
**Solution**
Check that the RDB store name is not empty and does not exceed 1024 bytes.
## 14800011 Database File Corrupted
**Error Message**
Database corrupted.
**Description**
The RDB store is corrupted when an API for adding, deleting, querying, or synchronizing data is invoked.
**Possible Causes**
The RDB store file has been corrupted.
**Solution**
1.
Restore the RDB store using the backup file.
2.
If no RDB backup file is available, delete the RDB store and create it again.
## 14800012 Empty Result Set or Invalid Position
**Error Message**
The result set is empty or the specified location is invalid.
**Description**
The result set is empty or the specified location is invalid.
**Possible Causes**
The result set is empty, or the specified row number in the result set is out of range [0, m - 1].
**m**
is
**resultsetV9.rowCount**
.
**Solution**
Check whether the result set is empty or whether the specified row number is out of range.
## 14800013 Null Column Value or Column Data Type Incompatible With the API Called
**Error Message**
The column value is null or the column type is incompatible.
**Description**
The column value is null, or the column data type is incompatible with the API called.
**Possible Causes**
1.
The result set is empty.
2.
The current row number in the result set is out of range [0, m - 1].
**m**
is
**resultsetV9.rowCount**
.
3.
The column number is out of the range [0, n - 1].
**n**
is
**resultsetV9.columnCount**
.
4.
The API called does not support the type of the column data.
**Solution**
1.
Check whether the result set is empty.
2.
Check whether the row number and column number of the result set are out of range.
3.
Check whether the column data type is supported.
en/application-dev/reference/errorcodes/errorcode-preferences.md
0 → 100644
浏览文件 @
2433310d
# Preferences Error Codes
## 15500010 Failed to Delete Preferences
**Error Message**
Failed to delete preferences.
**Description**
Failed to delete the preference.
**Possible Causes**
The possible causes are as follows:
1.
The file name is incorrect.
2.
The file path is incorrect.
**Solution**
1.
Check that the file name is correct.
2.
Check that the file path is correct.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录