class CsvDb::Dump

Public Class Methods

after_table(io,table) click to toggle source
# File lib/csv_db.rb, line 55
def self.after_table(io,table)
  io.write ""
end
before_table(io,table) click to toggle source
# File lib/csv_db.rb, line 43
def self.before_table(io,table)
  io.write "BEGIN_CSV_TABLE_DECLARATION#{table}END_CSV_TABLE_DECLARATION\n"
end
dump(io) click to toggle source
# File lib/csv_db.rb, line 47
def self.dump(io)
  tables.each do |table|
    before_table(io, table)
    dump_table(io, table)
    after_table(io, table)
  end
end
dump_table_columns(io, table) click to toggle source
# File lib/csv_db.rb, line 59
def self.dump_table_columns(io, table)
  io.write(table_column_names(table).to_csv)
end
dump_table_records(io, table) click to toggle source
# File lib/csv_db.rb, line 63
def self.dump_table_records(io, table)

  column_names = table_column_names(table)

  each_table_page(table) do |records|
    rows = SerializationHelper::Utils.unhash_records(records, column_names)
    records.each do |record|
      io.write(record.to_csv)
    end
  end
end