提交 5963104e 编写于 作者: M Matias Romeo

Implement load_secondary_i128i128

上级 6ba6a5c7
......@@ -52,6 +52,8 @@ public:
uint128_t* primary, uint128_t* secondary, char* data, uint32_t maxlen );
int32_t load_primary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* data, uint32_t maxlen );
int32_t load_secondary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* data, uint32_t maxlen );
int32_t lowerbound_primary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* data, uint32_t maxlen );
int32_t lowerbound_secondary_i128i128( Name scope, Name code, Name table,
......
......@@ -229,6 +229,32 @@ int32_t message_validate_context::load_primary_i128i128( Name scope, Name code,
}
return copylen;
}
int32_t message_validate_context::load_secondary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
require_scope( scope );
const auto& idx = db.get_index<key128x128_value_index,by_scope_secondary>();
auto itr = idx.lower_bound( boost::make_tuple( uint64_t(scope),
uint64_t(code),
uint64_t(table),
*secondary, uint128_t(0) ) );
if( itr == idx.end() ||
itr->scope != (scope) ||
itr->code != (code) ||
itr->table != (table) ||
itr->secondary_key != *secondary ) return -1;
*primary = itr->primary_key;
auto copylen = std::min<size_t>(itr->value.size(),valuelen);
if( copylen ) {
itr->value.copy(value, copylen);
}
return copylen;
}
int32_t message_validate_context::lowerbound_primary_i128i128( Name scope, Name code, Name table,
uint128_t* primary, uint128_t* secondary, char* value, uint32_t valuelen ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册