mirror of
https://gitee.com/openharmony/distributeddatamgr_relational_store
synced 2024-11-23 07:00:41 +00:00
commit
0838d14b26
@ -133,15 +133,12 @@ napi_value Convert2JSValue(napi_env env, const Asset &value)
|
||||
template<>
|
||||
napi_value Convert2JSValue(napi_env env, const RowEntity &rowEntity)
|
||||
{
|
||||
std::vector<napi_property_descriptor> descriptors;
|
||||
napi_value object = nullptr;
|
||||
NAPI_CALL_RETURN_ERR(napi_create_object(env, &object), object);
|
||||
auto &values = rowEntity.Get();
|
||||
for (auto const &[key, value] : values) {
|
||||
descriptors.emplace_back(DECLARE_JS_PROPERTY(env, key.c_str(), value));
|
||||
NAPI_CALL_RETURN_ERR(SetNamedProperty(env, object, key.c_str(), value), object);
|
||||
}
|
||||
|
||||
napi_value object = nullptr;
|
||||
NAPI_CALL_RETURN_ERR(
|
||||
napi_create_object_with_properties(env, &object, descriptors.size(), descriptors.data()), object);
|
||||
return object;
|
||||
}
|
||||
|
||||
|
@ -270,5 +270,20 @@ describe('rdbStoreResultSetGetRowTest', function () {
|
||||
expect(false).assertEqual(resultSet.goToLastRow());
|
||||
console.log(TAG + "************* rdbStoreInsertUndefinedValueTest0008 end *************");
|
||||
})
|
||||
|
||||
/**
|
||||
* @tc.name rdb store resultSet getRow test
|
||||
* @tc.number rdbStoreResultSetGoToLastRow0009
|
||||
* @tc.desc resultSet goToFirstRow test
|
||||
*/
|
||||
it('rdbStoreResultSetGetRowTest0009', 0, async function () {
|
||||
console.log(TAG + "************* rdbStoreResultSetGetRowTest0009 start *************");
|
||||
let querySql = "SELECT 1";
|
||||
let resultSet = await rdbStore.querySql(querySql);
|
||||
expect(true).assertEqual(resultSet.goToFirstRow());
|
||||
let valueBucket_ret = resultSet.getRow();
|
||||
expect(1).assertEqual(valueBucket_ret["1"]);
|
||||
console.log(TAG + "************* rdbStoreResultSetGetRowTest0009 end *************");
|
||||
})
|
||||
console.log(TAG + "*************Unit Test End*************");
|
||||
})
|
Loading…
Reference in New Issue
Block a user