Method: EchiConverter#insert_dat_data

Defined in:
lib/echi-converter.rb

#insert_dat_data(tablename, row) ⇒ Object



362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
# File 'lib/echi-converter.rb', line 362

def insert_dat_data tablename, row
  @log.debug "insert_dat_data method"
  begin
    case tablename
    when "echi_acds"
      echi_dat_record = EchiAcd.new
    when "echi_agents"
      echi_dat_record = EchiAgent.new
    when "echi_reasons"
      echi_dat_record = EchiReason.new
    when "echi_cwcs"
      echi_dat_record = EchiCwc.new
    when "echi_splits"
      echi_dat_record = EchiSplit.new
    when "echi_trunks"
      echi_dat_record = EchiTrunk.new
    when "echi_vdns"
      echi_dat_record = EchiVdn.new
    when "echi_vectors"
      echi_dat_record = EchiVector.new
    end
    cnt = 0
    @echi_schema[tablename].each do | field |
      echi_dat_record[field["name"]] = row[cnt]
      cnt += 1
    end
    echi_dat_record.save
  rescue => err
    @log.info "Unable to insert " + tablename + " file record - " + err
  end
 
end