Generate CSV from a query result object

@param ResultInterface $query     Query result object
@param string          $delim     Delimiter (default: ,)
@param string          $newline   Newline character (default: \n)
@param string          $enclosure Enclosure (default: ")

@return string