From c9957669e11cc3262b8b9109994f15baf63ba566 Mon Sep 17 00:00:00 2001 From: songruirui Date: Fri, 20 May 2022 21:48:02 +0800 Subject: [PATCH] delete api Signed-off-by: songruirui --- ...application.DataShareExtensionAbility.d.ts | 203 ---------- api/@ohos.data.DataSharePredicates.d.ts | 369 ------------------ api/@ohos.data.DataShareResultSet.d.ts | 258 ------------ api/@ohos.data.ValuesBucket.d.ts | 32 -- api/@ohos.data.dataShare.d.ts | 218 ----------- 5 files changed, 1080 deletions(-) delete mode 100644 api/@ohos.application.DataShareExtensionAbility.d.ts delete mode 100644 api/@ohos.data.DataSharePredicates.d.ts delete mode 100644 api/@ohos.data.DataShareResultSet.d.ts delete mode 100644 api/@ohos.data.ValuesBucket.d.ts delete mode 100644 api/@ohos.data.dataShare.d.ts diff --git a/api/@ohos.application.DataShareExtensionAbility.d.ts b/api/@ohos.application.DataShareExtensionAbility.d.ts deleted file mode 100644 index d1b5009136..0000000000 --- a/api/@ohos.application.DataShareExtensionAbility.d.ts +++ /dev/null @@ -1,203 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"), - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { AsyncCallback } from "./basic"; -import ExtensionContext from "./application/ExtensionContext"; -import Want from './@ohos.application.Want'; -import DataSharePredicates from './@ohos.data.DataSharePredicates'; -import { ValuesBucket } from './@ohos.data.ValuesBucket'; - -/** - * class of datashare extension ability. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi Hide this for inner system use. - * @StageModelOnly - */ -export default class DataShareExtensionAbility { - /** - * Indicates datashare extension ability context. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @systemapi Hide this for inner system use. - * @StageModelOnly - */ - context?: ExtensionContext; - - /** - * Called back when a datashare extension ability is started for initialization. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param want Indicates connection information about the datashare extension ability. - * @systemapi Hide this for inner system use. - * @return - - * @StageModelOnly - */ - onCreate?(want: Want, callback: AsyncCallback): void; - - /** - * Obtains the MIME type of files. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME type of the files to obtain. This parameter cannot be set to {@code - * null}. - *

1. "*/*": Obtains all types supported by a data share. - *

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

3. "*/jpg": Obtains files whose subtype is JPG of any main type. - * @systemapi Hide this for inner system use. - * @return Returns the MIME type of the matched files; returns null if there is no type that matches the Data - * @StageModelOnly - */ - getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void; - - /** - * Opens a file in a specified remote path. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the path of the file to open. - * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access - * (erasing 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. - * @param callback Indicates the callback when openfile success - * @return Returns the file descriptor. - * @StageModelOnly - */ - openFile?(uri: string, mode: string, callback: AsyncCallback): void; - - /** - * Inserts a data record into the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the position where the data is to insert. - * @param valueBucket Indicates the data to insert. - * @systemapi Hide this for inner system use. - * @return Returns the index of the newly inserted data record. - * @StageModelOnly - */ - insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback): void; - - /** - * Updates one or more data records in the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the database table storing the data to update. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be updated by - * default. - * @param valueBucket Indicates the data to update. This parameter can be null. - * @systemapi Hide this for inner system use. - * @return Returns the number of data records updated. - * @StageModelOnly - */ - update?(uri: string, predicates: DataSharePredicates, valueBucket: ValuesBucket, - callback: AsyncCallback): void; - - /** - * Deletes one or more data records. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @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. - * @systemapi Hide this for inner system use. - * @return Returns the number of data records deleted. - * @StageModelOnly - */ - delete?(uri: string, predicates: DataSharePredicates, callback: AsyncCallback): void; - - /** - * Queries one or more data records in the database. This method should be implemented by a data share. - * - * @note Only RDB and distributed KVDB resultsets are supported. The current version does not support custom resultsets. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the database table storing the data to query. - * @param predicates Indicates filter criteria. If this parameter is null, all data records will be queried by - * default. - * @param columns Indicates the columns to be queried, in array, for example, {"name","age"}. You should define - * the processing logic when this parameter is null. - * @systemapi Hide this for inner system use. - * @return Returns the queried data, only support result set of rdb or kvstore. - * @StageModelOnly - */ - query?(uri: string, predicates: DataSharePredicates, columns: Array, - callback: AsyncCallback): void; - - /** - * Obtains the MIME type matching the data specified by the URI of the data share. This method should be - * implemented by a data share. - * - *

Data abilities supports general data types, including text, HTML, and JPEG.

- * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the uri of the data. - * @systemapi Hide this for inner system use. - * @return Returns the MIME type that matches the data specified by {@code uri}. - * @StageModelOnly - */ - getType?(uri: string, callback: AsyncCallback): void; - - /** - * Inserts multiple data records into the database. This method should be implemented by a data share. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the position where the data is to insert. - * @param valueBuckets Indicates the data to insert. - * @systemapi Hide this for inner system use. - * @return Returns the number of data records inserted. - * @StageModelOnly - */ - batchInsert?(uri: string, valueBuckets: Array, callback: AsyncCallback): void; - - /** - * Converts the given {@code uri} that refer to the data share into a normalized URI. A normalized URI can be - * used across devices, persisted, backed up, and restored. It can refer to the same item in the data share - * even if the context has changed. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the uri to normalize. - * @systemapi Hide this for inner system use. - * @return Returns the normalized uri if the data share supports URI normalization; - * @StageModelOnly - */ - normalizeUri?(uri: string, callback: AsyncCallback): void; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(uri)} into a denormalized one. - * The default implementation of this method returns the original uri passed to it. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Provider - * @param uri Indicates the uri to denormalize. - * @systemapi Hide this for inner system use. - * @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. - * @StageModelOnly - */ - denormalizeUri?(uri: string, callback: AsyncCallback): void; -} \ No newline at end of file diff --git a/api/@ohos.data.DataSharePredicates.d.ts b/api/@ohos.data.DataSharePredicates.d.ts deleted file mode 100644 index e75193a0d6..0000000000 --- a/api/@ohos.data.DataSharePredicates.d.ts +++ /dev/null @@ -1,369 +0,0 @@ -/* - * Copyright (c) 2021-2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { ValueType } from './@ohos.data.ValuesBucket'; - -/** - * Manages relational database configurations. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @import import data_dataShare from '@ohos.data.dataShare'; - */ -export default class DataSharePredicates { - /** - * Configures the DataSharePredicates to match the field whose data type is ValueType and value is equal - * to a specified value. - * - * @note This method is similar to = of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. - */ - equalTo(field: string, value: ValueType): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the field whose data type is ValueType and value is unequal to - * a specified value. - * - * @note This method is similar to != of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. - */ - notEqualTo(field: string, value: ValueType): DataSharePredicates; - - /** - * Adds a left parenthesis to the DataSharePredicates. - * - * @note This method is similar to ( of the SQL statement and needs to be used together with endWrap(). - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataSharePredicates with the left parenthesis. - */ - beginWrap(): DataSharePredicates; - - /** - * Adds a right parenthesis to the DataSharePredicates. - * - * @note This method is similar to ) of the SQL statement and needs to be used together - * with beginWrap(). - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataSharePredicates with the right parenthesis. - */ - endWrap(): DataSharePredicates; - - /** - * Adds an or condition to the DataSharePredicates. - * - * @note This method is similar to or of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataSharePredicates with the or condition. - */ - or(): DataSharePredicates; - - /** - * Adds an and condition to the DataSharePredicates. - * - * @note This method is similar to and of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the DataSharePredicates with the and condition. - */ - and(): DataSharePredicates; - /** - * Configures the DataSharePredicates to match the field whose data type is string and value - * contains a specified value. - * - * @note This method is similar to contains of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. - */ - contains(field: string, value: string): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the field whose data type is string and value starts - * with a specified string. - * - * @note This method is similar to value% of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. - */ - beginsWith(field: string, value: string): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the field whose data type is string and value - * ends with a specified string. - * - * @note This method is similar to %value of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. - * @return Returns the DataSharePredicates that match the specified field. - */ - endsWith(field: string, value: string): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the fields whose value is null. - * - * @note This method is similar to is null of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @return Returns the DataSharePredicates that match the specified field. - */ - isNull(field: string): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the specified fields whose value is not null. - * - * @note This method is similar to is not null of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @return Returns the DataSharePredicates that match the specified field. - */ - isNotNull(field: string): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the fields whose data type is string and value is - * similar to a specified string. - * - * @note This method is similar to like of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. The percent sign (%) in the value - * is a wildcard (like * in a regular expression). - * @return Returns the DataSharePredicates that match the specified field. - */ - like(field: string, value: string): DataSharePredicates; - - /** - * Configures the DataSharePredicates to match the fields whose data type is string and value is - * similar to a specified string. - * - * @note This method is similar to unlike of the SQL statement. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with the DataSharePredicates. The percent sign (%) in the value - * is a wildcard (like * in a regular expression). - * @return Returns the DataSharePredicates that match the specified field. - */ - unlike(field: string, value: string): DataSharePredicates; - - /** - * Configures DataSharePredicates to match the specified field whose data type is string and the value contains - * a wildcard. - * - * @note Different from like, the input parameters of this method are case-sensitive. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param value Indicates the value to match with DataSharePredicates. - * @return Returns the SQL statement with the specified DataSharePredicates. - */ - glob(field: string, value: string): DataSharePredicates; - - /** - * Restricts the value of the field to the range between low value and high value. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name. - * @param low Indicates the minimum value. - * @param high Indicates the maximum value. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - between(field: string, low: ValueType, high: ValueType): DataSharePredicates; - - /** - * Configures DataSharePredicates to match the specified field whose data type is int and value is - * out of a given range. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param low Indicates the minimum value to match with DataSharePredicates. - * @param high Indicates the maximum value to match with DataSharePredicates. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates; - - /** - * Restricts the value of the field to be greater than the specified value. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - greaterThan(field: string, value: ValueType): DataSharePredicates; - - /** - * Restricts the value of the field to be smaller than the specified value. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - lessThan(field: string, value: ValueType): DataSharePredicates; - - /** - * Restricts the value of the field to be greater than or equal to the specified value. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates; - - /** - * Restricts the value of the field to be smaller than or equal to the specified value. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name. - * @param value Indicates the String field. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates; - - /** - * Restricts the ascending order of the return list. When there are several orders, - * the one close to the head has the highest priority. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - orderByAsc(field: string): DataSharePredicates; - - /** - * Restricts the descending order of the return list. When there are several orders, - * the one close to the head has the highest priority. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name for sorting the return list. - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - orderByDesc(field: string): DataSharePredicates; - - /** - * Restricts each row of the query result to be unique. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns the SQL query statement with the specified DataSharePredicates. - */ - distinct(): DataSharePredicates; - - /** - * Construct a query object to specify the number of results and the starting position. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param total Represents the specified number of results. - * @param offset Indicates the starting position. - * @return Returns the query object. - */ - limit(total: number, offset: number): DataSharePredicates; - - /** - * Configures {@code DataSharePredicates} to group query results by specified columns. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param fields Indicates the specified columns by which query results are grouped. - * @return Returns the DataSharePredicates with the specified columns by which query results are grouped. - */ - groupBy(fields: Array): DataSharePredicates; - - /** - * Configures {@code DataSharePredicates} to specify the index column. - * - * @note Before using this method, you need to create an index column. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the name of the index column. - * @return Returns DataSharePredicates with the specified index column. - */ - indexedBy(field: string): DataSharePredicates; - - /** - * Configures {@code DataSharePredicates} to match the specified field whose data type is ValueType array and values - * are within a given range. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param values Indicates the values to match with DataSharePredicates. - * @return Returns DataSharePredicates that matches the specified field. - */ - in(field: string, value: Array): DataSharePredicates; - - /** - * Configures {@code DataSharePredicates} to match the specified field whose data type is String array and values - * are out of a given range. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param field Indicates the column name in the database table. - * @param values Indicates the values to match with DataSharePredicates. - * @return Returns DataSharePredicates that matches the specified field. - */ - notIn(field: string, value: Array): DataSharePredicates; - - /** - * Configures {@code DataSharePredicates} Creates a query condition using the specified key prefix. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param prefix Represents the specified key prefix. - * @return Returns the query object. - */ - prefixKey(prefix: string): DataSharePredicates; - - /** - * Configures {@code DataSharePredicates} to match the specified value whose key is within a given range. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param keys Represents the key names. - * @return Returns the query object. - */ - inKeys(keys: Array): DataSharePredicates; -} diff --git a/api/@ohos.data.DataShareResultSet.d.ts b/api/@ohos.data.DataShareResultSet.d.ts deleted file mode 100644 index 0e1d089768..0000000000 --- a/api/@ohos.data.DataShareResultSet.d.ts +++ /dev/null @@ -1,258 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Indicates the {@code DataType}. - * - *

{@code DataType} is obtained based on the value. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ -export enum DataType { - /** - * Indicates that the data type is null. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - TYPE_NULL = 0, - - /** - * Indicates that the data type is long. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - TYPE_LONG = 1, - - /** - * Indicates that the data type is double. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - TYPE_DOUBLE = 2, - - /** - * Indicates that the data type is byte string. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * */ - TYPE_STRING = 3, - - /** - * Indicates that the data type is blob. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * */ - TYPE_BLOB = 4 -} - -/** - * Provides methods for accessing a datashare result set generated by querying the database. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ -export default interface DataShareResultSet { - /** - * Obtains the names of all columns or keys in a result set. - * - * @note The column or key names are returned as a string array, in which the strings are in the same order - * as the columns or keys in the result set. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - columnNames: Array; - - /** - * Obtains the number of columns or keys in the result set. - * - * @note The returned number is equal to the length of the string array returned by the columnCount method. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - columnCount: number; - - /** - * Obtains the number of rows in the result set. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - rowCount: number; - - /** - * Checks whether the current result set is closed. - * - * If the result set is closed by calling the close method, true will be returned. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ - isClosed: boolean; - - /** - * Go to the first row of the result set. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is empty. - */ - goToFirstRow(): boolean; - - /** - * Go to the last row of the result set. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is empty. - */ - goToLastRow(): boolean; - - /** - * Go to the next row of the result set. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is already in the last row. - */ - goToNextRow(): boolean; - - /** - * Go to the previous row of the result set. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns true if the result set is moved successfully; - * returns false otherwise, for example, if the result set is already in the first row. - */ - goToPreviousRow(): boolean; - - /** - * Go to the specified row of the result set forwards or backwards by an offset relative to its current position. - * A positive offset indicates moving backwards, and a negative offset indicates moving forwards. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param offset Indicates the offset relative to the current position. - * @return Returns true if the result set is moved successfully and does not go beyond the range; - * returns false otherwise. - */ - goTo(offset: number): boolean; - - /** - * Go to the specified row of the result set. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param position Indicates the index of the specified row, which starts from 1. - * @return Returns true if the result set is moved successfully; returns false otherwise. - */ - goToRow(position: number): boolean; - - /** - * Obtains the value of the specified column or key in the current row as a byte array. - * - * @note The implementation class determines whether to throw an exception if the value of the specified - * column or key in the current row is null or the specified column or key is not of the Blob type. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a byte array. - */ - getBlob(columnIndex: number): Uint8Array; - - /** - * Obtains the value of the specified column or key in the current row as string. - * - * @note The implementation class determines whether to throw an exception if the value of the specified - * column or key in the current row is null or the specified column or key is not of the string type. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a string. - */ - getString(columnIndex: number): string; - - /** - * Obtains the value of the specified column or key in the current row as long. - * - * @note The implementation class determines whether to throw an exception if the value of the specified - * column or key in the current row is null, the specified column or key is not of the long type. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a long. - */ - getLong(columnIndex: number): number; - - /** - * Obtains the value of the specified column or key in the current row as double. - * - * @note The implementation class determines whether to throw an exception if the value of the specified - * column or key in the current row is null, the specified column or key is not of the double type. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the value of the specified column or key as a double. - */ - getDouble(columnIndex: number): number; - - /** - * Closes the result set. - * - * @note Calling this method on the result set will release all of its resources and makes it ineffective. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @return Returns true if the result set is closed; returns false otherwise. - */ - close(): void; - - /** - * Obtains the column index or key index based on the specified column name or key name. - * - * @note The column name or key name is passed as an input parameter. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnName Indicates the name of the specified column or key in the result set. - * @return Returns the index of the specified column or key. - */ - getColumnIndex(columnName: string): number; - - /** - * Obtains the column name or key name based on the specified column index or key index. - * - * @note The column index or key index is passed as an input parameter. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnIndex Indicates the index of the specified column or key in the result set. - * @return Returns the name of the specified column or key. - */ - getColumnName(columnIndex: number): string; - - /** - * Obtains the dataType of the specified column or key. - * - * @note The implementation class determines whether to throw an exception if the value of the specified - * column or key in the current row is null, the specified column or key is not in the data type. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - * @param columnIndex Indicates the specified column index or key index, which starts from 0. - * @return Returns the dataType of the specified column or key. - */ - getDataType(columnIndex: number): DataType; -} \ No newline at end of file diff --git a/api/@ohos.data.ValuesBucket.d.ts b/api/@ohos.data.ValuesBucket.d.ts deleted file mode 100644 index 10727c1eec..0000000000 --- a/api/@ohos.data.ValuesBucket.d.ts +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Device Co., Ltd. - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Indicates possible value types - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ -export type ValueType = number | string | boolean; - -/** - * Values in buckets are stored in key-value pairs - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Core - */ -export type ValuesBucket = { - [key: string]: ValueType | Uint8Array | null; -} \ No newline at end of file diff --git a/api/@ohos.data.dataShare.d.ts b/api/@ohos.data.dataShare.d.ts deleted file mode 100644 index 74ea62fb38..0000000000 --- a/api/@ohos.data.dataShare.d.ts +++ /dev/null @@ -1,218 +0,0 @@ -/* -* Copyright (c) 2022 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import { AsyncCallback } from './basic'; -import Context from './application/Context'; -import DataShareResultSet from './@ohos.data.DataShareResultSet'; -import DataSharePredicates from './@ohos.data.DataSharePredicates'; -import { ValuesBucket } from './@ohos.data.ValuesBucket'; - -declare namespace dataShare { - /** - * Obtains the dataShareHelper. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param context Indicates the application context. - * @param uri Indicates the path of the file to open. - * @return Returns the dataShareHelper. - */ - function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback): void; - function createDataShareHelper(context: Context, uri: string): Promise; - - /** - * DataShareHelper - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @StageModelOnly - */ - interface DataShareHelper { - /** - * Opens a file in a specified remote path. - * - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the file to open. - * @param mode Indicates the file open mode, which can be "r" for read-only access, "w" for write-only access - * (erasing 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. - * @param callback Indicates the callback when openfile success - * @return Returns the file descriptor. - * @StageModelOnly - */ - openFile(uri: string, mode: string, callback: AsyncCallback): void; - openFile(uri: string, mode: string): Promise; - - /** - * Registers an observer to observe data specified by the given uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the callback when dataChange. - * @return - - * @StageModelOnly - */ - on(type: 'dataChange', uri: string, callback: AsyncCallback): void; - - /** - * Deregisters an observer used for monitoring data specified by the given uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param type dataChange. - * @param uri Indicates the path of the data to operate. - * @param callback Indicates the registered callback. - * @return - - * @StageModelOnly - */ - off(type: 'dataChange', uri: string, callback?: AsyncCallback): void; - - /** - * Inserts a single data record into the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param value Indicates the data record to insert. If this parameter is null, a blank row will be inserted. - * @return Returns the index of the inserted data record. - * @StageModelOnly - */ - insert(uri: string, value: ValuesBucket, callback: AsyncCallback): void; - insert(uri: string, value: ValuesBucket): Promise; - - /** - * Deletes one or more data records from the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @return Returns the number of data records deleted. - * @StageModelOnly - */ - delete(uri: string, predicates: DataSharePredicates, callback: AsyncCallback): void; - delete(uri: string, predicates: DataSharePredicates): Promise; - - /** - * Queries data in the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of data to query. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @param columns Indicates the columns to query. If this parameter is null, all columns are queried. - * @return Returns the query result. - * @StageModelOnly - */ - query(uri: string, predicates: DataSharePredicates, columns: Array, callback: AsyncCallback): void; - query(uri: string, predicates: DataSharePredicates, columns: Array): Promise; - - /** - * Updates data records in the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of data to update. - * @param predicates Indicates filter criteria. You should define the processing logic when this parameter is null. - * @param value Indicates the data to update. This parameter can be null. - * @return Returns the number of data records updated. - * @StageModelOnly - */ - update(uri: string, predicates: DataSharePredicates, value: ValuesBucket, callback: AsyncCallback): void; - update(uri: string, predicates: DataSharePredicates, value: ValuesBucket): Promise; - - /** - * Inserts multiple data records into the database. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @param values Indicates the data records to insert. - * @return Returns the number of data records inserted. - * @StageModelOnly - */ - batchInsert(uri: string, values: Array, callback: AsyncCallback): void; - batchInsert(uri: string, values: Array): Promise; - - /** - * Obtains the MIME type of the date specified by the given uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the data to operate. - * @return Returns the MIME type that matches the data specified by uri. - * @StageModelOnly - */ - getType(uri: string, callback: AsyncCallback): void; - getType(uri: string): Promise; - - /** - * Obtains the MIME types of files supported. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the path of the files to obtain. - * @param mimeTypeFilter Indicates the MIME types of the files to obtain. This parameter cannot be null. - *

1. "*/*": Obtains all types supported by Data abilities. - *

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 matched MIME types. If there is no match, {@code null} is returned. - * @StageModelOnly - */ - getFileTypes(uri: string, mimeTypeFilter:string, callback: AsyncCallback>): void; - getFileTypes(uri: string, mimeTypeFilter: string): Promise>; - - /** - * Converts the given {@code uri} that refers to the DataShare into a normalized {@link ohos.utils.net.Uri}. - * A normalized uri can be used across devices, persisted, backed up, and restored. - *

To transfer a normalized uri from another environment to the current environment, you should call this - * method again to re-normalize the uri for the current environment or call {@link #denormalizeUri(Uri)} - * to convert it to a denormalized uri that can be used only in the current environment. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to normalize. - * @return Returns the normalized {@code Uri} object if the DataShare supports uri normalization; - * returns {@code null} otherwise. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #denormalizeUri - * @StageModelOnly - */ - normalizeUri(uri: string, callback: AsyncCallback): void; - normalizeUri(uri: string): Promise; - - /** - * Converts the given normalized {@code uri} generated by {@link #normalizeUri(Uri)} into a denormalized one. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object 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 normalized {@code Uri} cannot be found in the current environment. - * @throws DataShareRemoteException Throws this exception if the remote process exits. - * @throws NullPointerException Throws this exception if {@code uri} is null. - * @see #normalizeUri - * @StageModelOnly - */ - denormalizeUri(uri: string, callback: AsyncCallback): void; - denormalizeUri(uri: string): Promise; - - /** - * Notifies the registered observers of a change to the data resource specified by Uri. - * @since 9 - * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer - * @param uri Indicates the {@link ohos.utils.net.Uri} object to notifyChange. - * @return - - * @StageModelOnly - */ - notifyChange(uri: string, callback: AsyncCallback): void; - notifyChange(uri: string): Promise; - } -} - -export default dataShare; -- Gitee