mysql-innodb-自定义函数-函数参数赋值-记录
  TEZNKK3IfmPf 2023年11月14日 22 0

mysql-innodb-自定义函数-函数参数赋值-记录

逻辑记录:

函数参数传值的函数调用:

(gdb) bt
#0 Item_func::fix_func_arg (this=0x7f048c03e378, thd=0x7f048c014a40, arg=0x7f048c03e428) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/item_func.cc:294
#1 0x0000000001d5ef0a in Item_func::fix_fields (this=0x7f048c03e378, thd=0x7f048c014a40, ref=0x7f048c03cc00) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/item_func.cc:269
#2 0x00000000023360cf in st_select_lex::setup_conds (this=0x7f048c03cb28, thd=0x7f048c014a40) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_resolver.cc:1191
#3 0x0000000002333f5c in st_select_lex::prepare (this=0x7f048c03cb28, thd=0x7f048c014a40) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_resolver.cc:212
#4 0x000000000233f203 in handle_query (thd=0x7f048c014a40, lex=0x7f048c03c110, result=0x7f048c03da08, added_options=0, removed_options=0, optimize_after_bh=0, free_join_from_bh=0)
at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_select.cc:139
#5 0x000000000230024b in execute_sqlcom_select (thd=0x7f048c014a40, all_tables=0x7f048c03dc00) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:5184
#6 0x00000000022fa039 in mysql_execute_command (thd=0x7f048c014a40, first_level=false) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:2831
#7 0x00000000022655d2 in sp_instr_stmt::exec_core (this=0x7f048c03e568, thd=0x7f048c014a40, nextp=0x7f085ae23298) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sp_instr.cc:1027
#8 0x0000000002264475 in sp_lex_instr::reset_lex_and_exec_core (this=0x7f048c03e568, thd=0x7f048c014a40, nextp=0x7f085ae23298, open_tables=false)
at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sp_instr.cc:452
#9 0x0000000002264e5c in sp_lex_instr::validate_lex_and_execute_core (this=0x7f048c03e568, thd=0x7f048c014a40, nextp=0x7f085ae23298, open_tables=false)
at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sp_instr.cc:753
#10 0x000000000226532a in sp_instr_stmt::execute (this=0x7f048c03e568, thd=0x7f048c014a40, nextp=0x7f085ae23298) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sp_instr.cc:938
#11 0x000000000225dfef in sp_head::execute (this=0x7f048c035a50, thd=0x7f048c014a40, merge_da_on_success=true) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sp_head.cc:796
#12 0x000000000225efb1 in sp_head::execute_function (this=0x7f048c035a50, thd=0x7f048c014a40, argp=0x7f048c019c28, argcount=1, return_value_fld=0x7f048c0127b0)
at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sp_head.cc:1287
#13 0x0000000001d770f3 in Item_func_sp::execute_impl (this=0x7f048c019b80, thd=0x7f048c014a40) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/item_func.cc:8760
#14 0x0000000001d76e46 in Item_func_sp::execute (this=0x7f048c019b80) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/item_func.cc:8691
#15 0x0000000001d5d8d0 in Item_func_sp::val_int (this=0x7f048c019b80) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/item_func.h:2741
#16 0x0000000001d08464 in Item::send (this=0x7f048c019b80, protocol=0x7f048c015aa0, buffer=0x7f085ae24690) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/item.cc:7572
#17 0x00000000022acb79 in THD::send_result_set_row (this=0x7f048c014a40, row_items=0x7f048c018508) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_class.cc:4757
#18 0x00000000022a7be4 in Query_result_send::send_data (this=0x7f048c022340, items=...) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_class.cc:2742
#19 0x00000000022c027a in end_send (join=0x7f048c0128f0, qep_tab=0x7f048c08e1f8, end_of_records=false) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_executor.cc:2936
#20 0x00000000024e6328 in JOIN_CACHE::generate_full_extensions (this=0x7f048c08e1f8, rec_ptr=0x7f048c04ab71 "\001\001")
at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_join_buffer.cc:2258
#21 0x00000000024e6061 in JOIN_CACHE_BNL::join_matching_records (this=0x7f048c08e1f8, skip_last=false) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_join_buffer.cc:2141
#22 0x00000000024e5a9a in JOIN_CACHE::join_records (this=0x7f048c08e1f8, skip_last=false) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_join_buffer.cc:1938
#23 0x00000000024e2211 in JOIN_CACHE::end_send (this=0x7f048c08e1f8) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_join_buffer.h:467
#24 0x00000000022bcd23 in sub_select_op (join=0x7f048c0128f0, qep_tab=0x7f048c08e080, end_of_records=true) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_executor.cc:1076
#25 0x00000000022bcdd4 in sub_select (join=0x7f048c0128f0, qep_tab=0x7f048c08df08, end_of_records=true) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_executor.cc:1233
#26 0x00000000022bcb2f in do_select (join=0x7f048c0128f0) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_executor.cc:959
#27 0x00000000022badc9 in JOIN::exec (this=0x7f048c0128f0) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_executor.cc:206
#28 0x000000000233f351 in handle_query (thd=0x7f048c014a40, lex=0x7f048c016bb8, result=0x7f048c022340, added_options=0, removed_options=0, optimize_after_bh=0, free_join_from_bh=0)
at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_select.cc:195
#29 0x000000000230024b in execute_sqlcom_select (thd=0x7f048c014a40, all_tables=0x7f048c0210e8) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:5184
#30 0x00000000022fa039 in mysql_execute_command (thd=0x7f048c014a40, first_level=true) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:2831
#31 0x0000000002300f18 in mysql_parse (thd=0x7f048c014a40, parser_state=0x7f085ae25f00) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:5621
#32 0x00000000022f7362 in dispatch_command (thd=0x7f048c014a40, com_data=0x7f085ae26660, command=COM_QUERY) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:1495
#33 0x00000000022f6505 in do_command (thd=0x7f048c014a40) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/sql_parse.cc:1034
#34 0x00000000023fa44b in handle_connection (arg=0x727cd60) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/sql/conn_handler/connection_handler_per_thread.cc:313
#35 0x0000000002916081 in pfs_spawn_thread (arg=0x724c220) at /data2/jenkins/workspace/stonedb5.7-zsl-centos7.9-30-238/storage/perfschema/pfs.cc:2197
#36 0x00007f08a5dd4ea5 in start_thread (arg=0x7f085ae27700) at pthread_create.c:307
#37 0x00007f08a331db0d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:111

参数值:

(gdb) p str
$21 = {
m_ptr = 0x7f048c0358f0 "1",
m_length = 1,
m_charset = 0x3d932c0 <my_charset_latin1>,
m_alloced_length = 16,
m_is_alloced = true
}
(gdb) p *item_field
$22 = {
<Item_ident> = {
<Item> = {
<Parse_tree_node> = {
_vptr.Parse_tree_node = 0x3c75880 <vtable for Item_splocal+16>
},
members of Item:
is_expensive_cache = -1 '\377',
rsize = 0,
str_value = {
m_ptr = 0x7f048c0358f0 "1",
m_length = 1,
m_charset = 0x3d932c0 <my_charset_latin1>,
m_alloced_length = 0,
m_is_alloced = false
},
item_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
orig_name = {
<Name_string> = {
<Simple_cstring> = {
m_str = 0x0,
m_length = 0
}, <No data fields>},
members of Item_name_string:
m_is_autogenerated = true
},
next = 0x7f048c03d760,
max_length = 11,
marker = 0,
decimals = 0 '\000',
maybe_null = 1 '\001',
null_value = 0 '\000',
unsigned_flag = 0 '\000',
with_sum_func = 0 '\000',
fixed = 1 '\001',
collation = {
---Type <return> to continue, or q <return> to quit---
collation = 0x3d932c0 <my_charset_latin1>,
derivation = DERIVATION_NUMERIC,
repertoire = 1
},
cmp_context = INT_RESULT,
runtime_item = false,
derived_used = false,
with_subselect = 0 '\000',
with_stored_program = 0 '\000',
tables_locked_cache = false,
is_parser_item = false
},
members of Item_ident:
orig_db_name = 0x7f048c014a40 "(.\320\003",
orig_table_name = 0x7f048c03d758 "id",
orig_field_name = 0x2 <Address 0x2 out of bounds>,
m_alias_of_expr = 80,
context = 0x500000000,
db_name = 0x300000002 <Address 0x300000002 out of bounds>,
table_name = 0x4d0dc51600 <Address 0x4d0dc51600 out of bounds>,
field_name = 0xb616e70000000002 <Address 0xb616e70000000002 out of bounds>,
cached_field_index = 63449952,
cached_table = 0xe65d0bff,
depended_from = 0x0
},
members of Item_field:
table_ref = 0x0,
field = 0x3d8b2a0 <my_charset_bin>,
result_field = 0xc5b9010000000000,
item_equal = 0x0,
no_const_subst = false,
have_privileges = 0,
any_privileges = true
}

2022-09-23 mysql-innodb-自定义函数-函数参数赋值-记录

 

核心函数:

获取Item内的值的辅助函数:

{
Item* item = arg[0];
Item_result ret = item->result_type();
if (ret == DECIMAL_RESULT || ret == REAL_RESULT || ret == INT_RESULT)
{
Item_field* item_field = (Item_field*)item;

String str;
String* str_value = item->val_str(&str);
if (str_value)
{
String* value = str_value;
}
// TIANMU_LOG(LogCtl_Level::INFO, "Item_func::fix_func_arg str_value = %s", str_value);
}
}
【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月14日 0

暂无评论

推荐阅读
  TEZNKK3IfmPf   2024年05月31日   27   0   0 mysql
  TEZNKK3IfmPf   2024年05月31日   27   0   0 sqlite数据库
  TEZNKK3IfmPf   2024年05月31日   31   0   0 数据库mysql
  TEZNKK3IfmPf   2024年05月31日   27   0   0 数据库mysql
TEZNKK3IfmPf