Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
9742c8f8
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
提交
9742c8f8
编写于
1月 03, 2023
作者:
P
PaDaBoo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update guidelines relationalStore errorcode
Signed-off-by:
N
PaDaBoo
<
xuejianwu@huawei.com
>
上级
3d4203fa
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
14 addition
and
47 deletion
+14
-47
zh-cn/application-dev/database/database-relational-guidelines.md
...pplication-dev/database/database-relational-guidelines.md
+8
-9
zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
...cation-dev/reference/apis/js-apis-data-relationalStore.md
+6
-38
未找到文件。
zh-cn/application-dev/database/database-relational-guidelines.md
浏览文件 @
9742c8f8
...
@@ -17,8 +17,8 @@
...
@@ -17,8 +17,8 @@
| 接口名 | 描述 |
| 接口名 | 描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| ------------------------------------------------------------ | ------------------------------------------------------------ |
| getRdbStore(context: Context, config: StoreConfig): Promise
<
RdbStore
>
| 获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用Promise异步回调。
<br/>
-context:应用
程序或功能的
上下文。
<br/>
-config:与此RDB存储相关的数据库配置。 |
| getRdbStore(context: Context, config: StoreConfig): Promise
<
RdbStore
>
| 获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用Promise异步回调。
<br/>
-context:应用上下文。
<br/>
-config:与此RDB存储相关的数据库配置。 |
| deleteRdbStore(context: Context, name: string): Promise
<
void
>
| 使用指定的数据库文件配置删除数据库,使用Promise异步回调。
<br/>
-context:应用
程序或功能的
上下文。
<br/>
-name:数据库名称。 |
| deleteRdbStore(context: Context, name: string): Promise
<
void
>
| 使用指定的数据库文件配置删除数据库,使用Promise异步回调。
<br/>
-context:应用上下文。
<br/>
-name:数据库名称。 |
### 数据库的增删改查
### 数据库的增删改查
...
@@ -64,14 +64,13 @@
...
@@ -64,14 +64,13 @@
-
直接调用查询接口。使用该接口,会将包含查询条件的谓词自动拼接成完整的SQL语句进行查询操作,无需用户传入原生的SQL语句。
-
直接调用查询接口。使用该接口,会将包含查询条件的谓词自动拼接成完整的SQL语句进行查询操作,无需用户传入原生的SQL语句。
-
执行原生的SQL语句进行查询操作。
-
执行原生的SQL语句进行查询操作。
**表5**
数据库查询API
**表5**
数据库查询API
| 类名 | 接口名 | 描述 |
| 类名 | 接口名 | 描述 |
| ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| ---------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
| RdbStore | query(predicates: RdbPredicates, columns?: Array
<
string
>
): Promise
<
ResultSet
>
| 根据指定条件查询数据库中的数据,使用Promise异步回调。
<br/>
-predicates:表示RdbPredicates的实例对象指定的查询条件。
<br/>
-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
| RdbStore | query(predicates: RdbPredicates, columns?: Array
<
string
>
): Promise
<
ResultSet
>
| 根据指定条件查询数据库中的数据,使用Promise异步回调。
<br/>
-predicates:表示RdbPredicates的实例对象指定的查询条件。
<br/>
-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
| RdbStore | querySql(sql: string, bindArgs?: Array
<
ValueType
>
): Promise
<
ResultSet
>
| 根据指定SQL语句查询数据库中的数据,使用Promise异步回调。
<br/>
-sql:指定要查询的SQL语句。
<br/>
-bindArgs:SQL语句中参数的值。 |
| RdbStore | querySql(sql: string, bindArgs?: Array
<
ValueType
>
): Promise
<
ResultSet
>
| 根据指定SQL语句查询数据库中的数据,使用Promise异步回调。
<br/>
-sql:指定要查询的SQL语句。
<br/>
-bindArgs:SQL语句中参数的值。 |
| RdbStore | remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array
<
string
>
): Promise
<
ResultSet
>
| 根据指定条件查询指定远程设备数据库中的数据。使用Promise异步回调。
<br/>
-device:指定远程查询的设备networkId。
<br/>
-table:指定远程查询的表名。
<br/>
-predicates:表示RdbPredicates的实例对象,指定查询的条件。
<br/>
-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
| RdbStore | remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array
<
string
>
): Promise
<
ResultSet
>
| 根据指定条件查询指定远程设备数据库中的数据。使用Promise异步回调。
<br/>
-device:指定远程查询的设备networkId。
<br/>
-table:指定远程查询的表名。
<br/>
-predicates:表示RdbPredicates的实例对象,指定查询的条件。
<br/>
-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
### 数据库谓词的使用
### 数据库谓词的使用
...
...
zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
浏览文件 @
9742c8f8
...
@@ -41,7 +41,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<Rd
...
@@ -41,7 +41,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<Rd
|
**错误码ID**
|
**错误信息**
|
|
**错误码ID**
|
**错误信息**
|
| ------------ | ----------------------- |
| ------------ | ----------------------- |
| 14800010 | If failed delete database by invalid database name. |
| 14800010 | If failed delete database by invalid database name. |
| 14800011 |
D
atabase corrupted. |
| 14800011 |
If failed open database by d
atabase corrupted. |
**示例:**
**示例:**
...
@@ -134,7 +134,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>
...
@@ -134,7 +134,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>
|
**错误码ID**
|
**错误信息**
|
|
**错误码ID**
|
**错误信息**
|
| ------------ | ----------------------- |
| ------------ | ----------------------- |
| 14800010 | If failed delete database by invalid database name. |
| 14800010 | If failed delete database by invalid database name. |
| 14800011 |
D
atabase corrupted. |
| 14800011 |
If failed open database by d
atabase corrupted. |
**示例:**
**示例:**
...
@@ -1275,7 +1275,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"])
...
@@ -1275,7 +1275,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"])
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| ------------ | ----------- | ---- | -------------------------------- |
| ------------ | ----------- | ---- | -------------------------------- |
| openStatus
<sup>
10+
</sup>
| number | 是 | RdbStore的状态。值为0时,表示RdbStore首次创建,处于ON_CREATE状态。
;
值为1时,表示RdbStore非首次创建,处于ON_OPEN状态。 |
| openStatus
<sup>
10+
</sup>
| number | 是 | RdbStore的状态。值为0时,表示RdbStore首次创建,处于ON_CREATE状态。值为1时,表示RdbStore非首次创建,处于ON_OPEN状态。 |
### insert
### insert
...
@@ -2756,7 +2756,7 @@ getColumnIndex(columnName: string): number
...
@@ -2756,7 +2756,7 @@ getColumnIndex(columnName: string): number
|
**错误码ID**
|
**错误信息**
|
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is
null or the column type is incompatible. |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
...
@@ -2794,7 +2794,7 @@ getColumnName(columnIndex: number): string
...
@@ -2794,7 +2794,7 @@ getColumnName(columnIndex: number): string
|
**错误码ID**
|
**错误信息**
|
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is
null or the column type is incompatible. |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
...
@@ -3047,14 +3047,6 @@ getBlob(columnIndex: number): Uint8Array
...
@@ -3047,14 +3047,6 @@ getBlob(columnIndex: number): Uint8Array
| ---------- | -------------------------------- |
| ---------- | -------------------------------- |
| Uint8Array | 以字节数组的形式返回指定列的值。 |
| Uint8Array | 以字节数组的形式返回指定列的值。 |
**错误码:**
以下错误码的详细介绍请参见
[
关系型数据库错误码
](
../errorcodes/errorcode-data-rdb.md
)
。
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
```
js
```
js
...
@@ -3081,14 +3073,6 @@ getString(columnIndex: number): string
...
@@ -3081,14 +3073,6 @@ getString(columnIndex: number): string
| ------ | ---------------------------- |
| ------ | ---------------------------- |
| string | 以字符串形式返回指定列的值。 |
| string | 以字符串形式返回指定列的值。 |
**错误码:**
以下错误码的详细介绍请参见
[
关系型数据库错误码
](
../errorcodes/errorcode-data-rdb.md
)
。
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
```
js
```
js
...
@@ -3115,14 +3099,6 @@ getLong(columnIndex: number): number
...
@@ -3115,14 +3099,6 @@ getLong(columnIndex: number): number
| ------ | -------------------------- |
| ------ | -------------------------- |
| number | 以Long形式返回指定列的值。 |
| number | 以Long形式返回指定列的值。 |
**错误码:**
以下错误码的详细介绍请参见
[
关系型数据库错误码
](
../errorcodes/errorcode-data-rdb.md
)
。
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
```
js
```
js
...
@@ -3149,14 +3125,6 @@ getDouble(columnIndex: number): number
...
@@ -3149,14 +3125,6 @@ getDouble(columnIndex: number): number
| ------ | ---------------------------- |
| ------ | ---------------------------- |
| number | 以double形式返回指定列的值。 |
| number | 以double形式返回指定列的值。 |
**错误码:**
以下错误码的详细介绍请参见
[
关系型数据库错误码
](
../errorcodes/errorcode-data-rdb.md
)
。
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
```
js
```
js
...
@@ -3189,7 +3157,7 @@ isColumnNull(columnIndex: number): boolean
...
@@ -3189,7 +3157,7 @@ isColumnNull(columnIndex: number): boolean
|
**错误码ID**
|
**错误信息**
|
|
**错误码ID**
|
**错误信息**
|
| ------------ | ------------------------------------------------------------ |
| ------------ | ------------------------------------------------------------ |
| 14800013 | The column value is
null or the column type is incompatible. |
| 14800013 | The column value is null or the column type is incompatible. |
**示例:**
**示例:**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录