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



455
456
457
458
459
460
461
462
463
464
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 455

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’);



441
442
443
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 441

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

#stop_ruby_profObject



445
446
447
448
449
450
451
452
453
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 445

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