Class: Flydata::Mysql::MysqlDumpParser::InsertParser
- Inherits:
-
Object
- Object
- Flydata::Mysql::MysqlDumpParser::InsertParser
- Defined in:
- lib/flydata/command/sync.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(file) ⇒ InsertParser
constructor
A new instance of InsertParser.
- #parse ⇒ Object
- #start_ruby_prof ⇒ Object
- #stop_ruby_prof ⇒ Object
Constructor Details
#initialize(file) ⇒ InsertParser
Returns a new instance of InsertParser.
1146 1147 1148 1149 1150 |
# File 'lib/flydata/command/sync.rb', line 1146 def initialize(file) @file = file @values = [] @values_set = [] end |
Instance Method Details
#parse ⇒ Object
1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 |
# File 'lib/flydata/command/sync.rb', line 1166 def parse start_ruby_prof bench_start_time = Time.now target_line = @file.readline _parse(target_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
1152 1153 1154 |
# File 'lib/flydata/command/sync.rb', line 1152 def start_ruby_prof RubyProf.start if defined?(RubyProf) and not RubyProf.running? end |
#stop_ruby_prof ⇒ Object
1156 1157 1158 1159 1160 1161 1162 1163 1164 |
# File 'lib/flydata/command/sync.rb', line 1156 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 |