api errorcode

Signed-off-by: niudongyao <niudongyao@huawei.com>
This commit is contained in:
niudongyao 2022-10-11 14:56:48 +08:00
parent e427636324
commit cff61e02de
2 changed files with 185 additions and 50 deletions

68
.idea/workspace.xml generated Normal file
View File

@ -0,0 +1,68 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CMakeSettings">
<configurations>
<configuration PROFILE_NAME="Debug" CONFIG_NAME="Debug" ENABLED="true" />
</configurations>
</component>
<component name="ChangeListManager">
<list default="true" id="e1b73cb8-c7ae-4bb5-8745-c153fd356c6d" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/api/@ohos.data.dataShare.d.ts" beforeDir="false" afterPath="$PROJECT_DIR$/api/@ohos.data.dataShare.d.ts" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
<option name="LAST_RESOLUTION" value="IGNORE" />
</component>
<component name="ClangdSettings">
<option name="formatViaClangd" value="false" />
</component>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
</component>
<component name="ProjectId" id="2FQwOaDyAhzPpgj0FY1KHvdmkkh" />
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true" />
<option name="showLibraryContents" value="true" />
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
<property name="WebServerToolWindowFactoryState" value="false" />
<property name="cf.first.check.clang-format" value="false" />
<property name="cidr.known.project.marker" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="ts.external.directory.path" value="$APPLICATION_HOME_DIR$/plugins/JavaScriptLanguage/jsLanguageServicesImpl/external" />
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
<component name="TaskManager">
<task active="true" id="Default" summary="Default task">
<changelist id="e1b73cb8-c7ae-4bb5-8745-c153fd356c6d" name="Default Changelist" comment="" />
<created>1664437584931</created>
<option name="number" value="Default" />
<option name="presentableId" value="Default" />
<updated>1664437584931</updated>
<workItem from="1664437586434" duration="1359000" />
<workItem from="1665296087539" duration="1698000" />
<workItem from="1665366599448" duration="4251000" />
</task>
<servers />
</component>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3" />
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State />
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true" />
</component>
</project>

View File

@ -22,129 +22,196 @@ import { ValuesBucket } from './@ohos.data.ValuesBucket';
declare namespace dataShare { declare namespace dataShare {
/** /**
* Obtains the dataShareHelper. * Obtains the dataShareHelper.
* @since 9 * @param { context } Context - Indicates the application context.
* @param { uri } string - Indicates the path of the file to open.
* @param { AsyncCallback<DataShareHelper> } callback - the dataShareHelper.
* @throws { BusinessError } 401 - the parameter check failed.
* @throws { BusinessError } 15700010 - the DataShareHelper is not initialized successfully.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @param context Indicates the application context.
* @param uri Indicates the path of the file to open.
* @return Returns the dataShareHelper.
* @throws {BusinessError} if process failed
* @errorcode 157000010
* @errorcode 401
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void; function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void;
/**
* Obtains the dataShareHelper.
* @param { context } Context - Indicates the application context.
* @param { uri } string - Indicates the path of the file to open.
* @returns { Promise<DataShareHelper> } the dataShareHelper.
* @throws { BusinessError } 401 - the parameter check failed.
* @throws { BusinessError } 15700010 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi
* @StageModelOnly
* @since 9
*/
function createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper>; function createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper>;
/** /**
* DataShareHelper * DataShareHelper
* @since 9
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
interface DataShareHelper { interface DataShareHelper {
/** /**
* Registers an observer to observe data specified by the given uri. * Registers an observer to observe data specified by the given uri.
* @since 9 * @param { type } 'dataChange' - dataChange.
* @param { uri } string - Indicates the path of the data to operate.
* @param { AsyncCallback<void> } callback - Indicates the callback when dataChange.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @param type dataChange.
* @param uri Indicates the path of the data to operate.
* @param callback Indicates the callback when dataChange.
* @return -
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void; on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void;
/** /**
* Deregisters an observer used for monitoring data specified by the given uri. * Deregisters an observer used for monitoring data specified by the given uri.
* @since 9 * @param { type } 'dataChange' - dataChange.
* @param { uri } string - Indicates the path of the data to operate.
* @param { AsyncCallback<void> } callback - Indicates the callback when dataChange.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @param type dataChange.
* @param uri Indicates the path of the data to operate.
* @param callback Indicates the registered callback.
* @return -
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void; off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void;
/** /**
* Inserts a single data record into the database. * Inserts a single data record into the database.
* @since 9 * @param { uri } string - Indicates the path of the data to operate.
* @param { value } ValueBucket - Indicates the data record to insert. If this parameter is null, a blank row will be inserted.
* @param { AsyncCallback<number> } callback - the index of the inserted data record.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @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.
* @throws {BusinessError} if process failed
* @errorcode 401
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void; insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void;
/**
* Inserts a single data record into the database.
* @param { uri } string - Indicates the path of the data to operate.
* @param { value } ValueBucket - Indicates the data record to insert. If this parameter is null, a blank row will be inserted.
* @returns { Promise<number> } the index of the inserted data record.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi
* @StageModelOnly
* @since 9
*/
insert(uri: string, value: ValuesBucket): Promise<number>; insert(uri: string, value: ValuesBucket): Promise<number>;
/** /**
* Deletes one or more data records from the database. * Deletes one or more data records from the database.
* @since 9 * @param { uri } string - Indicates the path of the data to operate.
* @param { predicates } dataSharePredicates.DataSharePredicates - Indicates filter criteria. You should define the processing logic when this parameter is null.
* @param { AsyncCallback<number> } callback - the number of data records deleted.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @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.
* @throws {BusinessError} if process failed
* @errorcode 401
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void; delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void;
/**
* Deletes one or more data records from the database.
* @param { uri } string - Indicates the path of the data to operate.
* @param { predicates } dataSharePredicates.DataSharePredicates - Indicates filter criteria. You should define the processing logic when this parameter is null.
* @returns { Promise<number> } the number of data records deleted.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi
* @StageModelOnly
* @since 9
*/
delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number>; delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number>;
/** /**
* Queries data in the database. * Queries data in the database.
* @since 9 * @param { uri } string - Indicates the path of data to query.
* @param { predicates } dataSharePredicates.DataSharePredicates - Indicates filter criteria. You should define the processing logic when this parameter is null.
* @param { columns } Array<string> - Indicates the columns to query. If this parameter is null, all columns are queried.
* @param { AsyncCallback<DataShareResultSet> } callback - the query result.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @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.
* @throws {BusinessError} if process failed
* @errorcode 401
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<DataShareResultSet>): void; query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<DataShareResultSet>): void;
/**
* Queries data in the database.
* @param { uri } string - Indicates the path of data to query.
* @param { predicates } dataSharePredicates.DataSharePredicates - Indicates filter criteria. You should define the processing logic when this parameter is null.
* @param { columns } Array<string> - Indicates the columns to query. If this parameter is null, all columns are queried.
* @returns { Promise<DataShareResultSet> } - the query result.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi
* @StageModelOnly
* @since 9
*/
query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>): Promise<DataShareResultSet>; query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>): Promise<DataShareResultSet>;
/** /**
* Updates data records in the database. * Updates data records in the database.
* @since 9 * @param { uri } string - Indicates the path of data to update.
* @param { predicates } dataSharePredicates.DataSharePredicates - Indicates filter criteria. You should define the processing logic when this parameter is null.
* @param { value } ValueBucket - Indicates the data to update. This parameter can be null.
* @param { AsyncCallback<number> } callback - the number of data records updated.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @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.
* @throws {BusinessError} if process failed
* @errorcode 401
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): void; update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): void;
/**
* Updates data records in the database.
* @param { uri } string - Indicates the path of data to update.
* @param { predicates } dataSharePredicates.DataSharePredicates - Indicates filter criteria. You should define the processing logic when this parameter is null.
* @param { value } ValueBucket - Indicates the data to update. This parameter can be null.
* @returns { Promise<number> } the number of data records updated.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi
* @StageModelOnly
* @since 9
*/
update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number>; update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number>;
/** /**
* Inserts multiple data records into the database. * Inserts multiple data records into the database.
* @since 9 * @param { uri } string - Indicates the path of the data to operate.
* @param { values } Array<ValuesBucket> - Indicates the data records to insert.
* @param { AsyncCallback<number> } callback - the number of data records inserted.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer * @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi * @systemapi
* @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.
* @throws {BusinessError} if process failed
* @errorcode 401
* @StageModelOnly * @StageModelOnly
* @since 9
*/ */
batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void; batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void;
/**
* Inserts multiple data records into the database.
* @param { uri } string - Indicates the path of the data to operate.
* @param { values } Array<ValuesBucket> - Indicates the data records to insert.
* @returns { Promise<number> } the number of data records inserted.
* @throws { BusinessError } 401 - the parameter check failed.
* @syscap SystemCapability.DistributedDataManager.DataShare.Consumer
* @systemapi
* @StageModelOnly
* @since 9
*/
batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number>; batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number>;
/** /**