1# Distributed Data Management Changelog 2 3## cl.relationalStore.1 Change in the Return Value of getRow or getValue for an Empty Uint8Array 4 5**Access Level** 6 7Public API 8 9**Reason for Change** 10 11When an empty (zero-length) Uint8Array is inserted into a column of the BLOB type, **null** will be written to the database. When **getRow()** or **getValue()** is called, the value obtained does not match the value inserted. 12 13**Change Impact** 14 15This change is a non-compatible change. 16 17Before the change:<br>If an empty Uint8Array is inserted into a column of the BLOB type, calling **getRow**/**getValue** will return **null**. 18 19After the change:<br>If an empty Uint8Array is inserted into a column of the BLOB type, calling **getRow**/**getValue** will return an empty Uint8Array. 20 21**Start API Level** 22 23| API| Start API Level| 24| -------- | -------------- | 25| getRow | API 11 | 26| getValue | API 12 | 27 28**Change Since** 29 30OpenHarmony SDK 5.0.0.46 31 32**Key API/Component Changes** 33 34**getRow** in @ohos.data.relationalStore.d.ts. 35**getValue** in @ohos.data.relationalStore.d.ts. 36 37**Adaptation Guide** 38 39After the change, the interface invoking mode remains unchanged. The value returned by **getRow()** or **getValue()** changes. 40```ts 41import { relationalStore } from '@kit.ArkData'; 42import { BusinessError } from '@kit.BasicServicesKit'; 43import { UIAbility } from '@kit.AbilityKit'; 44import { window } from '@kit.ArkUI'; 45 46const STORE_CONFIG: relationalStore.StoreConfig = { 47 name: "RdbTest.db", 48 securityLevel: relationalStore.SecurityLevel.S3 49}; 50const CREATE_TABLE_TEST = 51 "CREATE TABLE IF NOT EXISTS EMPLOYEE (id INTEGER PRIMARY KEY AUTOINCREMENT,name TEXT NOT NULL, age INTEGER, salary REAL, blobType BLOB)"; 52 53let store: relationalStore.RdbStore | undefined = undefined; 54relationalStore.getRdbStore(this.context, STORE_CONFIG, (err: BusinessError, rdbStore: relationalStore.RdbStore) => { 55 store = rdbStore; 56 store.executeSql(CREATE_TABLE_TEST); 57 if (err) { 58 console.error(`Get RdbStore failed, code is ${err.code},message is ${err.message}`); 59 return; 60 } 61 console.info('Get RdbStore successfully.'); 62}) 63// Insert a Uint8Array whose length is 0 into ValuesBucket of the blob type, and obtain the data. 64let resultSet: relationalStore.ResultSet | undefined = undefined; 65let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); 66if (store != undefined) { 67 (store as relationalStore.RdbStore).query(predicates).then((result: relationalStore.ResultSet) => { 68 resultSet = result; 69 }); 70} 71if (resultSet != undefined) { 72 // blobType is the name of the column whose data type is blob. 73 const codes = (resultSet as relationalStore.ResultSet).getValue((resultSet as relationalStore.ResultSet).getColumnIndex("blobType")); 74} 75// Before the change, the value of codes is null. 76// After the change, the value of codes is an empty Uint8Array. 77 78if (resultSet != undefined) { 79 const row = (resultSet as relationalStore.ResultSet).getRow(); 80} 81// Before the change, row.blobType is null. 82// After the change, row.blobType is an empty Uint8Array. 83``` 84