Commit 365960a0 authored by Alexey Botchkov's avatar Alexey Botchkov

MDEV-5138 Numerous test failures in "mtr --ps --embedded".

  As Davi added code like
          sav_protocol= thd->protocol
          thd->protocol= &thd->protocol_binary
          ...
          thd->protocol= sav_protocol
  the fucntions like emb_store_querycache_result() cannot determine
  the used protocol testing thd->protocol == &thd->protocol_binary.
  Fixed by additional check thd->command == COM_STMT_EXECUTE.
parent 7d103311
...@@ -316,7 +316,8 @@ uint emb_count_querycache_size(THD *thd) ...@@ -316,7 +316,8 @@ uint emb_count_querycache_size(THD *thd)
result+= field->def_length; result+= field->def_length;
} }
if (thd->protocol == &thd->protocol_binary) if (thd->protocol == &thd->protocol_binary ||
thd->command == COM_STMT_EXECUTE)
{ {
result+= (uint) (4*n_rows); result+= (uint) (4*n_rows);
for (; cur_row; cur_row=cur_row->next) for (; cur_row; cur_row=cur_row->next)
...@@ -379,7 +380,8 @@ void emb_store_querycache_result(Querycache_stream *dst, THD *thd) ...@@ -379,7 +380,8 @@ void emb_store_querycache_result(Querycache_stream *dst, THD *thd)
dst->store_safe_str(field->def, field->def_length); dst->store_safe_str(field->def, field->def_length);
} }
if (thd->protocol == &thd->protocol_binary) if (thd->protocol == &thd->protocol_binary ||
thd->command == COM_STMT_EXECUTE)
{ {
for (; cur_row; cur_row=cur_row->next) for (; cur_row; cur_row=cur_row->next)
dst->store_str((char *) cur_row->data, cur_row->length); dst->store_str((char *) cur_row->data, cur_row->length);
...@@ -447,7 +449,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src) ...@@ -447,7 +449,8 @@ int emb_load_querycache_result(THD *thd, Querycache_stream *src)
data->rows= rows; data->rows= rows;
if (!rows) if (!rows)
goto return_ok; goto return_ok;
if (thd->protocol == &thd->protocol_binary) if (thd->protocol == &thd->protocol_binary ||
thd->command == COM_STMT_EXECUTE)
{ {
uint length; uint length;
row= (MYSQL_ROWS *)alloc_root(&data->alloc, row= (MYSQL_ROWS *)alloc_root(&data->alloc,
......
...@@ -13,6 +13,12 @@ a ...@@ -13,6 +13,12 @@ a
2 2
3 3
4 4
SELECT * FROM t1;
a
1
2
3
4
DROP TABLE t1; DROP TABLE t1;
# #
# End of 5.5 tests # End of 5.5 tests
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
CREATE TABLE t1 (a INT); CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2),(3),(4); INSERT INTO t1 VALUES (1),(2),(3),(4);
SELECT * FROM t1; SELECT * FROM t1;
SELECT * FROM t1;
DROP TABLE t1; DROP TABLE t1;
--echo # --echo #
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment