fix the method exporting the result of a SQL query in class Database