lib/csvsql.rb in csvsql-0.1.0 vs lib/csvsql.rb in csvsql-0.1.1
- old
+ new
@@ -4,17 +4,22 @@
require 'csv'
require 'sqlite3'
require 'csvsql/db'
+require 'csvsql/tracker'
module Csvsql
def self.execute(sql, csv_data, opts = {})
csvdb = Csvsql::Db.new(opts)
csvdb.import(csv_data)
- pst = csvdb.prepare(sql)
+ pst = Csvsql::Tracker.commit(:execute_query_sql) do
+ csvdb.prepare(sql)
+ end
+ Csvsql::Tracker.commit(:output_format)
CSV.generate do |csv|
csv << pst.columns.zip(pst.types).map { |c| c.compact.join(':') }
pst.each { |line| csv << line }
- end
+ end.tap { Csvsql::Tracker.commit(:output_format) }
end
end
+