1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Make testsuite to pass

- Drop all tables in explain_json.test
- Tabular form should print ref='' when type='fulltext' (another peculiarity
  of the traditional EXPLAIN format)
- String_list::append_str should allocate memory for \0, too
- Some temporary code for EXPLAIN JSON and join buffering.
This commit is contained in:
Sergei Petrunia
2014-11-21 21:44:06 +03:00
parent 305dd8e5fb
commit 3c5ce8a0a3
3 changed files with 15 additions and 4 deletions

View File

@ -174,5 +174,5 @@ EXPLAIN
}
}
}
drop table t1;
drop table t1,t2;
drop table t0;

View File

@ -38,5 +38,5 @@ explain format=json select * from t2 where a1=1 or (b1=2 and b2=3);
explain format=json select * from t0,t2 where t2.b1=t0.a and t2.b2=4;
drop table t1;
drop table t1,t2;
drop table t0;

View File

@ -721,7 +721,15 @@ int Explain_table_access::print_explain(select_result_sink *output, uint8 explai
/* `ref` */
StringBuffer<64> ref_list_buf;
if (ref_list.is_empty())
{
if (type == JT_FT)
{
/* Traditionally, EXPLAIN lines with type=fulltext have ref='' */
push_str(&item_list, "");
}
else
item_list.push_back(item_null);
}
else
push_string_list(&item_list, ref_list, &ref_list_buf);
@ -819,7 +827,7 @@ bool String_list::append_str(MEM_ROOT *mem_root, const char *str)
{
size_t len= strlen(str);
char *cp;
if (!(cp = (char*)alloc_root(mem_root, len)))
if (!(cp = (char*)alloc_root(mem_root, len+1)))
return 1;
memcpy(cp, str, len+1);
push_back(cp);
@ -880,6 +888,9 @@ void Explain_table_access::tag_to_json(Json_writer *writer, enum explain_extra_t
case ET_USING:
// index merge: case ET_USING
break;
case ET_USING_JOIN_BUFFER:
// TODO TODO
break;
default:
DBUG_ASSERT(0);
}