Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
a593e03d
Commit
a593e03d
authored
Oct 30, 2020
by
Sergei Petrunia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add dbug_print_sel_arg() debugging help function
parent
d6ea03fa
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
107 additions
and
0 deletions
+107
-0
sql/opt_range.cc
sql/opt_range.cc
+107
-0
No files found.
sql/opt_range.cc
View file @
a593e03d
...
...
@@ -14786,6 +14786,113 @@ static void print_ror_scans_arr(TABLE *table, const char *msg,
DBUG_VOID_RETURN
;
}
static
String
dbug_print_sel_arg_buf
;
static
void
print_sel_arg_key
(
Field
*
field
,
const
uchar
*
key
,
String
*
out
)
{
TABLE
*
table
=
field
->
table
;
my_bitmap_map
*
old_sets
[
2
];
dbug_tmp_use_all_columns
(
table
,
old_sets
,
table
->
read_set
,
table
->
write_set
);
if
(
field
->
real_maybe_null
())
{
if
(
*
key
)
{
out
->
append
(
"NULL"
);
goto
end
;
}
key
++
;
// Skip null byte
}
field
->
set_key_image
(
key
,
field
->
pack_length
());
if
(
field
->
type
()
==
MYSQL_TYPE_BIT
)
(
void
)
field
->
val_int_as_str
(
out
,
1
);
else
field
->
val_str
(
out
);
end:
dbug_tmp_restore_column_maps
(
table
->
read_set
,
table
->
write_set
,
old_sets
);
}
/*
@brief
Produce a string representation of an individual SEL_ARG and return pointer
to it
@detail
Intended usage:
(gdb) p dbug_print_sel_arg(ptr)
*/
const
char
*
dbug_print_sel_arg
(
SEL_ARG
*
sel_arg
)
{
StringBuffer
<
64
>
buf
;
String
&
out
=
dbug_print_sel_arg_buf
;
out
.
length
(
0
);
if
(
!
sel_arg
)
{
out
.
append
(
"NULL"
);
goto
end
;
}
out
.
append
(
"SEL_ARG("
);
const
char
*
stype
;
switch
(
sel_arg
->
type
)
{
case
SEL_ARG
:
:
IMPOSSIBLE
:
stype
=
"IMPOSSIBLE"
;
break
;
case
SEL_ARG
:
:
MAYBE
:
stype
=
"MAYBE"
;
break
;
case
SEL_ARG
:
:
MAYBE_KEY
:
stype
=
"MAYBE_KEY"
;
break
;
case
SEL_ARG
:
:
KEY_RANGE
:
default:
stype
=
nullptr
;
}
if
(
stype
)
{
out
.
append
(
"type="
);
out
.
append
(
stype
);
goto
end
;
}
if
(
sel_arg
->
min_flag
&
NO_MIN_RANGE
)
out
.
append
(
"-inf"
);
else
{
print_sel_arg_key
(
sel_arg
->
field
,
sel_arg
->
min_value
,
&
buf
);
out
.
append
(
buf
);
}
out
.
append
((
sel_arg
->
min_flag
&
NEAR_MIN
)
?
"<"
:
"<="
);
out
.
append
(
sel_arg
->
field
->
field_name
);
out
.
append
((
sel_arg
->
max_flag
&
NEAR_MAX
)
?
"<"
:
"<="
);
if
(
sel_arg
->
max_flag
&
NO_MAX_RANGE
)
out
.
append
(
"+inf"
);
else
{
print_sel_arg_key
(
sel_arg
->
field
,
sel_arg
->
max_value
,
&
buf
);
out
.
append
(
buf
);
}
out
.
append
(
")"
);
end:
return
dbug_print_sel_arg_buf
.
c_ptr_safe
();
}
/*****************************************************************************
** Print a quick range for debugging
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment