Sha256: 86a5ab249b04cfaa781ce9344b968d59687c9074cb8fa97de60a55b084e87fc9
Contents?: true
Size: 994 Bytes
Versions: 6
Compression:
Stored size: 994 Bytes
Contents
require_relative "../helpers/errors" module CsvImportAnalyzer module MysqlQueryHelper def form_query_for_datatype(args) unless args[:datatype].nil? || args[:header].nil? if args[:datatype] == :string return args[:header].to_s + " varchar(255)" else return args[:header].to_s + " " + args[:datatype].to_s end else MissingRequiredArguments.new("Required arguments missing for form_query_for_datatype") end end def import_csv(args) unless args[:tablename].nil? || args[:filename].nil? || args[:delimiter].nil? import_statement = "LOAD DATA INFILE #{args[:filename]} INTO TABLE #{args[:tablename]} "+ "FIELDS TERMINATED BY '#{args[:delimiter]}' "+ "ENCLOSED BY '\"' "+ "LINES TERMINATED BY '\\n' "+ "IGNORE 1 LINES;" else MissingRequiredArguments.new("Required arguments missing for import_csv") end end end end
Version data entries
6 entries across 6 versions & 1 rubygems