diff --git a/api/@ohos.data.relationalStore.d.ts b/api/@ohos.data.relationalStore.d.ts index a47fbcfabc74e8709479beb41450bef3820107b7..a629b277da7d0989c0c8ab41e36f4bbd3af8af3b 100644 --- a/api/@ohos.data.relationalStore.d.ts +++ b/api/@ohos.data.relationalStore.d.ts @@ -941,6 +941,69 @@ declare namespace relationalStore { executeTime: number; } + /** + * Define exception messages during executing. + * + * @interface ExceptionMessage + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + interface ExceptionMessage { + /** + * Exception error codes that occur when executing SQL statements. + * + * @type { number } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + code: number; + + /** + * Exception error messages that occur when executing SQL statements. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + message: string; + + /** + * SQL statement when abnormal error message appears. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + sql: string; + } + + /** + * Define the parameters used for execution. + * + * @interface ExecutionParam + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + interface ExecutionParam { + /** + * SQL statement for execution. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + sql: string; + + /** + * args for execution. + * + * @type { string } + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + args: Array; + } + /** * Describes the {@code RdbStore} type. * @@ -2437,6 +2500,17 @@ declare namespace relationalStore { * @since 12 */ notLike(field: string, value: string): RdbPredicates; + + /** + * Filters the grouped data that meets the specified conditions. + * + * @param { string } conditions - Coditions used to filter the data obtained using GROUP BY. + * @param { Array } args - Parameters to be used in the conditions. + * @returns { RdbPredicates } - Returns the RdbPredicates object. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + having(conditions:string, args?: Array): RdbPredicates; } /** @@ -7247,6 +7321,28 @@ declare namespace relationalStore { */ on(event: 'statistics', observer: Callback ): void; + /** + * Subscribes to the SQL statistics. + * @param { 'perfStat' } event - Indicates the event type, which must be 'perfStat'. + * @param { Callback } observer - Indicates the callback used to return the SQL execution statistics {@link SqlExeInfo} in the database. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + on(event: 'perfStat', observer: Callback ): void; + + /** + * Subscribes to the SQL log. + * @param { 'errorlog' } event - Indicates the event type, which must be 'errorlog'. + * @param { Callback } observer - Indicates the callback used to return the SQL execution errorlog {@link ExceptionMessage } in the database. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + on(event: 'errorlog', observer: Callback ): void; + /** * Remove specified observer of specified type from the database. * @@ -7382,6 +7478,28 @@ declare namespace relationalStore { */ off(event: 'statistics', observer?: Callback ): void; + /** + * Subscribes to the SQL statistics. + * @param { 'perfStat' } event - Indicates the event type, which must be 'perfStat'. + * @param { Callback } observer - Indicates the callback used to return the SQL execution statistics {@link SqlExeInfo} in the database. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + off(event: 'perfStat', observer?: Callback ): void; + + /** + * Unsubscribes to the error log. + * @param { 'errorlog' } event - Indicates the event type, which must be 'errorlog'. + * @param { Callback } observer - Indicates the callback to unregister. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800014 - Already closed. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + off(event: 'errorlog', observer?: Callback ): void; + /** * Notifies the registered observers of a change to the data resource specified by Uri. * @@ -7662,6 +7780,28 @@ declare namespace relationalStore { * @since 14 */ createTransaction(options?: TransactionOptions): Promise; + + /** + * Change the encrypted database key. + * + * @param { CryptoParam } cryptoParam - Indicates the crypto parameters. + * @returns { Promise } -The promise returned by the function. + * @throws { BusinessError } 801 - Capability not supported. + * @throws { BusinessError } 14800011 - Database corrupted. + * @throws { BusinessError } 14800014 - Already closed. + * @throws { BusinessError } 14800015 - The database does not respond. + * @throws { BusinessError } 14800021 - SQLite: Generic error. + * @throws { BusinessError } 14800023 - SQLite: Access permission denied. + * @throws { BusinessError } 14800024 - SQLite: The database file is locked. + * @throws { BusinessError } 14800026 - SQLite: The database is out of memory. + * @throws { BusinessError } 14800027 - SQLite: Attempt to write a readonly database. + * @throws { BusinessError } 14800028 - SQLite: Some kind of disk I/O error occurred. + * @throws { BusinessError } 14800029 - SQLite: The database is full. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @crossplatform + * @since 20 + */ + rekey(cryptoParam?: CryptoParam): Promise; } /** @@ -8489,6 +8629,52 @@ declare namespace relationalStore { * @since 18 */ function isTokenizerSupported(tokenizer: Tokenizer): boolean; + + /** + * Obtain the SQL statement and args used for updating. + * + * @param { string } table - Indicates the target table. + * @param { ValuesBucket } values - Indicates the row of data {@link ValuesBucket} to be inserted into the table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to insert data into the table. + * @returns { ExecutionParam } - The insert sql statement and args. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + function getInsertParam(table: string, values: ValuesBucket, conflict?: ConflictResolution):ExecutionParam; + + /** + * Obtain the SQL statement and args used for updating. + * + * @param { RdbPredicates } predicates - Indicates the specified update condition by the instance object of {@link RdbPredicates}. + * @param { ValuesBucket } values - Indicates the row of data to be updated in the database. + * The key-value pairs are associated with column names of the database table. + * @param { ConflictResolution } conflict - Indicates the {@link ConflictResolution} to update data into the table. + * @returns { ExecutionParam } - The update sql statement and args. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + function getUpdateParam(predicates: RdbPredicates, values: ValuesBucket, conflict?: ConflictResolution):ExecutionParam; + + /** + * Obtain the SQL statement and args used for deletion. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @returns { ExecutionParam] } - The delete sql statement and args. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + function getDeleteParam(predicates: RdbPredicates):ExecutionParam; + + /** + * Obtain the SQL statement and args used for query. + * + * @param { RdbPredicates } predicates - The specified query condition by the instance object of {@link RdbPredicates}. + * @param { Array } columns - The columns to query. If the value is null, the query applies to all columns. + * @returns { ExecutionParam } - The query sql statement and args. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + function getQueryParam(predicates: RdbPredicates, columns?: Array):ExecutionParam; } export default relationalStore; diff --git a/api/@ohos.data.sendableRelationalStore.d.ets b/api/@ohos.data.sendableRelationalStore.d.ets index b354d041916e0e02e138966c3d3f1b49e4708f17..d296e90f04f96a42a171e49869d527e3d7419fed 100644 --- a/api/@ohos.data.sendableRelationalStore.d.ets +++ b/api/@ohos.data.sendableRelationalStore.d.ets @@ -195,6 +195,38 @@ declare namespace sendableRelationalStore { * @since 12 */ function toSendableAsset(asset: NonSendableAsset): Asset; + + /** + * Defines NonSendableValues for convenience. + * + * @typedef { Array } NonSendableValues + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + type NonSendableValues = Array; + + /** + * Converts a sendable collections.Array to a non-sendable Array. + * + * @param { collections.Array } values - Indicates the sendable collections.Array to convert. + * @returns { NonSendableValues } a non-sendable Array. For details, + * see {@link NonSendableValues}. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + function fromSendableValues(values: collections.Array): NonSendableValues; + + /** + * Converts a non-sendable Array to a collections.Arrayt. + * + * @param { NonSendableValues } values - Indicates the non-sendable Array to convert. + * @returns { collections.Array } a sendable collections.Array. + * @throws { BusinessError } 14800000 - Inner error. + * @syscap SystemCapability.DistributedDataManager.RelationalStore.Core + * @since 20 + */ + function toSendableValues(values: NonSendableValues): collections.Array; } export default sendableRelationalStore; \ No newline at end of file