Class: Flydata::Parser::Mysql::MysqlDumpParser::InsertParser

Inherits:
Object
  • Object
show all
Defined in:
lib/flydata/parser/mysql/dump_parser.rb

Overview

Parse the insert line containing multiple values. (max line size is 1kb)

ex) INSERT INTO `data_entries` VALUES (2,2,'access_log'), (2,3,'access_log2');

Instance Method Summary collapse

Instance Method Details

#parse(line) ⇒ Object


478
479
480
481
482
483
484
485
486
487
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 478

def parse(line)
  start_ruby_prof
  bench_start_time = Time.now
  _parse(line)
ensure
  stop_ruby_prof
  if ENV['FLYDATA_BENCHMARK']
    puts " -> time:#{Time.now.to_f - bench_start_time.to_f} size:#{target_line.size}"
  end
end

#start_ruby_profObject

INSERT INTO `data_entries` VALUES (2,2,'access_log'), (2,3,'access_log2');


464
465
466
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 464

def start_ruby_prof
  RubyProf.start if defined?(RubyProf) and not RubyProf.running?
end

#stop_ruby_profObject


468
469
470
471
472
473
474
475
476
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 468

def stop_ruby_prof
  if defined?(RubyProf) and RubyProf.running?
    result = RubyProf.stop
    #printer = RubyProf::GraphPrinter.new(result)
    printer = RubyProf::GraphHtmlPrinter.new(result)
    #printer.print(STDOUT)
    printer.print(File.new("ruby-prof-out-#{Time.now.to_i}.html", "w"), :min_percent => 3)
  end
end