Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
YottaChain
YTBP
提交
39bbd569
Y
YTBP
项目概览
YottaChain
/
YTBP
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Y
YTBP
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
39bbd569
编写于
6月 13, 2018
作者:
K
Kayan
提交者:
Kevin Heifner
7月 06, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
3695 support multiple secondary indexes
上级
5cec89f6
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
5 deletion
+10
-5
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
.../chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
+7
-5
programs/cleos/main.cpp
programs/cleos/main.cpp
+3
-0
未找到文件。
plugins/chain_plugin/include/eosio/chain_plugin/chain_plugin.hpp
浏览文件 @
39bbd569
...
...
@@ -214,6 +214,7 @@ public:
string
upper_bound
;
uint32_t
limit
=
10
;
string
sec_key_type
;
// type of secondary key if table_key is not primary
uint32_t
sec_index_position
=
0
;
// secondary index position, 0-first secondary index
};
struct
get_table_rows_result
{
...
...
@@ -307,17 +308,18 @@ public:
const
auto
*
t_id
=
d
.
find
<
chain
::
table_id_object
,
chain
::
by_code_scope_table
>
(
boost
::
make_tuple
(
p
.
code
,
scope
,
p
.
table
));
if
(
t_id
!=
nullptr
)
{
const
auto
&
secidx
=
d
.
get_index
<
IndexType
,
Scope
>
();
decltype
(
t_id
->
id
)
next_tid
(
t_id
->
id
.
_id
+
1
);
auto
lower
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
t_id
->
id
));
decltype
(
t_id
->
id
)
low_tid
(
t_id
->
id
.
_id
+
p
.
sec_index_position
);
decltype
(
t_id
->
id
)
next_tid
(
t_id
->
id
.
_id
+
p
.
sec_index_position
+
1
);
auto
lower
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
low_tid
));
auto
upper
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
next_tid
));
if
(
p
.
lower_bound
.
size
())
{
SecKeyType
lv
=
convert_to_type
<
SecKeyType
>
(
p
.
lower_bound
,
"lower_bound"
);
lower
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
t_id
->
id
,
conv
(
lv
)));
lower
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
low_t
id
,
conv
(
lv
)));
}
if
(
p
.
upper_bound
.
size
())
{
SecKeyType
uv
=
convert_to_type
<
SecKeyType
>
(
p
.
upper_bound
,
"upper_bound"
);
upper
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
t_id
->
id
,
conv
(
uv
)));
upper
=
secidx
.
lower_bound
(
boost
::
make_tuple
(
low_t
id
,
conv
(
uv
)));
}
vector
<
char
>
data
;
...
...
@@ -484,7 +486,7 @@ FC_REFLECT(eosio::chain_apis::read_only::get_block_header_state_params, (block_n
FC_REFLECT
(
eosio
::
chain_apis
::
read_write
::
push_transaction_results
,
(
transaction_id
)(
processed
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_params
,
(
json
)(
code
)(
scope
)(
table
)(
table_key
)(
lower_bound
)(
upper_bound
)(
limit
)(
sec_key_type
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_params
,
(
json
)(
code
)(
scope
)(
table
)(
table_key
)(
lower_bound
)(
upper_bound
)(
limit
)(
sec_key_type
)
(
sec_index_position
)
)
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_table_rows_result
,
(
rows
)(
more
)
);
FC_REFLECT
(
eosio
::
chain_apis
::
read_only
::
get_currency_balance_params
,
(
code
)(
account
)(
symbol
));
...
...
programs/cleos/main.cpp
浏览文件 @
39bbd569
...
...
@@ -1774,6 +1774,7 @@ int main( int argc, char** argv ) {
string
sec_key_type
;
bool
binary
=
false
;
uint32_t
limit
=
10
;
uint32_t
sec_index_position
=
0
;
auto
getTable
=
get
->
add_subcommand
(
"table"
,
localized
(
"Retrieve the contents of a database table"
),
false
);
getTable
->
add_option
(
"contract"
,
code
,
localized
(
"The contract who owns the table"
)
)
->
required
();
getTable
->
add_option
(
"scope"
,
scope
,
localized
(
"The scope within the contract in which the table is found"
)
)
->
required
();
...
...
@@ -1784,6 +1785,7 @@ int main( int argc, char** argv ) {
getTable
->
add_option
(
"-L,--lower"
,
lower
,
localized
(
"JSON representation of lower bound value of key, defaults to first"
)
);
getTable
->
add_option
(
"-U,--upper"
,
upper
,
localized
(
"JSON representation of upper bound value value of key, defaults to last"
)
);
getTable
->
add_option
(
"-t,--seckeytype"
,
sec_key_type
,
localized
(
"Secondary key type(i64,i128,i256,float64,float128)"
));
getTable
->
add_option
(
"-p,--secindexposition"
,
sec_index_position
,
localized
(
"Secondary index position, default to 0(first secondary index)"
));
getTable
->
set_callback
([
&
]
{
auto
result
=
call
(
get_table_func
,
fc
::
mutable_variant_object
(
"json"
,
!
binary
)
...
...
@@ -1795,6 +1797,7 @@ int main( int argc, char** argv ) {
(
"upper_bound"
,
upper
)
(
"limit"
,
limit
)
(
"sec_key_type"
,
sec_key_type
)
(
"sec_index_position"
,
sec_index_position
)
);
std
::
cout
<<
fc
::
json
::
to_pretty_string
(
result
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录