Sha256: 6b2663d69e67a2149914e0ad5903f9f0ec04b42c46114e80357b5a46c342488f

Contents?: true

Size: 619 Bytes

Versions: 1

Compression:

Stored size: 619 Bytes

Contents

module Wineskins

  module RecordMethods
  
    # reads + inserts ten records at a time
    def transfer_records(table)
      src_tbl, dst_tbl = table.source_name, table.dest_name
      rename = table.rename_map(source[src_tbl].columns)

      set_progressbar dst_tbl, source[src_tbl].count
      
      source[src_tbl].each_slice(10) do |recs|
        dest[dst_tbl].multi_insert(
          recs.map {|rec|
            remap = Utils.remap_hash(rec, rename)
            block_given? ? yield(remap) : remap           
          }
        )
        progressbar.inc(10) if progressbar
      end
    end
    
  end
  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wineskins-0.2.2 lib/wineskins/record_methods.rb