@@ -40,7 +40,7 @@ There are two roles in **DataShare**:
-**onCreate**
Called by the server to initialize service logic when the **DataShare** client connects to the **DataShareExtensionAbility** server. This method can be overridden as required.
Called by the server to initialize service logic when the **DataShare** client connects to the **DataShareExtensionAbility** server.
-**insert**
...
...
@@ -76,10 +76,7 @@ Before implementing a **DataShare** service, you need to create a **DataShareExt
2. Right-click the **DataShareAbility** directory, and choose **New > TypeScript File** to create a file named **DataShareAbility.ts**.
3. In the **DataShareAbility.ts** file, import the **DataShareExtensionAbility** dependency package. You can override the service implementation as required. For example, if the data provider provides only the services for inserting, deleting, and querying data, you can override **insert()**, **delete()**, and **query()** only.
4. Import dependencies.
3. In the **DataShareAbility.ts** file, import **DataShareExtensionAbility** and other dependencies.
5. Override **DataShareExtensionAbility** APIs based on actual requirements. For example, if the data provider provides only data query, override only **query()**.
4. Override **DataShareExtensionAbility** APIs based on actual requirements. For example, if the data provider provides only data query, override only **query()**.
6. Implement the data provider services. For example, implement data storage of the data provider by using a database, reading and writing files, or accessing the network.
5. Implement the data provider services. For example, implement data storage of the data provider by using a database, reading and writing files, or accessing the network.
```ts
constDB_NAME="DB00.db";
...
...
@@ -98,13 +95,13 @@ Before implementing a **DataShare** service, you need to create a **DataShareExt
constDDL_TBL_CREATE="CREATE TABLE IF NOT EXISTS "
+TBL_NAME
+" (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, isStudent BOOLEAN, Binary BINARY)";