mirror of
https://github.com/MariaDB/server.git
synced 2025-08-08 11:22:35 +03:00
MDEV-31721: Cursor protocol increases the counter of "Empty_queries" for select
Problem: Empty queries are incremented if no rows are sent to the client in the EXECUTE phase of select query. With cursor protocol, rows are not sent during EXECUTE phase; they are sent later in FETCH phase. Hence, queries executed with cursor protocol are always falsely treated as empty in EXECUTE phase. Fix: For cursor protocol, empty queries are now counted during the FETCH phase. This ensures counter correctly reflects whether any rows were actually sent to the client. Tests included in `mysql-test/main/show.test`.
This commit is contained in:
committed by
Raghunandan Bhat
parent
7ab205b009
commit
2c7cea28da
@@ -3767,6 +3767,9 @@ void mysqld_stmt_fetch(THD *thd, char *packet, uint packet_length)
|
||||
|
||||
cursor->fetch(num_rows);
|
||||
|
||||
if (!thd->get_sent_row_count())
|
||||
status_var_increment(thd->status_var.empty_queries);
|
||||
|
||||
if (!cursor->is_open())
|
||||
{
|
||||
stmt->close_cursor();
|
||||
|
Reference in New Issue
Block a user