Method: MysqlImport#initialize

Defined in:
lib/mysql_import.rb

#initialize(config, opts = {}) ⇒ MysqlImport

Returns a new instance of MysqlImport.



9
10
11
12
13
14
15
16
17
18
# File 'lib/mysql_import.rb', line 9

def initialize(config, opts = {})
  @stash = []
  @lock = opts.fetch(:lock, false)
  @concurrency = opts.has_key?(:concurrency) ? opts[:concurrency].to_i : 2
  pool = @concurrency.zero? ? 1 : @concurrency
  sql_opts = opts.fetch(:sql_opts, {})

  @client = ConnectionPool.new(size: pool) { LoadDataInfile2::Client.new(config, sql_opts) }
  @result = Result.new
end