diff --git a/api/@internal/ets/lifecycle.d.ts b/api/@internal/ets/lifecycle.d.ts index d95232fa18bd622cc888821f024c189ba5799ff1..e93c7b285fe44b2b8e654613baf2e5b8786cfe96 100644 --- a/api/@internal/ets/lifecycle.d.ts +++ b/api/@internal/ets/lifecycle.d.ts @@ -430,11 +430,12 @@ export declare interface LifecycleData { * @param valueBucket Indicates the data to update. This parameter can be null. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be updated by * default. - * @return Returns the number of data records updated. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. * @return - * @FAModelOnly */ - async update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): number; + update?(uri: string, valueBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Queries one or more data records in the database. This method should be implemented by a Data ability. @@ -446,10 +447,12 @@ export declare interface LifecycleData { * the processing logic when this parameter is null. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be queried by * default. - * @return Returns the queried data. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - async query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates): ResultSet; + query?(uri: string, columns: Array, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Deletes one or more data records. This method should be implemented by a Data ability. @@ -459,21 +462,12 @@ export declare interface LifecycleData { * @param uri Indicates the database table storing the data to delete. * @param predicates Indicates filter criteria. If this parameter is null, all data records will be deleted by * default. - * @return Returns the number of data records deleted. - * @FAModelOnly - */ - async delete?(uri: string, predicates: dataAbility.DataAbilityPredicates): number; - - /** - * Performs batch operations on the database. This method should be implemented by a Data ability. - * - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param ops Indicates the data operation list, which can contain multiple operations on the database. - * @return Returns the result of each operation, in array. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - async executeBatch?(ops: Array): Array; + delete?(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback): void; /** * Converts the given {@code uri} that refer to the Data ability into a normalized URI. A normalized URI can be @@ -483,10 +477,12 @@ export declare interface LifecycleData { * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the uri to normalize. - * @return Returns the normalized uri if the Data ability supports URI normalization; + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - normalizeUri?(uri: string): string; + normalizeUri?(uri: string, callback: AsyncCallback): void; /** * Inserts multiple data records into the database. This method should be implemented by a Data ability. @@ -495,10 +491,12 @@ export declare interface LifecycleData { * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the position where the data is to insert. * @param valueBuckets Indicates the data to insert. - * @return Returns the number of data records inserted. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - async batchInsert?(uri: string, valueBuckets: Array): number; + batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; /** * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. @@ -507,12 +505,12 @@ export declare interface LifecycleData { * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the uri to denormalize. - * @return Returns the denormalized {@code uri} object if the denormalization is successful; returns the original - * {@code uri} passed to this method if there is nothing to do; returns {@code null} if the data identified by - * the original {@code uri} cannot be found in the current environment. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - denormalizeUri?(uri: string): string; + denormalizeUri?(uri: string, callback: AsyncCallback): void; /** * Inserts a data record into the database. This method should be implemented by a Data ability. @@ -521,10 +519,12 @@ export declare interface LifecycleData { * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the position where the data is to insert. * @param valueBucket Indicates the data to insert. - * @return Returns the index of the newly inserted data record. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - async insert?(uri: string, valueBucket: rdb.ValuesBucket): number; + insert?(uri: string, valueBucket: rdb.ValuesBucket, callback: AsyncCallback): void; /** * Opens a file. This method should be implemented by a Data ability. @@ -536,10 +536,12 @@ export declare interface LifecycleData { * whatever data is currently in the file), "wt" for write access that truncates any existing file, * "wa" for write-only access to append to any existing data, "rw" for read and write access on any * existing data, or "rwt" for read and write access that truncates any existing file. - * @return Returns the file descriptor. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - async openFile?(uri: string, mode: string): number; + openFile?(uri: string, mode: string, callback: AsyncCallback): void; /** * Obtains the MIME type of files. This method should be implemented by a Data ability. @@ -552,23 +554,12 @@ export declare interface LifecycleData { *

1. "*/*": Obtains all types supported by a Data ability. *

2. "image/*": Obtains files whose main type is image of any subtype. *

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @return Returns the MIME type of the matched files; returns null if there is no type that matches the Data - * @FAModelOnly - */ - getFileTypes?(uri: string, mimeTypeFilter: string): Array; - - /** - * Defines a method in this Data ability (implementation depending on child classes). - * - * @since 7 - * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel - * @param method Indicates the method name. - * @param arg Indicates the parameter transferred by the method. - * @param extras Indicates the parameter transferred by the method. - * @return Returns the result of the method. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - async call?(method: string, arg: string, extras: PacMap): PacMap; + getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; /** * Called to carry {@code AbilityInfo} to this ability after the ability is initialized. @@ -590,8 +581,10 @@ export declare interface LifecycleData { * @since 7 * @sysCap SystemCapability.Ability.AbilityRuntime.FAModel * @param uri Indicates the uri of the data. - * @return Returns the MIME type that matches the data specified by {@code uri}. + * @param callback function specified by framework to receive the result, developer should call this function to + * return the result to framework. + * @return - * @FAModelOnly */ - getType?(uri: string): string; + getType?(uri: string, callback: AsyncCallback): void; }