bug #4602 Exporting selected rows exports all rows of the query

Signed-off-by: Madhura Jayaratne <madhura.cj@gmail.com>