Class: Flydata::Parser::Mysql::MysqlDumpParser::InsertParser
- Inherits:
-
Object
- Object
- Flydata::Parser::Mysql::MysqlDumpParser::InsertParser
- 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');
Defined Under Namespace
Modules: State
Instance Method Summary collapse
-
#initialize ⇒ InsertParser
constructor
A new instance of InsertParser.
- #parse(line) ⇒ Object
- #start_ruby_prof ⇒ Object
- #stop_ruby_prof ⇒ Object
Constructor Details
#initialize ⇒ InsertParser
Returns a new instance of InsertParser.
436 437 438 439 |
# File 'lib/flydata/parser/mysql/dump_parser.rb', line 436 def initialize @values = [] @values_set = [] end |
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_prof ⇒ Object
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_prof ⇒ Object
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 |