未验证 提交 2e2aabe1 编写于 作者: O openharmony_ci 提交者: Gitee

!19770 [翻译完成】#I7ABIM

Merge pull request !19770 from Annie_wang/PR18998
...@@ -6,7 +6,7 @@ The **relationalStore** module provides the following functions: ...@@ -6,7 +6,7 @@ The **relationalStore** module provides the following functions:
- [RdbPredicates](#rdbpredicates): provides predicates indicating the nature, feature, or relationship of a data entity in an RDB store. It is used to define the operation conditions for an RDB store. - [RdbPredicates](#rdbpredicates): provides predicates indicating the nature, feature, or relationship of a data entity in an RDB store. It is used to define the operation conditions for an RDB store.
- [RdbStore](#rdbstore): provides APIs for managing data in an RDB store. - [RdbStore](#rdbstore): provides APIs for managing data in an RDB store.
- [ResultSet](#resultset): provides APIs for accessing the result set obtained from the RDB store. - [Resultset](#resultset): provides APIs for accessing the result set obtained from the RDB store.
> **NOTE** > **NOTE**
> >
...@@ -38,11 +38,11 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul ...@@ -38,11 +38,11 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------- | | ------------ | ----------------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800011 | Failed open database, database corrupted. | | 14800011 | Failed to open database by database corrupted. |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -122,11 +122,11 @@ Obtains an RDB store. This API uses a promise to return the result. You can set ...@@ -122,11 +122,11 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------- | | ------------ | ----------------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800011 | Failed open database, database corrupted. | | 14800011 | Failed to open database by database corrupted. |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -198,10 +198,10 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul ...@@ -198,10 +198,10 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------- | | ------------ | ----------------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -265,10 +265,10 @@ Deletes an RDB store. This API uses a promise to return the result. ...@@ -265,10 +265,10 @@ Deletes an RDB store. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------- | | ------------ | ----------------------------------------------------------- |
| 14800010 | Failed to open or delete database by invalid database path. | | 14800010 | Failed to open or delete database by invalid database path. |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -323,7 +323,7 @@ Enumerates the RDB store security levels. ...@@ -323,7 +323,7 @@ Enumerates the RDB store security levels.
> **NOTE** > **NOTE**
> >
> To perform data synchronization operations, the RDB store security level must be lower than or equal to that of the peer device. For details, see the [Access Control Mechanism in Cross-Device Synchronization](../../database/access-control-by-device-and-data-level.md#access-control-mechanism-in-cross-device-synchronization). > To perform data synchronization operations, the RDB store security level must be lower than or equal to that of the peer device. For details, see the [Cross-Device Data Synchronization Mechanism]( ../../database/sync-app-data-across-devices-overview.md#cross-device-data-synchronization-mechanism).
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
...@@ -378,10 +378,26 @@ Defines the subscription type. ...@@ -378,10 +378,26 @@ Defines the subscription type.
| Name | Value | Description | | Name | Value | Description |
| --------------------- | ---- | ------------------ | | --------------------- | ---- | ------------------ |
| SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.| | SUBSCRIBE_TYPE_REMOTE | 0 | Subscribe to remote data changes.|
| SUBSCRIBE_TYPE_CLOUD<sup>10+</sup> | 1 | Subscribe to cloud data changes.|
## ConflictResolution<sup>10+</sup>
Defines the resolution to use when **insert()** and **update()** conflict.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Value | Description |
| -------------------- | ---- | ------------------------------------------------------------ |
| ON_CONFLICT_NONE | 0 | No operation is performed.|
| ON_CONFLICT_ROLLBACK | 1 | Abort the SQL statement and roll back the current transaction. |
| ON_CONFLICT_ABORT | 2 | Abort the current SQL statement and revert any changes made by the current SQL statement. However, the changes made by the previous SQL statement in the same transaction are retained and the transaction remains active.|
| ON_CONFLICT_FAIL | 3 | Abort the current SQL statement. The **FAIL** resolution does not revert previous changes made by the failed SQL statement or end the transaction.|
| ON_CONFLICT_IGNORE | 4 | Skip the rows that contain constraint violations and continue to process the subsequent rows of the SQL statement.|
| ON_CONFLICT_REPLACE | 5 | Delete pre-existing rows that cause the constraint violation before inserting or updating the current row, and continue to execute the command normally.|
## RdbPredicates ## RdbPredicates
Defines the predicates for an RDB store. This class determines whether the conditional expression for the RDB store is true or false. This type is not multi-thread safe. If a **RdbPredicates** instance is operated by multiple threads at the same time in an application, use a lock for the instance. Defines the predicates for an RDB store. This class determines whether the conditional expression for the RDB store is true or false. This type is not multi-thread safe. If an **RdbPredicates** instance is operated by multiple threads at the same time in an application, use a lock for the instance.
### constructor ### constructor
...@@ -1237,10 +1253,27 @@ predicates.notIn("NAME", ["Lisa", "Rose"]); ...@@ -1237,10 +1253,27 @@ predicates.notIn("NAME", ["Lisa", "Rose"]);
## RdbStore ## RdbStore
Provides methods to manage an RDB store. Provides APIs to manage an RDB store.
Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data. Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data.
### Attributes<sup>10+</sup>
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
| Name | Type | Mandatory| Description |
| ------------ | ----------- | ---- | -------------------------------- |
| version<sup>10+</sup> | number | Yes | RDB store version, which is an integer greater than 0. |
**Example**
```js
// Set the RDB store version.
store.version = 3;
// Obtain the RDB store version.
console.info(`RdbStore version is ${store.version}`);
```
### insert ### insert
insert(table: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;):void insert(table: string, values: ValuesBucket, callback: AsyncCallback&lt;number&gt;):void
...@@ -1257,6 +1290,15 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re ...@@ -1257,6 +1290,15 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. | | values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
```js ```js
...@@ -1275,6 +1317,49 @@ store.insert("EMPLOYEE", valueBucket, function (err, rowId) { ...@@ -1275,6 +1317,49 @@ store.insert("EMPLOYEE", valueBucket, function (err, rowId) {
}) })
``` ```
### insert<sup>10+</sup>
insert(table: string, values: ValuesBucket, conflict: ConflictResolution, callback: AsyncCallback&lt;number&gt;):void
Inserts a row of data into a table. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | ---------------------------------------------------------- |
| table | string | Yes | Name of the target table. |
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. |
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Lisa",
"AGE": 18,
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
store.insert("EMPLOYEE", valueBucket, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE, function (err, rowId) {
if (err) {
console.error(`Insert is failed, code is ${err.code},message is ${err.message}`);
return;
}
console.info(`Insert is successful, rowId = ${rowId}`);
})
```
### insert ### insert
...@@ -1303,7 +1388,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1303,7 +1388,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1322,6 +1408,53 @@ promise.then((rowId) => { ...@@ -1322,6 +1408,53 @@ promise.then((rowId) => {
}) })
``` ```
### insert<sup>10+</sup>
insert(table: string, values: ValuesBucket, conflict: ConflictResolution):Promise&lt;number&gt;
Inserts a row of data into a table. This API uses a promise to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------- | ---- | -------------------------- |
| table | string | Yes | Name of the target table. |
| values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert.|
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------- |
| Promise&lt;number&gt; | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Lisa",
"AGE": 18,
"SALARY": 100.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
let promise = store.insert("EMPLOYEE", valueBucket, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
promise.then((rowId) => {
console.info(`Insert is successful, rowId = ${rowId}`);
}).catch((err) => {
console.error(`Insert is failed, code is ${err.code},message is ${err.message}`);
})
```
### batchInsert ### batchInsert
...@@ -1345,7 +1478,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1345,7 +1478,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1406,7 +1540,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1406,7 +1540,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1455,14 +1590,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T ...@@ -1455,14 +1590,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. | | predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows updated. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows updated. |
**Error codes** **Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1484,6 +1619,51 @@ store.update(valueBucket, predicates, function (err, rows) { ...@@ -1484,6 +1619,51 @@ store.update(valueBucket, predicates, function (err, rows) {
}) })
``` ```
### update<sup>10+</sup>
update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution, callback: AsyncCallback&lt;number&gt;):void
Updates data in the RDB store based on the specified **RdbPredicates** object. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows updated. |
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Rose",
"AGE": 22,
"SALARY": 200.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Lisa");
store.update(valueBucket, predicates, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE, function (err, rows) {
if (err) {
console.error(`Updated failed, code is ${err.code},message is ${err.message}`);
return;
}
console.info(`Updated row count: ${rows}`);
})
```
### update ### update
...@@ -1512,7 +1692,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1512,7 +1692,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1533,6 +1714,55 @@ promise.then(async (rows) => { ...@@ -1533,6 +1714,55 @@ promise.then(async (rows) => {
}) })
``` ```
### update<sup>10+</sup>
update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolution):Promise&lt;number&gt;
Updates data based on the specified **RdbPredicates** object. This API uses a promise to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name | Type | Mandatory| Description |
| ---------- | ------------------------------------------- | ---- | ------------------------------------------------------------ |
| values | [ValuesBucket](#valuesbucket) | Yes | Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. |
| conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. |
**Return value**
| Type | Description |
| --------------------- | ----------------------------------------- |
| Promise&lt;number&gt; | Promise used to return the number of rows updated.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example**
```js
const valueBucket = {
"NAME": "Rose",
"AGE": 22,
"SALARY": 200.5,
"CODES": new Uint8Array([1, 2, 3, 4, 5]),
};
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Lisa");
let promise = store.update(valueBucket, predicates, relationalStore.ConflictResolution.ON_CONFLICT_REPLACE);
promise.then(async (rows) => {
console.info(`Updated row count: ${rows}`);
}).catch((err) => {
console.error(`Updated failed, code is ${err.code},message is ${err.message}`);
})
```
### update ### update
...@@ -1561,7 +1791,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1561,7 +1791,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1616,7 +1847,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1616,7 +1847,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1659,7 +1891,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1659,7 +1891,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1693,7 +1926,7 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object. ...@@ -1693,7 +1926,7 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object.
| Type | Description | | Type | Description |
| --------------------- | ------------------------------- | | --------------------- | ------------------------------- |
| Promise&lt;number&gt; | Promise used to return the number of rows deleted. | | Promise&lt;number&gt; | Promise used to return the number of rows deleted.|
**Error codes** **Error codes**
...@@ -1701,7 +1934,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1701,7 +1934,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1734,7 +1968,7 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o ...@@ -1734,7 +1968,7 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o
| ---------- | ------------------------------------------------------------ | ---- | --------------------------------------------- | | ---------- | ------------------------------------------------------------ | ---- | --------------------------------------------- |
| table | string | Yes | Name of the target table. | | table | string | Yes | Name of the target table. |
| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Conditions specified by the **DataSharePredicates** object for deleting data.| | predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Conditions specified by the **DataSharePredicates** object for deleting data.|
| callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows deleted. | | callback | AsyncCallback&lt;number&gt; | Yes | Callback invoked to return the number of rows deleted. |
**Error codes** **Error codes**
...@@ -1742,7 +1976,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1742,7 +1976,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1790,7 +2025,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -1790,7 +2025,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -1826,9 +2062,9 @@ Queries data from the RDB store based on specified conditions. This API uses an ...@@ -1826,9 +2062,9 @@ Queries data from the RDB store based on specified conditions. This API uses an
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -1840,8 +2076,17 @@ store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, ...@@ -1840,8 +2076,17 @@ store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err,
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}) })
``` ```
...@@ -1860,20 +2105,20 @@ Queries data from the RDB store based on specified conditions. This API uses a p ...@@ -1860,20 +2105,20 @@ Queries data from the RDB store based on specified conditions. This API uses a p
| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. | | predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. |
| columns | Array&lt;string&gt; | No | Columns to query. If this parameter is not specified, the query applies to all columns.| | columns | Array&lt;string&gt; | No | Columns to query. If this parameter is not specified, the query applies to all columns.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | ---------------------------- |
| 14800000 | Inner error. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------------- | -------------------------------------------------- | | ------------------------------------------------------- | -------------------------------------------------- |
| Promise&lt;[ResultSet](#resultset)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.| | Promise&lt;[ResultSet](#resultset)&gt; | Promise used to return the result. If the operation is successful, a **ResultSet** object will be returned.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. |
**Example** **Example**
```js ```js
...@@ -1881,8 +2126,17 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); ...@@ -1881,8 +2126,17 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("NAME", "Rose"); predicates.equalTo("NAME", "Rose");
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
}) })
...@@ -1913,9 +2167,9 @@ Queries data from the RDB store based on specified conditions. This API uses an ...@@ -1913,9 +2167,9 @@ Queries data from the RDB store based on specified conditions. This API uses an
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -1928,8 +2182,17 @@ store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], fu ...@@ -1928,8 +2182,17 @@ store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], fu
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}) })
``` ```
...@@ -1963,9 +2226,9 @@ Queries data from the RDB store based on specified conditions. This API uses a p ...@@ -1963,9 +2226,9 @@ Queries data from the RDB store based on specified conditions. This API uses a p
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -1975,8 +2238,17 @@ let predicates = new dataSharePredicates.DataSharePredicates(); ...@@ -1975,8 +2238,17 @@ let predicates = new dataSharePredicates.DataSharePredicates();
predicates.equalTo("NAME", "Rose"); predicates.equalTo("NAME", "Rose");
let promise = store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); let promise = store.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
}) })
...@@ -1988,7 +2260,7 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A ...@@ -1988,7 +2260,7 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
Queries data from the RDB store of a remote device based on specified conditions. This API uses an asynchronous callback to return the result. Queries data from the RDB store of a remote device based on specified conditions. This API uses an asynchronous callback to return the result.
> **NOTE** > **NOTE**<br/>
> >
> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
...@@ -2008,9 +2280,9 @@ Queries data from the RDB store of a remote device based on specified conditions ...@@ -2008,9 +2280,9 @@ Queries data from the RDB store of a remote device based on specified conditions
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2037,8 +2309,17 @@ store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALAR ...@@ -2037,8 +2309,17 @@ store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALAR
console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`); console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
} }
) )
``` ```
...@@ -2049,7 +2330,7 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A ...@@ -2049,7 +2330,7 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A
Queries data from the RDB store of a remote device based on specified conditions. This API uses a promise to return the result. Queries data from the RDB store of a remote device based on specified conditions. This API uses a promise to return the result.
> **NOTE** > **NOTE**<br/>
> >
> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. > The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications.
...@@ -2074,9 +2355,9 @@ Queries data from the RDB store of a remote device based on specified conditions ...@@ -2074,9 +2355,9 @@ Queries data from the RDB store of a remote device based on specified conditions
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2099,8 +2380,17 @@ let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); ...@@ -2099,8 +2380,17 @@ let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.greaterThan("id", 0); predicates.greaterThan("id", 0);
let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`); console.error(`Failed to remoteQuery, code is ${err.code},message is ${err.message}`);
}) })
...@@ -2126,9 +2416,9 @@ Queries data using the specified SQL statement. This API uses an asynchronous ca ...@@ -2126,9 +2416,9 @@ Queries data using the specified SQL statement. This API uses an asynchronous ca
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2138,8 +2428,17 @@ store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['s ...@@ -2138,8 +2428,17 @@ store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['s
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
return; return;
} }
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}) })
``` ```
...@@ -2168,17 +2467,26 @@ Queries data using the specified SQL statement. This API uses a promise to retur ...@@ -2168,17 +2467,26 @@ Queries data using the specified SQL statement. This API uses a promise to retur
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
```js ```js
let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'"); let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'");
promise.then((resultSet) => { promise.then((resultSet) => {
console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column names: ${resultSet.columnNames}, column count: ${resultSet.columnCount}`);
console.info(`ResultSet column count: ${resultSet.columnCount}`); // resultSet is a cursor of a data set. By default, the cursor points to the -1st record. Valid data starts from 0.
while(resultSet.goToNextRow()) {
const id = resultSet.getLong(resultSet.getColumnIndex("ID"));
const name = resultSet.getString(resultSet.getColumnIndex("NAME"));
const age = resultSet.getLong(resultSet.getColumnIndex("AGE"));
const salary = resultSet.getDouble(resultSet.getColumnIndex("SALARY"));
console.info(`id=${id}, name=${name}, age=${age}, salary=${salary}`);
}
// Release the dataset memory.
resultSet.close();
}).catch((err) => { }).catch((err) => {
console.error(`Query failed, code is ${err.code},message is ${err.message}`); console.error(`Query failed, code is ${err.code},message is ${err.message}`);
}) })
...@@ -2206,7 +2514,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2206,7 +2514,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2248,7 +2557,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2248,7 +2557,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2276,7 +2586,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -2276,7 +2586,8 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. | | 14800047 | The WAL file size exceeds the default limit. |
| 14800000 | Inner error. |
**Example** **Example**
...@@ -2397,9 +2708,9 @@ Backs up an RDB store. This API uses an asynchronous callback to return the resu ...@@ -2397,9 +2708,9 @@ Backs up an RDB store. This API uses an asynchronous callback to return the resu
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2427,20 +2738,20 @@ Backs up an RDB store. This API uses a promise to return the result. ...@@ -2427,20 +2738,20 @@ Backs up an RDB store. This API uses a promise to return the result.
| -------- | ------ | ---- | ------------------------ | | -------- | ------ | ---- | ------------------------ |
| destName | string | Yes | Name of the RDB store backup file.| | destName | string | Yes | Name of the RDB store backup file.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | -------------------------------------------- |
| 14800000 | The inner error is occurred. |
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------- | ------------------------- | | ------------------- | ------------------------- |
| Promise&lt;void&gt; | Promise that returns no value.| | Promise&lt;void&gt; | Promise that returns no value.|
**Error codes**
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** |
| ------------ | ---------------------------- |
| 14800000 | Inner error. |
**Example** **Example**
```js ```js
...@@ -2471,9 +2782,9 @@ Restores an RDB store from a backup file. This API uses an asynchronous callback ...@@ -2471,9 +2782,9 @@ Restores an RDB store from a backup file. This API uses an asynchronous callback
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2511,9 +2822,9 @@ Restores an RDB store from a backup file. This API uses a promise to return the ...@@ -2511,9 +2822,9 @@ Restores an RDB store from a backup file. This API uses a promise to return the
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2547,9 +2858,9 @@ Sets distributed tables. This API uses an asynchronous callback to return the re ...@@ -2547,9 +2858,9 @@ Sets distributed tables. This API uses an asynchronous callback to return the re
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2589,9 +2900,9 @@ Sets distributed tables. This API uses a promise to return the result. ...@@ -2589,9 +2900,9 @@ Sets distributed tables. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2630,9 +2941,9 @@ Obtains the distributed table name of a remote device based on the local table n ...@@ -2630,9 +2941,9 @@ Obtains the distributed table name of a remote device based on the local table n
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2691,9 +3002,9 @@ Obtains the distributed table name of a remote device based on the local table n ...@@ -2691,9 +3002,9 @@ Obtains the distributed table name of a remote device based on the local table n
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2742,9 +3053,9 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret ...@@ -2742,9 +3053,9 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2806,9 +3117,9 @@ Synchronizes data between devices. This API uses a promise to return the result. ...@@ -2806,9 +3117,9 @@ Synchronizes data between devices. This API uses a promise to return the result.
For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md).
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | -------------------------------------------- | | ------------ | ---------------------------- |
| 14800000 | The inner error is occurred. | | 14800000 | Inner error. |
**Example** **Example**
...@@ -2854,9 +3165,9 @@ Registers an observer for this RDB store. When the data in the RDB store changes ...@@ -2854,9 +3165,9 @@ Registers an observer for this RDB store. When the data in the RDB store changes
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ----------------------------------- | ---- | ------------------------------------------- | | -------- | ----------------------------------- | ---- | ------------------------------------------- |
| event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. | | event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. |
| type | [SubscribeType](#subscribetype) | Yes | Subscription type to register.| | type | [SubscribeType](#subscribetype) | Yes | Subscription type to register.|
| observer | Callback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the data change. **Array<string>** indicates the IDs of the peer devices whose data in the database is changed.| | observer | Callback&lt;Array&lt;string&gt;&gt; | Yes | Callback invoked to return the data change event. **Array<string>** indicates the IDs of the peer devices whose data in the database is changed.|
**Example** **Example**
...@@ -2885,9 +3196,9 @@ Unregisters the observer of the specified type from the RDB store. This API uses ...@@ -2885,9 +3196,9 @@ Unregisters the observer of the specified type from the RDB store. This API uses
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------- | ---- | ------------------------------------------ | | -------- | ---------------------------------- | ---- | ------------------------------------------ |
| event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. | | event | string | Yes | Event type. The value is **dataChange**, which indicates a data change event. |
| type | [SubscribeType](#subscribetype) | Yes | Subscription type to unregister. | | type | [SubscribeType](#subscribetype) | Yes | Subscription type to unregister. |
| observer | Callback&lt;Array&lt;string&gt;&gt; | Yes | Callback for the data change. **Array<string>** indicates the IDs of the peer devices whose data in the database is changed.| | observer | Callback&lt;Array&lt;string&gt;&gt; | Yes | Callback for the data change event. **Array<string>** indicates the IDs of the peer devices whose data in the database is changed.|
**Example** **Example**
...@@ -3040,7 +3351,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3040,7 +3351,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
**Example** **Example**
...@@ -3081,7 +3392,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3081,7 +3392,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
**Example** **Example**
...@@ -3117,7 +3428,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3117,7 +3428,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
**Example** **Example**
...@@ -3152,7 +3463,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3152,7 +3463,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
**Example** **Example**
...@@ -3187,7 +3498,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3187,7 +3498,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
**Example** **Example**
...@@ -3222,7 +3533,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3222,7 +3533,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
**Example** **Example**
...@@ -3323,7 +3634,7 @@ Obtains the value of the Long type based on the specified column and the current ...@@ -3323,7 +3634,7 @@ Obtains the value of the Long type based on the specified column and the current
| Type | Description | | Type | Description |
| ------ | ------------------------------------------------------------ | | ------ | ------------------------------------------------------------ |
| number | Value obtained.<br>The value range supported by this API is **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. If the value is out of this range, use [getDouble](#getdouble).| | number | Value obtained.<br>The value range supported by API is **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. If the value is out of this range, use [getDouble](#getdouble).|
**Error codes** **Error codes**
...@@ -3433,4 +3744,4 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode ...@@ -3433,4 +3744,4 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
| **ID**| **Error Message** | | **ID**| **Error Message** |
| ------------ | ------------------------------------------------------------ | | ------------ | ------------------------------------------------------------ |
| 14800012 | The result set is empty, or the specified location is invalid. | | 14800012 | The result set is empty or the specified location is invalid. |
...@@ -4,11 +4,29 @@ ...@@ -4,11 +4,29 @@
> >
> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md). > This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](errorcode-universal.md).
## 14800000 Internal Error
**Error Message**
Inner error.
**Description**
An error occurs at the underlying database.
**Possible Causes**
Invalid SQL statement is passed in.
**Solution**
Determine the cause of the error based on the log information.
## 14800010 Invalid RDB Name ## 14800010 Invalid RDB Name
**Error Message** **Error Message**
Invalid database name. Failed to open or delete database by invalid database path.
**Description** **Description**
...@@ -16,17 +34,17 @@ The RDB store name is invalid. ...@@ -16,17 +34,17 @@ The RDB store name is invalid.
**Possible Causes** **Possible Causes**
The RDB store name is empty or exceeds 1024 bytes. The RDB store path is invalid.
**Solution** **Solution**
Check that the RDB store name is not empty and does not exceed 1024 bytes. Check the RDB store path.
## 14800011 Database File Corrupted ## 14800011 Database File Corrupted
**Error Message** **Error Message**
Database corrupted. Failed to open database by database corrupted.
**Description** **Description**
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册