summaryrefslogtreecommitdiff
path: root/sql/sql_explain.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2014-09-03 18:24:31 +0400
committerAlexander Barkov <bar@mariadb.org>2014-09-03 18:24:31 +0400
commit1e66871713b7196daf1e9416823d57d5bbac85a1 (patch)
treef49b6a2573150629e28ec81ab2d59d0b8d2fcaf4 /sql/sql_explain.cc
parente42f4e31990d7741e7c375f1102c4584a507c05f (diff)
downloadmariadb-git-1e66871713b7196daf1e9416823d57d5bbac85a1.tar.gz
Adding Item_string_sys and Item_string_ascii to reduce duplicate code
Diffstat (limited to 'sql/sql_explain.cc')
-rw-r--r--sql/sql_explain.cc20
1 files changed, 7 insertions, 13 deletions
diff --git a/sql/sql_explain.cc b/sql/sql_explain.cc
index 84ff8759d96..2b523b323a4 100644
--- a/sql/sql_explain.cc
+++ b/sql/sql_explain.cc
@@ -203,15 +203,13 @@ bool Explain_query::print_explain_str(THD *thd, String *out_str)
static void push_str(List<Item> *item_list, const char *str)
{
- item_list->push_back(new Item_string(str,
- strlen(str), system_charset_info));
+ item_list->push_back(new Item_string_sys(str));
}
static void push_string(List<Item> *item_list, String *str)
{
- item_list->push_back(new Item_string(str->ptr(), str->length(),
- system_charset_info));
+ item_list->push_back(new Item_string_sys(str->ptr(), str->length()));
}
@@ -262,8 +260,7 @@ int Explain_union::print_explain(Explain_query *query,
len+= lastop;
table_name_buffer[len - 1]= '>'; // change ',' to '>'
}
- const CHARSET_INFO *cs= system_charset_info;
- item_list.push_back(new Item_string(table_name_buffer, len, cs));
+ item_list.push_back(new Item_string_sys(table_name_buffer, len));
}
/* `partitions` column */
@@ -298,8 +295,7 @@ int Explain_union::print_explain(Explain_query *query,
{
extra_buf.append(STRING_WITH_LEN("Using filesort"));
}
- const CHARSET_INFO *cs= system_charset_info;
- item_list.push_back(new Item_string(extra_buf.ptr(), extra_buf.length(), cs));
+ item_list.push_back(new Item_string_sys(extra_buf.ptr(), extra_buf.length()));
//output->unit.offset_limit_cnt= 0;
if (output->send_data(item_list))
@@ -349,12 +345,10 @@ int Explain_select::print_explain(Explain_query *query,
if (message)
{
List<Item> item_list;
- const CHARSET_INFO *cs= system_charset_info;
Item *item_null= new Item_null();
item_list.push_back(new Item_int((int32) select_id));
- item_list.push_back(new Item_string(select_type,
- strlen(select_type), cs));
+ item_list.push_back(new Item_string_sys(select_type));
for (uint i=0 ; i < 7; i++)
item_list.push_back(item_null);
if (explain_flags & DESCRIBE_PARTITIONS)
@@ -362,7 +356,7 @@ int Explain_select::print_explain(Explain_query *query,
if (explain_flags & DESCRIBE_EXTENDED)
item_list.push_back(item_null);
- item_list.push_back(new Item_string(message,strlen(message),cs));
+ item_list.push_back(new Item_string_sys(message));
if (output->send_data(item_list))
return 1;
@@ -560,7 +554,7 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
extra_buf.append(STRING_WITH_LEN("Using filesort"));
}
- item_list.push_back(new Item_string(extra_buf.ptr(), extra_buf.length(), cs));
+ item_list.push_back(new Item_string_sys(extra_buf.ptr(), extra_buf.length()));
if (output->send_data(item_list))
return 1;