提交 821a40ac 编写于 作者: S srr101

资料格式修改挑单至3.2release

Signed-off-by: Nsrr101 <songruirui1@huawei.com>
上级 ba68cfde
......@@ -78,10 +78,10 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
name: DB_NAME,
securityLevel: rdb.SecurityLevel.S1
}, function (err, data) {
console.log('getRdbStore done, data : ' + data);
console.info(`getRdbStore done, data : ${data}`);
rdbStore = data;
rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) {
console.log('executeSql done, error message : ' + err);
console.error(`executeSql done, error message : ${err}`);
});
if (callback) {
callback();
......@@ -122,11 +122,11 @@ let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility {
insert(uri, valueBucket, callback) {
if (valueBucket === null) {
console.info('invalid valueBuckets');
console.error('invalid valueBuckets');
return;
}
rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) {
console.info('callback ret:' + ret);
console.info(`callback ret: ${ret}`);
if (callback !== undefined) {
callback(err, ret);
}
......@@ -256,7 +256,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
}
rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) {
if (resultSet !== undefined) {
console.info('resultSet.rowCount: ' + resultSet.rowCount);
console.info(`resultSet.rowCount: ${resultSet.rowCount}`);
}
if (callback !== undefined) {
callback(err, resultSet);
......@@ -297,14 +297,12 @@ let rdbStore;
export default class DataShareExtAbility extends DataShareExtensionAbility {
batchInsert(uri, valueBuckets, callback) {
if (valueBuckets === null || valueBuckets.length === undefined) {
console.info('invalid valueBuckets');
console.error('invalid valueBuckets');
return;
}
let resultNum = valueBuckets.length;
valueBuckets.forEach(vb => {
rdbStore.insert(TBL_NAME, vb, function (err, ret) {
rdbStore.batchInsert(TBL_NAME, valueBuckets, function (err, ret) {
if (callback !== undefined) {
callback(err, resultNum);
callback(err, ret);
}
});
});
......@@ -333,7 +331,7 @@ normalizeUri?(uri: string, callback: AsyncCallback&lt;string&gt;): void
export default class DataShareExtAbility extends DataShareExtensionAbility {
normalizeUri(uri, callback) {
let err = {'code':0};
let ret = 'normalize+' + uri;
let ret = `normalize: ${uri}`;
callback(err, ret);
}
};
......@@ -360,7 +358,7 @@ denormalizeUri?(uri: string, callback: AsyncCallback&lt;string&gt;): void
export default class DataShareExtAbility extends DataShareExtensionAbility {
denormalizeUri(uri, callback) {
let err = {'code':0};
let ret = 'denormalize+' + uri;
let ret = `denormalize ${uri}`;
callback(err, ret);
}
};
......
......@@ -27,7 +27,7 @@ let dataShareHelper;
let uri = ("datashare:///com.samples.datasharetest.DataShare");
await dataShare.createDataShareHelper(this.context, uri, (err, data) => {
if (err != undefined) {
console.info("createDataShareHelper fail, error message : " + err);
console.error("createDataShareHelper fail, error message : " + err);
} else {
console.info("createDataShareHelper end, data : " + data);
dataShareHelper = data;
......@@ -39,10 +39,10 @@ let da = new dataSharePredicates.DataSharePredicates();
let resultSet;
da.equalTo("name", "ZhangSan");
dataShareHelper.query(uri, da, columns).then((data) => {
console.log("query end, data : " + data);
console.info("query end, data : " + data);
resultSet = data;
}).catch((err) => {
console.log("query fail, error message : " + err);
console.error("query fail, error message : " + err);
});
```
......
......@@ -70,7 +70,7 @@ let uri = ("datashare:///com.samples.datasharetest.DataShare");
let dataShareHelper;
try {
dataShare.createDataShareHelper(this.context, uri, (err, data) => {
if (err != undefined) {
if (err !== undefined) {
console.error(`createDataShareHelper error: code: ${err.code}, message: ${err.message} `);
return;
}
......@@ -422,7 +422,7 @@ let da = new dataSharePredicates.DataSharePredicates();
da.equalTo("name", "ZhangSan");
try {
dataShareHelper.query(uri, da, columns).then((data) => {
console.log("query succeed, rowCount : " + data.rowCount);
console.info("query succeed, rowCount : " + data.rowCount);
}). catch((err) => {
console.error(`query error: code: ${err.code}, message: ${err.message} `);
});
......@@ -465,11 +465,11 @@ const va = {
}
try {
dataShareHelper.update(uri, da, va, (err, data) => {
if (err != undefined) {
if (err !== undefined) {
console.error(`update error: code: ${err.code}, message: ${err.message} `);
return;
}
console.log("update succeed, data : " + data);
console.info("update succeed, data : " + data);
});
} catch (err) {
console.error(`update error: code: ${err.code}, message: ${err.message} `);
......@@ -515,7 +515,7 @@ const va = {
}
try {
dataShareHelper.update(uri, da, va).then((data) => {
console.log("update succeed, data : " + data);
console.info("update succeed, data : " + data);
}). catch((err) => {
console.error(`update error: code: ${err.code}, message: ${err.message} `);
});
......@@ -550,11 +550,11 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
{"name": "roe13", "age": 21, "salary": 20.5,})
try {
dataShareHelper.batchInsert(uri, vbs, (err, data) => {
if (err != undefined) {
if (err !== undefined) {
console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `);
return;
}
console.log("batchInsert succeed, data : " + data);
console.info("batchInsert succeed, data : " + data);
});
} catch (err) {
console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `);
......@@ -592,7 +592,7 @@ let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
{"name": "roe13", "age": 21, "salary": 20.5,})
try {
dataShareHelper.batchInsert(uri, vbs).then((data) => {
console.log("batchInsert succeed, data : " + data);
console.info("batchInsert succeed, data : " + data);
}). catch((err) => {
console.error(`batchInsert error: code: ${err.code}, message: ${err.message} `);
});
......@@ -622,10 +622,10 @@ normalizeUri(uri: string, callback: AsyncCallback&lt;string&gt;): void
import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.normalizeUri(uri, (err, data) => {
if (err != undefined) {
console.log("normalizeUri failed, error message : " + err);
if (err !== undefined) {
console.info("normalizeUri failed, error message : " + err);
}else{
console.log("normalizeUri = " + data);
console.info("normalizeUri = " + data);
}
});
```
......@@ -656,9 +656,9 @@ normalizeUri(uri: string): Promise&lt;string&gt;
import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.normalizeUri(uri).then((data) => {
console.log("normalizeUri = " + data);
console.info("normalizeUri = " + data);
}).catch((err) => {
console.log("normalizeUri failed, error message : " + err);
console.info("normalizeUri failed, error message : " + err);
});
```
......@@ -683,10 +683,10 @@ denormalizeUri(uri: string, callback: AsyncCallback&lt;string&gt;): void
import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.denormalizeUri(uri, (err, data) => {
if (err != undefined) {
console.log("denormalizeUri failed, error message : " + err);
if (err !== undefined) {
console.error("denormalizeUri failed, error message : " + err);
}else{
console.log("denormalizeUri = " + data);
console.info("denormalizeUri = " + data);
}
});
```
......@@ -717,9 +717,9 @@ denormalizeUri(uri: string): Promise&lt;string&gt;
import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.denormalizeUri(uri).then((data) => {
console.log("denormalizeUri = " + data);
console.info("denormalizeUri = " + data);
}).catch((err) => {
console.log("denormalizeUri failed, error message : " + err);
console.error("denormalizeUri failed, error message : " + err);
});
```
......@@ -744,7 +744,7 @@ notifyChange(uri: string, callback: AsyncCallback&lt;void&gt;): void
import UIAbility from '@ohos.app.ability.UIAbility'
let uri = ("datashare:///com.samples.datasharetest.DataShare");
dataShareHelper.notifyChange(uri, () => {
console.log("***** notifyChange *****");
console.info("***** notifyChange *****");
});
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册