Commit c1a7cfb7 authored by unknown's avatar unknown
Browse files

Fix mysql_info() returning bad data in the results of a multi-statement

query that mixed statements that do and do not return info. (Bug #11688)


mysql-test/r/metadata.result:
  Add new results
mysql-test/t/metadata.test:
  Add new regression test
sql-common/client.c:
  Clear mysql->info in free_old_query()
parent 888a9314
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -85,3 +85,14 @@ def aaa 1 1 8 20 1 N 32769 0 63
1
1
drop table t1;
create table t1 (i int);
insert into t1 values (1),(2),(3);
select * from t1 where i = 2;
drop table t1;//
affected rows: 0
affected rows: 3
info: Records: 3  Duplicates: 0  Warnings: 0
i
2
affected rows: 1
affected rows: 0
+12 −0
Original line number Diff line number Diff line
@@ -49,4 +49,16 @@ drop table t1;

--disable_metadata

#
# Bug #11688: Bad mysql_info() results in multi-results
#
--enable_info
delimiter //;
create table t1 (i int);
insert into t1 values (1),(2),(3);
select * from t1 where i = 2;
drop table t1;//
delimiter ;//
--disable_info

# End of 4.1 tests
+3 −2
Original line number Diff line number Diff line
@@ -715,6 +715,7 @@ void free_old_query(MYSQL *mysql)
  init_alloc_root(&mysql->field_alloc,8192,0); /* Assume rowlength < 8192 */
  mysql->fields= 0;
  mysql->field_count= 0;			/* For API */
  mysql->info= 0;
  DBUG_VOID_RETURN;
}