Query Exporting

Now supports exporting of query results (mainly useful for SELECT
queries) to CSV files