1# Functions 2 3> **NOTE** 4> 5> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. 6 7## Module to Import 8 9```ts 10import { relationalStore } from '@kit.ArkData'; 11``` 12 13## relationalStore.getRdbStore 14 15getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<RdbStore>): void 16 17Obtains an RdbStore instance. You can set the **config** parameter as required and use **RdbStore** APIs to perform data operations. This API uses an asynchronous callback to return the result. 18 19If no database file exists in the corresponding sandbox directory, a database file is created. For details, see [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig). If a database file exists in the corresponding directory, the existing database file is opened. 20 21When creating a database, you should consider whether to configure the [encrypt](arkts-apis-data-relationalStore-i.md#storeconfig) parameter. Once the database is created, you are not allowed to change this parameter. 22 23| Encryption Type When the RDB Store Is Opened | Encryption Type When the RDB Store Is Created | Result| 24| ------- | -------------------------------- | ---- | 25| Non-encryption| Encryption | The RDB store is opened in encrypted mode. | 26| Encryption| Non-encryption | The RDB store is opened in non-encrypted mode. | 27 28Currently, **getRdbStore()** does not support multi-thread concurrent operations. 29 30**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 31 32**Parameters** 33 34| Name | Type | Mandatory| Description | 35| -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | 36| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 37| config | [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) | Yes | Configuration of the RDB store. | 38| callback | AsyncCallback<[RdbStore](arkts-apis-data-relationalStore-RdbStore.md)> | Yes | Callback invoked to return the RDB store obtained. | 39 40**Error codes** 41 42For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). To handle error 14800011, you can refer to [Database Backup and Restore](../../database/data-backup-and-restore.md). 43 44| **ID**| **Error Message** | 45|-----------|---------| 46| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 47| 14800000 | Inner error. | 48| 14800010 | Failed to open or delete the database by an invalid database path. | 49| 14800011 | Failed to open the database because it is corrupted. | 50| 14801001 | The operation is supported in the stage model only. | 51| 14801002 | Invalid data group ID. | 52| 14800017 | StoreConfig is changed. | 53| 14800020 | The secret key is corrupted or lost. | 54| 14800021 | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. | 55| 14800022 | SQLite: Callback routine requested an abort. | 56| 14800023 | SQLite: Access permission denied. | 57| 14800027 | SQLite: Attempt to write a readonly database. | 58| 14800028 | SQLite: Some kind of disk I/O error occurred. | 59| 14800029 | SQLite: The database is full. | 60| 14800030 | SQLite: Unable to open the database file. | 61 62**Example**: 63 64FA model: 65 66<!--code_no_check_fa--> 67```js 68import { featureAbility } from '@kit.AbilityKit'; 69import { BusinessError } from '@kit.BasicServicesKit'; 70 71let store: relationalStore.RdbStore | undefined = undefined; 72let context = featureAbility.getContext(); 73 74const STORE_CONFIG: relationalStore.StoreConfig = { 75 name: "RdbTest.db", 76 securityLevel: relationalStore.SecurityLevel.S3 77}; 78 79relationalStore.getRdbStore(context, STORE_CONFIG, async (err: BusinessError, rdbStore: relationalStore.RdbStore) => { 80 if (err) { 81 console.error(`Get RdbStore failed, code is ${err.code},message is ${err.message}`); 82 return; 83 } 84 console.info('Get RdbStore successfully.'); 85 store = rdbStore; 86 // Perform subsequent operations after the rdbStore instance is successfully obtained. 87}); 88``` 89 90Stage model: 91 92```ts 93import { UIAbility } from '@kit.AbilityKit'; 94import { window } from '@kit.ArkUI'; 95import { BusinessError } from '@kit.BasicServicesKit'; 96 97let store: relationalStore.RdbStore | undefined = undefined; 98 99class EntryAbility extends UIAbility { 100 onWindowStageCreate(windowStage: window.WindowStage) { 101 const STORE_CONFIG: relationalStore.StoreConfig = { 102 name: "RdbTest.db", 103 securityLevel: relationalStore.SecurityLevel.S3 104 }; 105 106 relationalStore.getRdbStore(this.context, STORE_CONFIG, async (err: BusinessError, rdbStore: relationalStore.RdbStore) => { 107 if (err) { 108 console.error(`Get RdbStore failed, code is ${err.code},message is ${err.message}`); 109 return; 110 } 111 console.info('Get RdbStore successfully.'); 112 store = rdbStore; 113 // Perform subsequent operations after the rdbStore instance is successfully obtained. 114 }); 115 } 116} 117``` 118 119## relationalStore.getRdbStore 120 121getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore> 122 123Obtains an RdbStore instance. You can set the **config** parameter as required and use **RdbStore** APIs to perform data operations. This API uses a promise to return the result. 124 125If no database file exists in the corresponding sandbox directory, a database file is created. For details, see [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig). If a database file exists in the corresponding directory, the existing database file is opened. 126 127When creating a database, you should consider whether to configure the [encrypt](arkts-apis-data-relationalStore-i.md#storeconfig) parameter. Once the database is created, you are not allowed to change this parameter. 128 129| Encryption Type When the RDB Store Is Opened | Encryption Type When the RDB Store Is Created | Result| 130| ------- | -------------------------------- | ---- | 131| Non-encryption| Encryption | The RDB store is opened in encrypted mode. | 132| Encryption| Non-encryption | The RDB store is opened in non-encrypted mode. | 133 134Currently, **getRdbStore()** does not support multi-thread concurrent operations. 135 136**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 137 138**Parameters** 139 140| Name | Type | Mandatory| Description | 141| ------- | -------------------------------- | ---- | ------------------------------------------------------------ | 142| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 143| config | [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) | Yes | Configuration of the RDB store. | 144 145**Return value** 146 147| Type | Description | 148| ----------------------------------------- | --------------------------------- | 149| Promise<[RdbStore](arkts-apis-data-relationalStore-RdbStore.md)> | Promise used to return the **RdbStore** object.| 150 151**Error codes** 152 153For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). To handle error 14800011, you can refer to [Database Backup and Restore](../../database/data-backup-and-restore.md). 154 155| **ID**| **Error Message** | 156|-----------| ------------------------------------------------------------ | 157| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 158| 14800000 | Inner error. | 159| 14800010 | Failed to open or delete the database by an invalid database path. | 160| 14800011 | Failed to open the database because it is corrupted. | 161| 14801001 | The operation is supported in the stage model only. | 162| 14801002 | Invalid data group ID. | 163| 14800017 | StoreConfig is changed. | 164| 14800020 | The secret key is corrupted or lost. | 165| 14800021 | SQLite: Generic error. Possible causes: Insert failed or the updated data does not exist. | 166| 14800022 | SQLite: Callback routine requested an abort. | 167| 14800023 | SQLite: Access permission denied. | 168| 14800027 | SQLite: Attempt to write a readonly database. | 169| 14800028 | SQLite: Some kind of disk I/O error occurred. | 170| 14800029 | SQLite: The database is full. | 171| 14800030 | SQLite: Unable to open the database file. | 172 173**Example**: 174 175FA model: 176 177<!--code_no_check_fa--> 178```js 179import { featureAbility } from '@kit.AbilityKit'; 180import { BusinessError } from '@kit.BasicServicesKit'; 181 182let store: relationalStore.RdbStore | undefined = undefined; 183let context = featureAbility.getContext(); 184 185const STORE_CONFIG: relationalStore.StoreConfig = { 186 name: "RdbTest.db", 187 securityLevel: relationalStore.SecurityLevel.S3 188}; 189 190relationalStore.getRdbStore(context, STORE_CONFIG).then(async (rdbStore: relationalStore.RdbStore) => { 191 store = rdbStore; 192 console.info('Get RdbStore successfully.'); 193}).catch((err: BusinessError) => { 194 console.error(`Get RdbStore failed, code is ${err.code},message is ${err.message}`); 195}); 196``` 197 198Stage model: 199 200```ts 201import { UIAbility } from '@kit.AbilityKit'; 202import { window } from '@kit.ArkUI'; 203import { BusinessError } from '@kit.BasicServicesKit'; 204 205let store: relationalStore.RdbStore | undefined = undefined; 206 207class EntryAbility extends UIAbility { 208 onWindowStageCreate(windowStage: window.WindowStage) { 209 const STORE_CONFIG: relationalStore.StoreConfig = { 210 name: "RdbTest.db", 211 securityLevel: relationalStore.SecurityLevel.S3 212 }; 213 214 relationalStore.getRdbStore(this.context, STORE_CONFIG).then(async (rdbStore: relationalStore.RdbStore) => { 215 store = rdbStore; 216 console.info('Get RdbStore successfully.'); 217 }).catch((err: BusinessError) => { 218 console.error(`Get RdbStore failed, code is ${err.code},message is ${err.message}`); 219 }); 220 } 221} 222``` 223 224## relationalStore.deleteRdbStore 225 226deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void 227 228Deletes an RDB store. This API uses an asynchronous callback to return the result. 229 230After the deletion, you are advised to set the database object to null. If a custom path is set in [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) when an RDB store is created, using this API cannot delete the RDB store. Use [deleteRdbStore](#relationalstoredeleterdbstore10) instead. 231 232Before calling **deleteRdbStore**, ensure that the **RdbStore** and **ResultSet** of the vector store have been closed. 233 234**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 235 236**Parameters** 237 238| Name | Type | Mandatory| Description | 239| -------- | ------------------------- | ---- | ------------------------------------------------------------ | 240| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 241| name | string | Yes | Name of the RDB store to delete. | 242| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | 243 244**Error codes** 245 246For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). 247 248| **ID**| **Error Message** | 249|-----------|---------------------------------------| 250| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 251| 14800000 | Inner error. | 252| 14800010 | Failed to open or delete the database by an invalid database path. | 253 254**Example**: 255 256FA model: 257 258<!--code_no_check_fa--> 259```js 260import { featureAbility } from '@kit.AbilityKit'; 261import { BusinessError } from '@kit.BasicServicesKit'; 262 263let context = featureAbility.getContext(); 264 265relationalStore.deleteRdbStore(context, "RdbTest.db", (err: BusinessError) => { 266 if (err) { 267 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 268 return; 269 } 270 // After the database is deleted, the initialized RdbStore instance cannot be used. 271 // Clear the related variables to release resources in time. 272 console.info('Delete RdbStore successfully.'); 273}); 274``` 275 276Stage model: 277 278```ts 279import { UIAbility } from '@kit.AbilityKit'; 280import { window } from '@kit.ArkUI'; 281import { BusinessError } from '@kit.BasicServicesKit'; 282 283class EntryAbility extends UIAbility { 284 onWindowStageCreate(windowStage: window.WindowStage) { 285 relationalStore.deleteRdbStore(this.context, "RdbTest.db", (err: BusinessError) => { 286 if (err) { 287 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 288 return; 289 } 290 // After the database is deleted, the initialized RdbStore instance cannot be used. 291 // Clear the related variables to release resources in time. 292 console.info('Delete RdbStore successfully.'); 293 }); 294 } 295} 296``` 297 298## relationalStore.deleteRdbStore 299 300deleteRdbStore(context: Context, name: string): Promise<void> 301 302Deletes an RDB store. This API uses a promise to return the result. 303 304After the deletion, you are advised to set the database object to null. If a custom path is set in [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) when an RDB store is created, using this API cannot delete the RDB store. Use [deleteRdbStore](#relationalstoredeleterdbstore10-1) instead. 305 306Before calling **deleteRdbStore**, ensure that the **RdbStore** and **ResultSet** of the vector store have been closed. 307 308**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 309 310**Parameters** 311 312| Name | Type | Mandatory| Description | 313| ------- | ------- | ---- | ------------------------------------------------------------ | 314| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 315| name | string | Yes | Name of the RDB store to delete. | 316 317**Return value** 318 319| Type | Description | 320| ------------------- | ------------------------- | 321| Promise<void> | Promise that returns no value.| 322 323**Error codes** 324 325For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). 326 327| **ID**| **Error Message** | 328|-----------|----------------------------------------------------------------------------------| 329| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 330| 14800000 | Inner error. | 331| 14800010 | Failed to open or delete the database by an invalid database path. | 332 333**Example**: 334 335FA model: 336 337<!--code_no_check_fa--> 338```js 339import { featureAbility } from '@kit.AbilityKit'; 340import { BusinessError } from '@kit.BasicServicesKit'; 341 342let context = featureAbility.getContext(); 343 344relationalStore.deleteRdbStore(context, "RdbTest.db").then(() => { 345 // After the database is deleted, the initialized RdbStore instance cannot be used. 346 // Clear the related variables to release resources in time. 347 console.info('Delete RdbStore successfully.'); 348}).catch((err: BusinessError) => { 349 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 350}); 351``` 352 353Stage model: 354 355```ts 356import { UIAbility } from '@kit.AbilityKit'; 357import { window } from '@kit.ArkUI'; 358import { BusinessError } from '@kit.BasicServicesKit'; 359 360class EntryAbility extends UIAbility { 361 onWindowStageCreate(windowStage: window.WindowStage) { 362 relationalStore.deleteRdbStore(this.context, "RdbTest.db").then(() => { 363 // After the database is deleted, the initialized RdbStore instance cannot be used. 364 // Clear the related variables to release resources in time. 365 console.info('Delete RdbStore successfully.'); 366 }).catch((err: BusinessError) => { 367 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 368 }); 369 } 370} 371``` 372 373## relationalStore.deleteRdbStore<sup>10+</sup> 374 375deleteRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback\<void>): void 376 377Deletes an RDB store. This API uses an asynchronous callback to return the result. 378 379After the deletion, you are advised to set the database object to null. If the database file is stored in the sandbox directory, use this API to delete the database. If multiple processes operate the same database, other processes should be notified about the database deletion so that they can detect and process the deletion. If a custom path is set in [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) during RDB store creation, using this API to delete the RDB store. 380 381Before calling **deleteRdbStore**, ensure that the **RdbStore** and **ResultSet** of the vector store have been closed. 382 383**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 384 385**Parameters** 386 387| Name | Type | Mandatory| Description | 388| -------- | --------------------------- | ---- | ------------------------------------------------------------ | 389| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 390| config | [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) | Yes | Configuration of the RDB store. | 391| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | 392 393**Error codes** 394 395For details about the error codes, see [Universal Error Codes](../errorcode-universal.md) and [RDB Store Error Codes](errorcode-data-rdb.md). 396 397| **ID**| **Error Message** | 398|-----------|----------| 399| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 400| 14800000 | Inner error. | 401| 14800010 | Failed to open or delete the database by an invalid database path. | 402| 14801001 | The operation is supported in the stage model only. | 403| 14801002 | Invalid data group ID. | 404 405**Example**: 406 407FA model: 408 409<!--code_no_check_fa--> 410```js 411import { featureAbility } from '@kit.AbilityKit'; 412import { BusinessError } from '@kit.BasicServicesKit'; 413 414let context = featureAbility.getContext(); 415 416const STORE_CONFIG: relationalStore.StoreConfig = { 417 name: "RdbTest.db", 418 securityLevel: relationalStore.SecurityLevel.S3 419}; 420 421relationalStore.deleteRdbStore(context, STORE_CONFIG, (err: BusinessError) => { 422 if (err) { 423 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 424 return; 425 } 426 // After the database is deleted, the initialized RdbStore instance cannot be used. 427 // Clear the related variables to release resources in time. 428 console.info('Delete RdbStore successfully.'); 429}); 430``` 431 432Stage model: 433 434```ts 435import { UIAbility } from '@kit.AbilityKit'; 436import { window } from '@kit.ArkUI'; 437import { BusinessError } from '@kit.BasicServicesKit'; 438 439class EntryAbility extends UIAbility { 440 onWindowStageCreate(windowStage: window.WindowStage) { 441 const STORE_CONFIG: relationalStore.StoreConfig = { 442 name: "RdbTest.db", 443 securityLevel: relationalStore.SecurityLevel.S3 444 }; 445 relationalStore.deleteRdbStore(this.context, STORE_CONFIG, (err: BusinessError) => { 446 if (err) { 447 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 448 return; 449 } 450 // After the database is deleted, the initialized RdbStore instance cannot be used. 451 // Clear the related variables to release resources in time. 452 console.info('Delete RdbStore successfully.'); 453 }); 454 } 455} 456``` 457 458## relationalStore.deleteRdbStore<sup>10+</sup> 459 460deleteRdbStore(context: Context, config: StoreConfig): Promise\<void> 461 462Deletes an RDB store. This API uses a promise to return the result. 463 464After the deletion, you are advised to set the database object to null. If the database file is stored in the sandbox directory, use this API to delete the database. If multiple processes operate the same database, other processes should be notified about the database deletion so that they can detect and process the deletion. If a custom path is set in [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) during RDB store creation, using this API to delete the RDB store. 465 466Before calling **deleteRdbStore**, ensure that the **RdbStore** and **ResultSet** of the vector store have been closed. 467 468**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 469 470**Parameters** 471 472| Name | Type | Mandatory| Description | 473| ------- | --------------------------- | ---- | ------------------------------------------------------------ | 474| context | Context | Yes | Application context.<br>For details about the application context of the FA model, see [Context](../apis-ability-kit/js-apis-inner-app-context.md).<br>For details about the application context of the stage model, see [Context](../apis-ability-kit/js-apis-inner-application-uiAbilityContext.md).| 475| config | [StoreConfig](arkts-apis-data-relationalStore-i.md#storeconfig) | Yes | Configuration of the RDB store. | 476 477**Return value** 478 479| Type | Description | 480| ------------------- | ------------------------- | 481| Promise<void> | Promise that returns no value.| 482 483**Error codes** 484 485For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). 486 487| **ID**| **Error Message** | 488|-----------|---------------------| 489| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 490| 801 | Capability not supported. | 491| 14800000 | Inner error. | 492| 14800010 | Failed to open or delete the database by an invalid database path. | 493| 14801001 | The operation is supported in the stage model only. | 494| 14801002 | Invalid data group ID. | 495 496**Example**: 497 498FA model: 499 500<!--code_no_check_fa--> 501```js 502import { featureAbility } from "@kit.AbilityKit"; 503import { BusinessError } from '@kit.BasicServicesKit'; 504 505let context = featureAbility.getContext(); 506 507const STORE_CONFIG: relationalStore.StoreConfig = { 508 name: "RdbTest.db", 509 securityLevel: relationalStore.SecurityLevel.S3 510}; 511 512relationalStore.deleteRdbStore(context, STORE_CONFIG).then(() => { 513 // After the database is deleted, the initialized RdbStore instance cannot be used. 514 // Clear the related variables to release resources in time. 515 console.info('Delete RdbStore successfully.'); 516}).catch((err: BusinessError) => { 517 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 518}); 519``` 520 521Stage model: 522 523```ts 524import { UIAbility } from '@kit.AbilityKit'; 525import { window } from '@kit.ArkUI'; 526import { BusinessError } from '@kit.BasicServicesKit'; 527 528class EntryAbility extends UIAbility { 529 onWindowStageCreate(windowStage: window.WindowStage) { 530 const STORE_CONFIG: relationalStore.StoreConfig = { 531 name: "RdbTest.db", 532 securityLevel: relationalStore.SecurityLevel.S3 533 }; 534 relationalStore.deleteRdbStore(this.context, STORE_CONFIG).then(() => { 535 // After the database is deleted, the initialized RdbStore instance cannot be used. 536 // Clear the related variables to release resources in time. 537 console.info('Delete RdbStore successfully.'); 538 }).catch((err: BusinessError) => { 539 console.error(`Delete RdbStore failed, code is ${err.code},message is ${err.message}`); 540 }); 541 } 542} 543``` 544## relationalStore.isVectorSupported<sup>18+</sup> 545 546isVectorSupported(): boolean 547 548Checks whether the system supports vector stores. 549 550**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 551 552**Return value** 553 554| Type | Description | 555| ------- | ------------------------------------------------- | 556| boolean | Returns **true** if the system supports vector stores; returns **false** otherwise.| 557 558**Example**: 559 560``` 561let result = relationalStore.isVectorSupported(); 562``` 563 564## relationalStore.isTokenizerSupported<sup>18+</sup> 565 566isTokenizerSupported(tokenizer: Tokenizer): boolean 567 568Checks whether the specified tokenizer is supported. This API returns the result synchronously. 569 570This API returns **true** if the specified tokenizer is supported; returns **false** otherwise. 571 572**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 573 574**Parameters** 575 576| Name | Type | Mandatory| Description | 577| ------- | --------------------- | ---- | ------------------------------------------------------------ | 578| tokenizer | [Tokenizer](arkts-apis-data-relationalStore-e.md#tokenizer17) | Yes | Tokenizer to check.| 579 580**Return Value** 581 582| Type | Description | 583| ------------------- | ------------------------- | 584| boolean | Returns **true** if the specified tokenizer is supported; returns **false** otherwise.| 585 586**Error codes** 587 588For details about the error codes, see [Universal Error Codes](../errorcode-universal.md). 589 590| **ID**| **Error Message** | 591|-----------|---------------------| 592| 401 | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2. Incorrect parameter types; 3. Parameter verification failed. | 593 594 595**Example**: 596 597```ts 598import { relationalStore } from '@kit.ArkData'; // Import the relationalStore module. 599 600let customType = relationalStore.Tokenizer.CUSTOM_TOKENIZER; 601let customTypeSupported = relationalStore.isTokenizerSupported(customType); 602console.info("custom tokenizer supported on current platform: " + customTypeSupported); 603``` 604 605## relationalStore.getInsertSqlInfo<sup>20+</sup> 606 607getInsertSqlInfo(table: string, values: ValuesBucket, conflict?: ConflictResolution): SqlInfo 608 609Obtains the SQL statement used to insert data. This API returns the result synchronously. 610 611**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 612 613**Parameters** 614 615| Name | Type | Mandatory| Description | 616| ------- | --------------------- | ---- | ------------------------------------------------------------ | 617| table | string | Yes | Name of the database table to which data is to be written.| 618| values | [ValuesBucket](arkts-apis-data-relationalStore-t.md#valuesbucket) | Yes| Field information and corresponding values of the data to be written to the database.| 619| conflict | [ConflictResolution](arkts-apis-data-relationalStore-e.md#conflictresolution10) | No|Resolution used to resolve the conflict. <br>Default value: **relationalStore.ConflictResolution.ON_CONFLICT_NONE**.| 620 621**Return Value** 622 623| Type | Description | 624| ------------------- | ------------------------- | 625| [SqlInfo](arkts-apis-data-relationalStore-i.md#sqlinfo20) | **SqlInfo** object. **sql** indicates the returned SQL statement, and **args** indicates the parameters in the executed SQL statement.| 626 627**Error codes** 628 629For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). 630 631| **ID**| **Error Message** | 632|-----------|---------------------| 633| 14800001 | Invalid arguments. Possible causes: 1. Parameter is out of valid range. | 634 635 636**Example**: 637 638```ts 639import { relationalStore } from '@kit.ArkData'; // Import the relationalStore module. 640const bucket: relationalStore.ValuesBucket = { 641 name: "Logitech", 642 age: 18, 643 sex: "man", 644 desc: "asserter" 645}; 646const sqlInfo: relationalStore.SqlInfo = relationalStore.getInsertSqlInfo( 647 "USER", 648 bucket, 649 relationalStore.ConflictResolution.ON_CONFLICT_NONE 650); 651``` 652 653## relationalStore.getUpdateSqlInfo<sup>20+</sup> 654 655getUpdateSqlInfo(predicates: RdbPredicates, values: ValuesBucket, conflict?: ConflictResolution): SqlInfo 656 657Obtains the SQL statement used to update data. This API returns the result synchronously. 658 659**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 660 661**Parameters** 662 663| Name | Type | Mandatory| Description | 664| ------- | --------------------- | ---- | ------------------------------------------------------------ | 665| predicates | [RdbPredicates](arkts-apis-data-relationalStore-RdbPredicates.md) | Yes | **RdbPredicates** object that matches the specified field.| 666| values | [ValuesBucket](arkts-apis-data-relationalStore-t.md#valuesbucket) | Yes| Field information and corresponding values of the data to be written to the database.| 667| conflict | [ConflictResolution](arkts-apis-data-relationalStore-e.md#conflictresolution10) | No| Resolution used to resolve the conflict. <br>Default value: **relationalStore.ConflictResolution.ON_CONFLICT_NONE**.| 668 669**Return Value** 670 671| Type | Description | 672| ------------------- | ------------------------- | 673| [SqlInfo](arkts-apis-data-relationalStore-i.md#sqlinfo20) | **SqlInfo** object. **sql** indicates the returned SQL statement, and **args** indicates the parameters in the executed SQL statement.| 674 675**Error codes** 676 677For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). 678 679| **ID**| **Error Message** | 680|-----------|---------------------| 681| 14800001 | Invalid arguments. Possible causes: 1. Parameter is out of valid range. | 682 683 684**Example**: 685 686```ts 687import { relationalStore } from '@kit.ArkData'; // Import the relationalStore module. 688 689const bucket: relationalStore.ValuesBucket = { 690 name: "Logitech", 691 age: 18, 692 sex: "man", 693 desc: "asserter" 694}; 695const predicates = new relationalStore.RdbPredicates("users"); 696const sqlInfo: relationalStore.SqlInfo = relationalStore.getUpdateSqlInfo( 697 predicates, 698 bucket, 699 relationalStore.ConflictResolution.ON_CONFLICT_NONE 700); 701``` 702 703## relationalStore.getDeleteSqlInfo<sup>20+</sup> 704 705getDeleteSqlInfo(predicates: RdbPredicates): SqlInfo 706 707Obtains the SQL statement used to delete data. This API returns the result synchronously. 708 709**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 710 711**Parameters** 712 713| Name | Type | Mandatory| Description | 714| ------- | --------------------- | ---- | ------------------------------------------------------------ | 715| predicates | [RdbPredicates](arkts-apis-data-relationalStore-RdbPredicates.md) | Yes | **RdbPredicates** object that matches the specified field.| 716 717**Return Value** 718 719| Type | Description | 720| ------------------- | ------------------------- | 721| [SqlInfo](arkts-apis-data-relationalStore-i.md#sqlinfo20) | **SqlInfo** object. **sql** indicates the returned SQL statement, and **args** indicates the parameters in the executed SQL statement.| 722 723**Error codes** 724 725For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). 726 727| **ID**| **Error Message** | 728|-----------|---------------------| 729| 14800001 | Invalid arguments. Possible causes: 1. Parameter is out of valid range. | 730 731 732**Example**: 733 734```ts 735import { relationalStore } from '@kit.ArkData'; // Import the relationalStore module. 736 737const predicates = new relationalStore.RdbPredicates("users"); 738predicates.equalTo("tableName", "a"); 739predicates.notEqualTo("age", 18); 740const sqlInfo: relationalStore.SqlInfo = relationalStore.getDeleteSqlInfo(predicates); 741``` 742 743## relationalStore.getQuerySqlInfo<sup>20+</sup> 744 745getQuerySqlInfo(predicates: RdbPredicates, columns?: Array\<string>): SqlInfo 746 747Obtains the SQL statement used to query data. This API returns the result synchronously. 748 749**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core 750 751**Parameters** 752 753| Name | Type | Mandatory| Description | 754| ------- | --------------------- | ---- | ------------------------------------------------------------ | 755| predicates | [RdbPredicates](arkts-apis-data-relationalStore-RdbPredicates.md) | Yes | **RdbPredicates** object that matches the specified field.| 756| columns | Array\<string> | No| Columns to be queried. If this parameter is not specified, all columns are queried.| 757 758**Return Value** 759 760| Type | Description | 761| ------------------- | ------------------------- | 762| [SqlInfo](arkts-apis-data-relationalStore-i.md#sqlinfo20) | **SqlInfo** object. **sql** indicates the returned SQL statement, and **args** indicates the parameters in the executed SQL statement.| 763 764**Error codes** 765 766For details about the error codes, see [RDB Error Codes](errorcode-data-rdb.md). 767 768| **ID**| **Error Message** | 769|-----------|---------------------| 770| 14800001 | Invalid arguments. Possible causes: 1. Parameter is out of valid range. | 771 772 773**Example**: 774 775```ts 776import { relationalStore } from '@kit.ArkData'; // Import the relationalStore module. 777 778const predicates = new relationalStore.RdbPredicates("users"); 779predicates.notEqualTo("age", 18); 780predicates.equalTo("name", "zhangsan"); 781const sqlInfo: relationalStore.SqlInfo = relationalStore.getQuerySqlInfo(predicates); 782``` 783