Sha256: 44a359ccd740dbaa58315992e2f59d7308127aa79874baadaa47940fa54d3586
Contents?: true
Size: 413 Bytes
Versions: 1
Compression:
Stored size: 413 Bytes
Contents
# frozen_string_literal: true require "csvsql/version" require 'csv' require 'sqlite3' require 'csvsql/db' module Csvsql def self.execute(sql, csv_data, opts = {}) csvdb = Csvsql::Db.new(opts) csvdb.import(csv_data) pst = csvdb.prepare(sql) CSV.generate do |csv| csv << pst.columns.zip(pst.types).map { |c| c.compact.join(':') } pst.each { |line| csv << line } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
csvsql-0.1.0 | lib/csvsql.rb |