Method: Sip::Sipper#create_script

Defined in:
lib/sip/sipper.rb

#create_script(slavename, index, dbconf, tableconf, db, max, method) ⇒ Object



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/sip/sipper.rb', line 68

def create_script(slavename, index, dbconf, tableconf, db, max, method)
  if method == :append
    first, last = get_even_split(tableconf['incremental_index_value']+1, max, index, @slaves.length)
  else
    first, last = 1, max
  end

  log "Importing #{first} <= #{tableconf['incremental_index']} <= #{last} from table #{dbconf['dbname']}.#{tableconf['tablename']}"
  select = db.generate_command tableconf, first, last
  transpart_opts = generate_transpart_options(tableconf, db)
  Utils::write_script self, slavename, select, dbconf['dbname'], tableconf['tablename'], transpart_opts
end