提交 9742c8f8 编写于 作者: P PaDaBoo

update guidelines relationalStore errorcode

Signed-off-by: NPaDaBoo <xuejianwu@huawei.com>
上级 3d4203fa
...@@ -17,8 +17,8 @@ ...@@ -17,8 +17,8 @@
| 接口名 | 描述 | | 接口名 | 描述 |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ------------------------------------------------------------ |
| getRdbStore(context: Context, config: StoreConfig): Promise&lt;RdbStore&gt; | 获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用Promise异步回调。<br/>-context:应用程序或功能的上下文。<br/>-config:与此RDB存储相关的数据库配置。 | | getRdbStore(context: Context, config: StoreConfig): Promise&lt;RdbStore&gt; | 获得一个相关的RdbStore,操作关系型数据库,用户可以根据自己的需求配置RdbStore的参数,然后通过RdbStore调用相关接口可以执行相关的数据操作,使用Promise异步回调。<br/>-context:应用上下文。<br/>-config:与此RDB存储相关的数据库配置。 |
| deleteRdbStore(context: Context, name: string): Promise&lt;void&gt; | 使用指定的数据库文件配置删除数据库,使用Promise异步回调。<br/>-context:应用程序或功能的上下文。<br/>-name:数据库名称。 | | deleteRdbStore(context: Context, name: string): Promise&lt;void&gt; | 使用指定的数据库文件配置删除数据库,使用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&lt;string&gt;): Promise&lt;ResultSet&gt; | 根据指定条件查询数据库中的数据,使用Promise异步回调。<br/>-predicates:表示RdbPredicates的实例对象指定的查询条件。<br/>-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
| RdbStore | query(predicates: RdbPredicates, columns?: Array&lt;string&gt;): Promise&lt;ResultSet&gt; | 根据指定条件查询数据库中的数据,使用Promise异步回调。<br/>-predicates:表示RdbPredicates的实例对象指定的查询条件。<br/>-columns:表示要查询的列。如果值为空,则查询应用于所有列。 | | RdbStore | querySql(sql: string, bindArgs?: Array&lt;ValueType&gt;): Promise&lt;ResultSet&gt; | 根据指定SQL语句查询数据库中的数据,使用Promise异步回调。<br/>-sql:指定要查询的SQL语句。<br/>-bindArgs:SQL语句中参数的值。 |
| RdbStore | querySql(sql: string, bindArgs?: Array&lt;ValueType&gt;): Promise&lt;ResultSet&gt; | 根据指定SQL语句查询数据库中的数据,使用Promise异步回调。<br/>-sql:指定要查询的SQL语句。<br/>-bindArgs:SQL语句中参数的值。 | | RdbStore | remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array&lt;string&gt;): Promise&lt;ResultSet&gt; | 根据指定条件查询指定远程设备数据库中的数据。使用Promise异步回调。<br/>-device:指定远程查询的设备networkId。<br/>-table:指定远程查询的表名。<br/>-predicates:表示RdbPredicates的实例对象,指定查询的条件。<br/>-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
| RdbStore | remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array&lt;string&gt;): Promise&lt;ResultSet&gt; | 根据指定条件查询指定远程设备数据库中的数据。使用Promise异步回调。<br/>-device:指定远程查询的设备networkId。<br/>-table:指定远程查询的表名。<br/>-predicates:表示RdbPredicates的实例对象,指定查询的条件。<br/>-columns:表示要查询的列。如果值为空,则查询应用于所有列。 |
### 数据库谓词的使用 ### 数据库谓词的使用
......
...@@ -41,7 +41,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback&lt;Rd ...@@ -41,7 +41,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback&lt;Rd
| **错误码ID** | **错误信息** | | **错误码ID** | **错误信息** |
| ------------ | ----------------------- | | ------------ | ----------------------- |
| 14800010 | If failed delete database by invalid database name. | | 14800010 | If failed delete database by invalid database name. |
| 14800011 | Database corrupted. | | 14800011 | If failed open database by database corrupted. |
**示例:** **示例:**
...@@ -134,7 +134,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise&lt;RdbStore&gt; ...@@ -134,7 +134,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise&lt;RdbStore&gt;
| **错误码ID** | **错误信息** | | **错误码ID** | **错误信息** |
| ------------ | ----------------------- | | ------------ | ----------------------- |
| 14800010 | If failed delete database by invalid database name. | | 14800010 | If failed delete database by invalid database name. |
| 14800011 | Database corrupted. | | 14800011 | If failed open database by database 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.
先完成此消息的编辑!
想要评论请 注册