Details
Description
SQL_CALC_FOUND_ROWS not working properly, gives output zero because send_records is not getting incremented properly.
|
MariaDB [test]> SELECT SQL_CALC_FOUND_ROWS 1 FROM DUAL WHERE 0;
|
Empty set (0.00 sec)
|
|
MariaDB [test]> SELECT FOUND_ROWS();
|
+--------------+
|
| FOUND_ROWS() |
|
+--------------+
|
| 0 |
|
+--------------+
|
1 row in set (0.00 sec)
|
|
|
send_records in JOIN::exec_inner() was assigning 0 directly to send_records without checking if the flag that represents SQL_CALC_FOUND_ROWS is set. If it is set, send_records should be 1 otherwise 0.