Class: LoadDataInfile2::Client
- Inherits:
-
Mysql2::Client
- Object
- Mysql2::Client
- LoadDataInfile2::Client
- Defined in:
- lib/load_data_infile2/client.rb
Instance Attribute Summary collapse
-
#load_data_infile_options ⇒ Object
readonly
Returns the value of attribute load_data_infile_options.
Instance Method Summary collapse
- #import(file, options = {}) ⇒ Object
-
#initialize(config, options = {}) ⇒ Client
constructor
A new instance of Client.
- #quoted_table_name_for(table) ⇒ Object
Constructor Details
#initialize(config, options = {}) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/load_data_infile2/client.rb', line 8 def initialize(config, = {}) c = if [:local_infile] && !config.has_key?(:local_infile) && !config.has_key?('local_infile') config.merge(local_infile: true) else config end super(c) @load_data_infile_options = LoadDataInfile2..merge() @load_data_infile_options[:charset] = [:charset] unless .has_key?(:charset) end |
Instance Attribute Details
#load_data_infile_options ⇒ Object (readonly)
Returns the value of attribute load_data_infile_options.
6 7 8 |
# File 'lib/load_data_infile2/client.rb', line 6 def @load_data_infile_options end |
Instance Method Details
#import(file, options = {}) ⇒ Object
20 21 22 |
# File 'lib/load_data_infile2/client.rb', line 20 def import(file, = {}) query(build_sql(file, )) end |
#quoted_table_name_for(table) ⇒ Object
24 25 26 |
# File 'lib/load_data_infile2/client.rb', line 24 def quoted_table_name_for(table) [[:database], table].compact.map!{|w| "`#{w}`"}.join('.') end |