mirror of
https://gitee.com/openharmony/distributeddatamgr_data_share
synced 2024-11-27 00:51:17 +00:00
删除provider
Signed-off-by: srr101 <songruirui1@huawei.com>
This commit is contained in:
parent
bbe3253cc7
commit
00a4dab6a5
@ -2,11 +2,11 @@
|
||||
|
||||
## 简介
|
||||
|
||||
**数据共享(Data Share)** 部件提供了向其他应用共享以及管理其数据的方法,支持同个设备上不同应用之间的数据共享。
|
||||
**数据共享(Data Share)** 部件提供了向其它应用共享以及管理其数据的方法,支持同个设备上不同应用之间的数据共享。
|
||||
|
||||
在许多应用场景中都需要用到数据共享,比如将电话簿、短信、媒体库中的数据共享给其他应用等。当然,不是所有的数据都允许其他应用访问,比如帐号、密码等;有些数据也只允许其他应用查询而不允许其删改,比如短信等。所以对于各种数据共享场景,DataShare这样一个安全、便捷的可以跨应用的数据共享机制是十分必需的。
|
||||
在许多应用场景中都需要用到数据共享,比如将电话簿、短信、媒体库中的数据共享给其它应用等。当然,不是所有的数据都允许其它应用访问,比如帐号、密码等;有些数据也只允许其它应用查询而不允许其删改,比如短信等。所以对于各种数据共享场景,DataShare这样一个安全、便捷的可以跨应用的数据共享机制是十分必需的。
|
||||
|
||||
数据提供者无需进行繁琐的封装,可直接使用DataShare框架向其他应用共享数据;对数据访问方来说,因DataShare的访问方式不会因数据提供的方式而不同,只需要学习和使用一套接口即可,大大减少了学习时间和开发难度。
|
||||
数据提供者无需进行繁琐的封装,可直接使用DataShare框架向其它应用共享数据;对数据访问方来说,因DataShare的访问方式不会因数据提供的方式而不同,只需要学习和使用一套接口即可,大大减少了学习时间和开发难度。
|
||||
|
||||
### 基本概念
|
||||
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
- DataShareExtAbility模块为数据提供方,实现跨应用数据共享的相关业务。
|
||||
- DataShareHelper模块为数据访问方,提供各种访问数据的接口,包括增删改查等。
|
||||
- 数据访问方与提供方通过IPC进行通信,数据提供方可以通过数据库实现,也可以通过其他数据存储方式实现。
|
||||
- 数据访问方与提供方通过IPC进行通信,数据提供方可以通过数据库实现,也可以通过其它数据存储方式实现。
|
||||
- ResultSet模块通过共享内存实现,用于存储查询数据得到的结果集,并提供了遍历结果集的方法。
|
||||
|
||||
## 目录
|
||||
|
@ -30,142 +30,142 @@ let rdbStore;
|
||||
export default class
|
||||
extends Extension {
|
||||
async onCreate(want, callback) {
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility onCreate, want:' + want.abilityName);
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility onCreate, want:' + want.abilityName);
|
||||
console.log("[ttt] [DataShareTest] DataShareExtAbility onCreate this.context.databaseDir:" + this.context.databaseDir);
|
||||
// @ts-ignore
|
||||
rdbStore = await rdb.getRdbStore(this.context, { name: DB_NAME, securityLevel: rdb.SecurityLevel.S1 });
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility getRdbStore done');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility getRdbStore done');
|
||||
await rdbStore.executeSql(DDL_TBL_CREATE, []);
|
||||
await rdbStore.executeSql(DDL_TABLE_USER_SQL, []);
|
||||
await rdbStore.executeSql(DDL_TABLE_BOOK_SQL, []);
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility executeSql multiple tables done');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility executeSql multiple tables done');
|
||||
let err = {"code":0};
|
||||
callback(err);
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility onCreate end');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility onCreate end');
|
||||
}
|
||||
|
||||
async insert(uri, value, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] enter');
|
||||
console.info('[ttt] [DataShareTest] [insert] enter');
|
||||
if (value == null) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] invalid valueBuckets');
|
||||
console.info('[ttt] [DataShareTest] [insert] invalid valueBuckets');
|
||||
return;
|
||||
}
|
||||
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] getCallingTokenId:' + rpc.IPCSkeleton.getCallingTokenId());
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] value = ' + value);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] value = ' + JSON.stringify(value));
|
||||
console.info('[ttt] [DataShareTest] [insert] getCallingTokenId:' + rpc.IPCSkeleton.getCallingTokenId());
|
||||
console.info('[ttt] [DataShareTest] [insert] value = ' + value);
|
||||
console.info('[ttt] [DataShareTest] [insert] value = ' + JSON.stringify(value));
|
||||
await rdbStore.insert(TBL_NAME, value, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [insert] callback ret:' + ret);
|
||||
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] leave');
|
||||
console.info('[ttt] [DataShareTest] [insert] leave');
|
||||
}
|
||||
|
||||
async update(uri, predicates, value, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] enter');
|
||||
console.info('[ttt] [DataShareTest] [update] enter');
|
||||
if (predicates == null || predicates == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] invalid predicates');
|
||||
console.info('[ttt] [DataShareTest] [update] invalid predicates');
|
||||
return;
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] values = ' + value);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] values = ' + JSON.stringify(value));
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] predicates = ' + JSON.stringify(predicates));
|
||||
console.info('[ttt] [DataShareTest] [update] values = ' + value);
|
||||
console.info('[ttt] [DataShareTest] [update] values = ' + JSON.stringify(value));
|
||||
console.info('[ttt] [DataShareTest] [update] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] [update] predicates = ' + JSON.stringify(predicates));
|
||||
try {
|
||||
await rdbStore.update(TBL_NAME,value, predicates, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] callback err:' + err);
|
||||
console.info('[ttt] [DataShareTest] [update] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [update] callback err:' + err);
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('[ttt] [DataShareTest] <<Provider>> [update] error' + err);
|
||||
console.error('[ttt] [DataShareTest] [update] error' + err);
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] leave');
|
||||
console.info('[ttt] [DataShareTest] [update] leave');
|
||||
}
|
||||
|
||||
async delete(uri, predicates, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] enter');
|
||||
console.info('[ttt] [DataShareTest] [delete] enter');
|
||||
if (predicates == null || predicates == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] invalid predicates');
|
||||
console.info('[ttt] [DataShareTest] [delete] invalid predicates');
|
||||
return;
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] predicates = ' + JSON.stringify(predicates));
|
||||
console.info('[ttt] [DataShareTest] [delete] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] [delete] predicates = ' + JSON.stringify(predicates));
|
||||
try {
|
||||
await rdbStore.delete(TBL_NAME,predicates, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [delete] ret:' + ret);
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('[ttt] [DataShareTest] <<Provider>> [delete] error' + err);
|
||||
console.error('[ttt] [DataShareTest] [delete] error' + err);
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] leave');
|
||||
console.info('[ttt] [DataShareTest] [delete] leave');
|
||||
}
|
||||
|
||||
async query(uri, predicates, columns, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] enter');
|
||||
console.info('[ttt] [DataShareTest] [query] enter');
|
||||
if (predicates == null || predicates == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] invalid predicates');
|
||||
console.info('[ttt] [DataShareTest] [query] invalid predicates');
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] values = ' + columns);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] values = ' + JSON.stringify(columns));
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] predicates = ' + JSON.stringify(predicates));
|
||||
console.info('[ttt] [DataShareTest] [query] values = ' + columns);
|
||||
console.info('[ttt] [DataShareTest] [query] values = ' + JSON.stringify(columns));
|
||||
console.info('[ttt] [DataShareTest] [query] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] [query] predicates = ' + JSON.stringify(predicates));
|
||||
try {
|
||||
await rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] ret: ' + resultSet);
|
||||
console.info('[ttt] [DataShareTest] [query] ret: ' + resultSet);
|
||||
if (resultSet != undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] resultSet.rowCount: ' + resultSet.rowCount);
|
||||
console.info('[ttt] [DataShareTest] [query] resultSet.rowCount: ' + resultSet.rowCount);
|
||||
}
|
||||
if (callback != undefined) {
|
||||
callback(err, resultSet);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(`[ttt] [DataShareTest] <<Provider>> [query] error: code: ${err.code}, message: ${err.message} `);
|
||||
console.error(`[ttt] [DataShareTest] [query] error: code: ${err.code}, message: ${err.message} `);
|
||||
callback(err, undefined);
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] leave');
|
||||
console.info('[ttt] [DataShareTest] [query] leave');
|
||||
}
|
||||
|
||||
async batchInsert(uri: string, valueBuckets, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] enter');
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] enter');
|
||||
if (valueBuckets == null || valueBuckets.length == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] invalid valueBuckets');
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] invalid valueBuckets');
|
||||
return;
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] valueBuckets.length:' + valueBuckets.length);
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] valueBuckets.length:' + valueBuckets.length);
|
||||
let resultNum = valueBuckets.length
|
||||
await rdbStore.batchInsert(TBL_NAME, valueBuckets, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] callback ret:' + ret);
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] leave');
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] leave');
|
||||
}
|
||||
|
||||
async normalizeUri(uri: string, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [normalizeUri] enter');
|
||||
console.info('[ttt] [DataShareTest] [normalizeUri] enter');
|
||||
let ret = "normalize+" + uri;
|
||||
let err = {"code":0};
|
||||
await callback(err, ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [normalizeUri] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [normalizeUri] leave, ret:' + ret);
|
||||
}
|
||||
|
||||
async denormalizeUri(uri: string, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [denormalizeUri] enter');
|
||||
console.info('[ttt] [DataShareTest] [denormalizeUri] enter');
|
||||
let ret = "denormalize+" + uri;
|
||||
let err = {"code":0};
|
||||
await callback(err, ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [denormalizeUri] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [denormalizeUri] leave, ret:' + ret);
|
||||
}
|
||||
};
|
@ -35,13 +35,13 @@ export default class MainAbility extends Ability {
|
||||
console.log("[ttt] [datashareproxyTest] <<Consumer>> MainAbility onCreate")
|
||||
globalThis.abilityWant = want;
|
||||
globalThis.abilityContext = this.context;
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility onCreate, want:' + want.abilityName);
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility onCreate, want:' + want.abilityName);
|
||||
console.log("[ttt] [DataShareTest] DataShareExtAbility onCreate this.context.databaseDir:" + this.context.databaseDir);
|
||||
|
||||
rdbStore = await rdb.getRdbStore(this.context, { name: DB_NAME }, 1);
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility getRdbStore done');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility getRdbStore done');
|
||||
await rdbStore.executeSql(DDL_TBL_CREATE, []);
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility executeSql done');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility executeSql done');
|
||||
}
|
||||
|
||||
onDestroy() {
|
||||
|
@ -28,162 +28,162 @@ let rdbStore;
|
||||
export default class
|
||||
extends Extension {
|
||||
async onCreate(want, callback) {
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility onCreate, want:' + want.abilityName);
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility onCreate, want:' + want.abilityName);
|
||||
console.log("[ttt] [DataShareTest] DataShareExtAbility onCreate this.context.databaseDir:" + this.context.databaseDir);
|
||||
// @ts-ignore
|
||||
rdbStore = await rdb.getRdbStore(this.context, { name: DB_NAME, securityLevel: rdb.SecurityLevel.S1 });
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility getRdbStore done');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility getRdbStore done');
|
||||
await rdbStore.executeSql(DDL_TBL_CREATE, []);
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility executeSql done');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility executeSql done');
|
||||
let err = {"code":0};
|
||||
callback(err);
|
||||
console.log('[ttt] [DataShareTest] <<Provider>> DataShareExtAbility onCreate end');
|
||||
console.log('[ttt] [DataShareTest] DataShareExtAbility onCreate end');
|
||||
}
|
||||
|
||||
async getFileTypes(uri: string, mimeTypeFilter: string, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [getFileTypes] enter');
|
||||
console.info('[ttt] [DataShareTest] [getFileTypes] enter');
|
||||
let ret = new Array("type01", "type00", "type03");
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [getFileTypes] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [getFileTypes] leave, ret:' + ret);
|
||||
let err = {"code":0};
|
||||
await callback(err,ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
async openFile(uri: string, mode: string, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [openFile] enter');
|
||||
console.info('[ttt] [DataShareTest] [openFile] enter');
|
||||
let ret = 12345;
|
||||
let err = {"code":0};
|
||||
await callback(err,ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [openFile] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [openFile] leave, ret:' + ret);
|
||||
}
|
||||
|
||||
async insert(uri, value, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] enter');
|
||||
console.info('[ttt] [DataShareTest] [insert] enter');
|
||||
if (value == null) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] invalid valueBuckets');
|
||||
console.info('[ttt] [DataShareTest] [insert] invalid valueBuckets');
|
||||
return;
|
||||
}
|
||||
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] getCallingTokenId:' + rpc.IPCSkeleton.getCallingTokenId());
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] value = ' + value);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] value = ' + JSON.stringify(value));
|
||||
console.info('[ttt] [DataShareTest] [insert] getCallingTokenId:' + rpc.IPCSkeleton.getCallingTokenId());
|
||||
console.info('[ttt] [DataShareTest] [insert] value = ' + value);
|
||||
console.info('[ttt] [DataShareTest] [insert] value = ' + JSON.stringify(value));
|
||||
await rdbStore.insert(TBL_NAME, value, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [insert] callback ret:' + ret);
|
||||
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [insert] leave');
|
||||
console.info('[ttt] [DataShareTest] [insert] leave');
|
||||
}
|
||||
|
||||
async update(uri, predicates, value, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] enter');
|
||||
console.info('[ttt] [DataShareTest] [update] enter');
|
||||
if (predicates == null || predicates == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] invalid predicates');
|
||||
console.info('[ttt] [DataShareTest] [update] invalid predicates');
|
||||
return;
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] values = ' + value);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] values = ' + JSON.stringify(value));
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] predicates = ' + JSON.stringify(predicates));
|
||||
console.info('[ttt] [DataShareTest] [update] values = ' + value);
|
||||
console.info('[ttt] [DataShareTest] [update] values = ' + JSON.stringify(value));
|
||||
console.info('[ttt] [DataShareTest] [update] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] [update] predicates = ' + JSON.stringify(predicates));
|
||||
try {
|
||||
await rdbStore.update(TBL_NAME,value, predicates, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] callback err:' + err);
|
||||
console.info('[ttt] [DataShareTest] [update] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [update] callback err:' + err);
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('[ttt] [DataShareTest] <<Provider>> [update] error' + err);
|
||||
console.error('[ttt] [DataShareTest] [update] error' + err);
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [update] leave');
|
||||
console.info('[ttt] [DataShareTest] [update] leave');
|
||||
}
|
||||
|
||||
async delete(uri, predicates, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] enter');
|
||||
console.info('[ttt] [DataShareTest] [delete] enter');
|
||||
if (predicates == null || predicates == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] invalid predicates');
|
||||
console.info('[ttt] [DataShareTest] [delete] invalid predicates');
|
||||
return;
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] predicates = ' + JSON.stringify(predicates));
|
||||
console.info('[ttt] [DataShareTest] [delete] predicates = ' + predicates);
|
||||
console.info('[ttt] [DataShareTest] [delete] predicates = ' + JSON.stringify(predicates));
|
||||
try {
|
||||
await rdbStore.delete(TBL_NAME,predicates, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [delete] ret:' + ret);
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error('[ttt] [DataShareTest] <<Provider>> [delete] error' + err);
|
||||
console.error('[ttt] [DataShareTest] [delete] error' + err);
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [delete] leave');
|
||||
console.info('[ttt] [DataShareTest] [delete] leave');
|
||||
}
|
||||
|
||||
async query(uri, predicates, columns, callback) {
|
||||
if (predicates == null || predicates == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] invalid predicates');
|
||||
console.info('[ttt] [DataShareTest] [query] invalid predicates');
|
||||
}
|
||||
try {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] for errorcode test, sissing parameter: TBL_NAME ');
|
||||
console.info('[ttt] [DataShareTest] [query] for errorcode test, sissing parameter: TBL_NAME ');
|
||||
await rdbStore.query(columns, function (err, resultSet) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] ret: ' + resultSet);
|
||||
console.info('[ttt] [DataShareTest] [query] ret: ' + resultSet);
|
||||
if (resultSet != undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] resultSet.rowCount: ' + resultSet.rowCount);
|
||||
console.info('[ttt] [DataShareTest] [query] resultSet.rowCount: ' + resultSet.rowCount);
|
||||
}
|
||||
if (callback != undefined) {
|
||||
callback(err, resultSet);
|
||||
}
|
||||
});
|
||||
} catch (err) {
|
||||
console.error(`[ttt] [DataShareTest] <<Provider>> [query] error: code: ${err.code}, message: ${err.message} `);
|
||||
console.error(`[ttt] [DataShareTest] [query] error: code: ${err.code}, message: ${err.message} `);
|
||||
callback(err, undefined);
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [query] leave');
|
||||
console.info('[ttt] [DataShareTest] [query] leave');
|
||||
}
|
||||
|
||||
async getType(uri: string,callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [getType] enter');
|
||||
console.info('[ttt] [DataShareTest] [getType] enter');
|
||||
let ret = "image";
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [getType] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [getType] leave, ret:' + ret);
|
||||
let err = {"code":0};
|
||||
await callback(err,ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
async batchInsert(uri: string, valueBuckets, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] enter');
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] enter');
|
||||
if (valueBuckets == null || valueBuckets.length == undefined) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] invalid valueBuckets');
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] invalid valueBuckets');
|
||||
return;
|
||||
}
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] valueBuckets.length:' + valueBuckets.length);
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] valueBuckets.length:' + valueBuckets.length);
|
||||
let resultNum = valueBuckets.length
|
||||
await rdbStore.batchinsert(TBL_NAME, valueBuckets, function (err, ret) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] callback ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] callback ret:' + ret);
|
||||
if (callback != undefined) {
|
||||
callback(err, ret);
|
||||
}
|
||||
});
|
||||
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [batchInsert] leave');
|
||||
console.info('[ttt] [DataShareTest] [batchInsert] leave');
|
||||
}
|
||||
|
||||
async normalizeUri(uri: string, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [normalizeUri] enter');
|
||||
console.info('[ttt] [DataShareTest] [normalizeUri] enter');
|
||||
let ret = "normalize+" + uri;
|
||||
let err = {"code":0};
|
||||
await callback(err, ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [normalizeUri] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [normalizeUri] leave, ret:' + ret);
|
||||
}
|
||||
|
||||
async denormalizeUri(uri: string, callback) {
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [denormalizeUri] enter');
|
||||
console.info('[ttt] [DataShareTest] [denormalizeUri] enter');
|
||||
let ret = "denormalize+" + uri;
|
||||
let err = {"code":0};
|
||||
await callback(err, ret);
|
||||
console.info('[ttt] [DataShareTest] <<Provider>> [denormalizeUri] leave, ret:' + ret);
|
||||
console.info('[ttt] [DataShareTest] [denormalizeUri] leave, ret:' + ret);
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user