def csv_string_io(sql, fetch_size = 1000)
      results = @statement.execute_query(sql)
      results.set_fetch_size(fetch_size)

      column_count = results.get_meta_data.get_column_count
      headers = 1.upto(column_count).map{|i| results.get_meta_data.get_column_name(i)}

      enum = Enumerator.new do |y|
        finished = false
        while(!finished) do
          rows = []
          csv_string = CSV.generate do |csv|

            fetch_size.times do
              unless results.next
                finished = true
                break
              end
              values = 1.upto(column_count).map{|i| to_ruby_type(results.get_object(i)) }
              csv << values
            end
          end
          y << StringIO.new(csv_string)
        end
      end

      return [headers, enum]
    end
def csv_string_io(sql, fetch_size = 1000)
      results = @statement.execute_query(sql)
      results.set_fetch_size(fetch_size)

      column_count = results.get_meta_data.get_column_count
      headers = 1.upto(column_count).map{|i| results.get_meta_data.get_column_name(i)}

      enum = Enumerator.new do |y|
        finished = false
        while(!finished) do
          rows = []
          csv_string = CSV.generate do |csv|

            fetch_size.times do
              unless results.next
                finished = true
                break
              end
              values = 1.upto(column_count).map{|i| to_ruby_type(results.get_object(i)) }
              csv << values
            end
          end
          y << StringIO.new(csv_string)
        end
      end

      return [headers, enum]
    end
returns an array of column names, and an enumberator,
 each item of the enumerator contains a single StringIO object, the value
 of which is a CSV string containing [step] rows.