1# Distributed Data Management Changelog 2 3## cl.distributeddatamgr.1 Change of ValuesBucket to a Public Interface 4 5**Change Impact** 6 7For applications developed based on earlier versions, only system applications can use **ValuesBucket**. From this version, **ValuesBucket** can be called by third-party applications. 8 9**Key API/Component Changes** 10 11Before change: 12 13```ts 14 /** 15 * Indicates possible value types 16 * 17 * @syscap SystemCapability.DistributedDataManager.DataShare.Core 18 * @systemapi 19 * @StageModelOnly 20 * @since 9 21 */ 22 export type ValueType = number | string | boolean; 23``` 24 25After change: 26 27```ts 28 /** 29 * Indicates possible value types 30 * 31 * @syscap SystemCapability.DistributedDataManager.DataShare.Core 32 * @StageModelOnly 33 * @since 10 34 */ 35 export type ValueType = number | string | boolean; 36``` 37 38 39## cl.distributeddatamgr.2 Change of Some Predicate Interfaces in dataSharePredicates to Public Interfaces 40 41**Change Impact** 42 43For applications developed based on earlier versions, only system applications can use **dataSharePredicates**. From this version, the namespace **dataSharePredicates**, **dataSharePredicates** class, and some predicate interfaces can be called by third-party applications. 44 45**Key API/Component Changes** 46 47The involved interfaces are as follows: 48 49- equalTo(field: string, value: ValueType): DataSharePredicates 50 51- and(): DataSharePredicates 52 53- orderByAsc(field: string): DataSharePredicates 54 55- orderByDesc(field: string): DataSharePredicates 56 57- limit(total: number, offset: number): DataSharePredicates 58 59- in(field: string, value: Array[/topic/body/section/ul/li/p/valuetype {""}) ): DataSharePredicates (valuetype] 60 61 62## cl.distributeddatamgr.3 Change of the DataShareExtensionAbility Context 63 64Removed the optional flag from the context attribute of @ohos.application.DataShareExtensionAbility, and changed the start version from API version 9 to API version 10. 65 66**Change Impact** 67 68For applications developed based on earlier versions, use SDK API version 10 for the context. 69 70**Key API/Component Changes** 71 72Before change: 73 74```ts 75 /** 76 * Indicates datashare extension ability context. 77 * 78 * @type ?{ ExtensionContext } 79 * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 80 * @systemapi 81 * @StageModelOnly 82 * @since 9 83 */ 84 context?: ExtensionContext; 85``` 86 87After change: 88 89```ts 90 /** 91 * Indicates datashare extension ability context. 92 * 93 * @type { ExtensionContext } 94 * @syscap SystemCapability.DistributedDataManager.DataShare.Provider 95 * @systemapi 96 * @StageModelOnly 97 * @since 10 98 */ 99 context: ExtensionContext; 100``` 101 102 103## cl.distributeddatamgr.4 Change of the Return Value Type of Function Pointer Variables in the OH_Predicates Struct from OH_Predicates to OH_Predicates \* 104 105**Change Impact** 106 107This change is incompatible with earlier versions. You need to use the new function pointer variables in the **OH_Predicates** struct. 108 109**Key API/Component Changes** 110 111Before change: 112 113```ts 114 OH_Predicates (*equalTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 115 OH_Predicates (*notEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 116 OH_Predicates (*beginWrap)(OH_Predicates *predicates); 117 OH_Predicates (*endWrap)(OH_Predicates *predicates); 118 OH_Predicates (*orOperate)(OH_Predicates *predicates); 119 OH_Predicates (*andOperate)(OH_Predicates *predicates); 120 OH_Predicates (*isNull)(OH_Predicates *predicates, const char *field); 121 OH_Predicates (*isNotNull)(OH_Predicates *predicates, const char *field); 122 OH_Predicates (*like)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 123 OH_Predicates (*between)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 124 OH_Predicates (*notBetween)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 125 OH_Predicates (*greaterThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 126 OH_Predicates (*lessThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 127 OH_Predicates (*greaterThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 128 OH_Predicates (*lessThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 129 OH_Predicates (*orderBy)(OH_Predicates *predicates, const char *field, OH_OrderType type); 130 OH_Predicates (*distinct)(OH_Predicates *predicates); 131 OH_Predicates (*limit)(OH_Predicates *predicates, unsigned int value); 132 OH_Predicates (*offset)(OH_Predicates *predicates, unsigned int rowOffset); 133 OH_Predicates (*groupBy)(OH_Predicates *predicates, char const *const *fields, int length); 134 OH_Predicates (*in)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 135 OH_Predicates (*notIn)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 136 OH_Predicates (*clear)(OH_Predicates *predicates); 137``` 138 139After change: 140 141```ts 142 OH_Predicates *(*equalTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 143 OH_Predicates *(*notEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 144 OH_Predicates *(*beginWrap)(OH_Predicates *predicates); 145 OH_Predicates *(*endWrap)(OH_Predicates *predicates); 146 OH_Predicates *(*orOperate)(OH_Predicates *predicates); 147 OH_Predicates *(*andOperate)(OH_Predicates *predicates); 148 OH_Predicates *(*isNull)(OH_Predicates *predicates, const char *field); 149 OH_Predicates *(*isNotNull)(OH_Predicates *predicates, const char *field); 150 OH_Predicates *(*like)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 151 OH_Predicates *(*between)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 152 OH_Predicates *(*notBetween)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 153 OH_Predicates *(*greaterThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 154 OH_Predicates *(*lessThan)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 155 OH_Predicates *(*greaterThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 156 OH_Predicates *(*lessThanOrEqualTo)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 157 OH_Predicates *(*orderBy)(OH_Predicates *predicates, const char *field, OH_OrderType type); 158 OH_Predicates *(*distinct)(OH_Predicates *predicates); 159 OH_Predicates *(*limit)(OH_Predicates *predicates, unsigned int value); 160 OH_Predicates *(*offset)(OH_Predicates *predicates, unsigned int rowOffset); 161 OH_Predicates *(*groupBy)(OH_Predicates *predicates, char const *const *fields, int length); 162 OH_Predicates *(*in)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 163 OH_Predicates *(*notIn)(OH_Predicates *predicates, const char *field, OH_VObject *valueObject); 164 OH_Predicates *(*clear)(OH_Predicates *predicates); 165``` 166 167**Adaptation Guide** 168 169Example: 170 171Code before change: 172 173``` 174predicates->beginWrap(predicates).equalTo(predicates, "data1", valueObject).orOperate(predicates); 175``` 176 177Code after change: 178 179``` 180predicates->beginWrap(predicates)->equalTo(predicates, "data1", valueObject)->orOperate(predicates); 181``` 182 183 184## cl.distributeddatamgr.5 Change of the Error Codes of the OH_Rdb_ErrCode Struct 185 186**Change Impact** 187 188Changed **RDB_ERR_INVALID_ARGS** to **RDB_E_INVALID_ARGS**, and **RDB_ERR_OK** to **RDB_OK**, and added error codes. 189 190**Key API/Component Changes** 191 192Before change: 193 194```ts 195 RDB_ERR_INVALID_ARGS = -2, 196 RDB_ERR = -1, 197 RDB_ERR_OK = 0 198``` 199 200After change: 201 202```ts 203 RDB_ERR = -1, 204 RDB_OK = 0, 205 E_BASE = 14800000, 206 RDB_E_NOT_SUPPORTED = 801, 207 RDB_E_ERROR = E_BASE, 208 RDB_E_INVALID_ARGS = (E_BASE + 1), 209 RDB_E_CANNOT_UPDATE_READONLY = (E_BASE + 2), 210 RDB_E_REMOVE_FILE = (E_BASE + 3), 211 RDB_E_EMPTY_TABLE_NAME = (E_BASE + 5), 212 RDB_E_EMPTY_VALUES_BUCKET = (E_BASE + 6), 213 RDB_E_EXECUTE_IN_STEP_QUERY = (E_BASE + 7), 214 RDB_E_INVALID_COLUMN_INDEX = (E_BASE + 8), 215 RDB_E_INVALID_COLUMN_TYPE = (E_BASE + 9), 216 RDB_E_EMPTY_FILE_NAME = (E_BASE + 10), 217 RDB_E_INVALID_FILE_PATH = (E_BASE + 11), 218 RDB_E_TRANSACTION_IN_EXECUTE = (E_BASE + 12), 219 RDB_E_INVALID_STATEMENT = (E_BASE + 13), 220 RDB_E_EXECUTE_WRITE_IN_READ_CONNECTION = (E_BASE + 14), 221 RDB_E_BEGIN_TRANSACTION_IN_READ_CONNECTION = (E_BASE + 15), 222 RDB_E_NO_TRANSACTION_IN_SESSION = (E_BASE + 16), 223 RDB_E_MORE_STEP_QUERY_IN_ONE_SESSION = (E_BASE + 17), 224 RDB_E_NO_ROW_IN_QUERY = (E_BASE + 18), 225 RDB_E_INVALID_BIND_ARGS_COUNT = (E_BASE + 19), 226 RDB_E_INVALID_OBJECT_TYPE = (E_BASE + 20), 227 RDB_E_INVALID_CONFLICT_FLAG = (E_BASE + 21), 228 RDB_E_HAVING_CLAUSE_NOT_IN_GROUP_BY = (E_BASE + 22), 229 RDB_E_NOT_SUPPORTED_BY_STEP_RESULT_SET = (E_BASE + 23), 230 RDB_E_STEP_RESULT_SET_CROSS_THREADS = (E_BASE + 24), 231 RDB_E_STEP_RESULT_QUERY_NOT_EXECUTED = (E_BASE + 25), 232 RDB_E_STEP_RESULT_IS_AFTER_LAST = (E_BASE + 26), 233 RDB_E_STEP_RESULT_QUERY_EXCEEDED = (E_BASE + 27), 234 RDB_E_STATEMENT_NOT_PREPARED = (E_BASE + 28), 235 RDB_E_EXECUTE_RESULT_INCORRECT = (E_BASE + 29), 236 RDB_E_STEP_RESULT_CLOSED = (E_BASE + 30), 237 RDB_E_RELATIVE_PATH = (E_BASE + 31), 238 RDB_E_EMPTY_NEW_ENCRYPT_KEY = (E_BASE + 32), 239 RDB_E_CHANGE_UNENCRYPTED_TO_ENCRYPTED = (E_BASE + 33), 240 RDB_E_CHANGE_ENCRYPT_KEY_IN_BUSY = (E_BASE + 34), 241 RDB_E_STEP_STATEMENT_NOT_INIT = (E_BASE + 35), 242 RDB_E_NOT_SUPPORTED_ATTACH_IN_WAL_MODE = (E_BASE + 36), 243 RDB_E_CREATE_FOLDER_FAIL = (E_BASE + 37), 244 RDB_E_SQLITE_SQL_BUILDER_NORMALIZE_FAIL = (E_BASE + 38), 245 RDB_E_STORE_SESSION_NOT_GIVE_CONNECTION_TEMPORARILY = (E_BASE + 39), 246 RDB_E_STORE_SESSION_NO_CURRENT_TRANSACTION = (E_BASE + 40), 247 RDB_E_NOT_SUPPORT = (E_BASE + 41), 248 RDB_E_INVALID_PARCEL = (E_BASE + 42), 249 RDB_E_QUERY_IN_EXECUTE = (E_BASE + 43), 250 RDB_E_SET_PERSIST_WAL = (E_BASE + 44), 251 RDB_E_DB_NOT_EXIST = (E_BASE + 45), 252 RDB_E_ARGS_READ_CON_OVERLOAD = (E_BASE + 46), 253 RDB_E_WAL_SIZE_OVER_LIMIT = (E_BASE + 47), 254 RDB_E_CON_OVER_LIMIT = (E_BASE + 48) 255``` 256 257 258 259## cl.distributeddatamgr.6 Change of int (*close)(OH_Cursor *cursor) in OH_Cursor Struct to int (\*destroy)(OH_Cursor \*cursor) 260 261**Change Impact** 262 263This change is incompatible with earlier versions. The function pointer name is changed from **close** to **destroy**. The input parameters and return values remain unchanged. 264 265**Key API/Component Changes** 266 267Before change: 268 269```ts 270int (*close)(OH_Cursor *cursor); 271``` 272 273After change: 274 275```ts 276int (*destroy)(OH_Cursor *cursor); 277``` 278 279**Adaptation Guide** 280 281Example: 282 283Code before change: 284 285``` 286cursor->close(cursor); 287``` 288 289Code after change: 290 291``` 292cursor->destroy(cursor); 293``` 294 295 296## cl.distributeddatamgr.7 Change of int (\*destroyPredicates)(OH_Predicates \*predicates) in OH_Predicates Struct to int (\*destroy) (OH_Predicates \*predicates) 297 298**Change Impact** 299 300This change is incompatible with earlier versions. The function pointer name is changed from **destroyPredicates** to **destroy**. The input parameters and return values remain unchanged. 301 302**Key API/Component Changes** 303 304Before change: 305 306```ts 307int (*destroyPredicates)(OH_Predicates *predicates); 308``` 309 310After change: 311 312```ts 313int (*destroy)(OH_Predicates *predicates); 314``` 315 316**Adaptation Guide** 317 318Example: 319 320Code before change: 321 322``` 323predicates->destroyPredicates(predicates); 324``` 325 326Code after change: 327 328``` 329predicates->destroy(predicates); 330``` 331 332 333## cl.distributeddatamgr.8 Change of int (\*destroyValueObject)(OH_VObject \*valueObject) in OH_VObject Struct to int (\*destroy) (OH_VObject \*valueObject) 334 335**Change Impact** 336 337This change is incompatible with earlier versions. The function pointer name is changed from **destroyValueObject** to **destroy**. The input parameters and return values remain unchanged. 338 339**Key API/Component Changes** 340 341Before change: 342 343```ts 344int (*destroyValueObject)(OH_VObject *valueObject); 345``` 346 347After change: 348 349```ts 350int (*destroy)(OH_VObject *valueObject); 351``` 352 353**Adaptation Guide** 354 355Example: 356 357Code before change: 358 359``` 360valueObject->destroyValueObject(valueObject); 361``` 362 363Code after change: 364 365``` 366valueObject->destroy(valueObject); 367``` 368 369 370## cl.distributeddatamgr.9 Change of int (\*destroyValuesBucket)(OH_VBucket \*bucket) in OH_VBucket Struct to int (\*destroy) (OH_VBucket \*bucket) 371 372**Change Impact** 373 374This change is incompatible with earlier versions. The function pointer name is changed from **destroyValuesBucket** to **destroy**. The input parameters and return values remain unchanged. 375 376**Key API/Component Changes** 377 378Before change: 379 380```ts 381int (*destroyValuesBucket)(OH_VBucket *bucket); 382``` 383 384After change: 385 386```ts 387int (*destroy)(OH_VBucket *bucket); 388``` 389 390**Adaptation Guide** 391 392Example: 393 394Code before change: 395 396``` 397valueBucket->destroyValuesBucket(valueBucket); 398``` 399 400Code after change: 401 402``` 403 valueBucket->destroy(valueBucket); 404``` 405 406 407## cl.distributeddatamgr.10 Change of OH_Rdb_Config Struct Member Variables 408 409**Change Impact** 410 411The changes are incompatible with earlier versions. <br>The type of **securityLevel** is changed from **enum OH_Rdb_SecurityLevel** to **in**.<br>The member variable **path** is deleted.<br>The member variables **selfSize**, **dataBaseDir**, **storeName**, **bundleName**, and **moduleName** are added. 412 413**Key API/Component Changes** 414 415OH_Rdb_Config before change: 416 417```ts 418typedef struct { 419 const char *path; 420 bool isEncrypt; 421 enum OH_Rdb_SecurityLevel securityLevel; 422} OH_Rdb_Config; 423``` 424 425OH_Rdb_Config after change: 426 427```ts 428typedef struct { 429 int selfSize; 430 const char *dataBaseDir; 431 const char *storeName; 432 const char *bundleName; 433 const char *moduleName; 434 bool isEncrypt; 435 int securityLevel; 436} OH_Rdb_Config; 437``` 438 439**Adaptation Guide** 440 441When creating an RDB store with **OH_Rdb_Config**, you need to pass in the bundle name and module name. 442 443 444## cl.distributeddatamgr.11 Change of const char *path in OH_Rdb_DeleteStore() to const OH_Rdb_Config \*config 445 446**Change Impact** 447 448This change is incompatible with earlier versions. The input parameter is changed from **const char \*path** to **const OH_Rdb_Config \*config**. 449 450**Key API/Component Changes** 451 452OH_Rdb_DeleteStore before change: 453 454```ts 455int OH_Rdb_DeleteStore(const char *path); 456``` 457 458OH_Rdb_DeleteStore after change: 459 460```ts 461int OH_Rdb_DeleteStore(const OH_Rdb_Config *config); 462``` 463 464**Adaptation Guide** 465 466Example: 467 468Code before change: 469 470``` 471OH_Rdb_DeleteStore("") 472``` 473 474Code after change: 475 476``` 477OH_Rdb_DeleteStore(config) 478``` 479