Class: MySQLLogLine
- Inherits:
-
Object
- Object
- MySQLLogLine
- Defined in:
- lib/pqa.rb
Overview
MySQL Parsing is broken
Constant Summary collapse
- DISCARD =
Regexp.new("(^Time )|(^Tcp)|( Quit )|( USE )|(Connect)")
- START_QUERY =
Regexp.new('\d{1,5} Query')
Instance Attribute Summary collapse
-
#is_new_query ⇒ Object
readonly
Returns the value of attribute is_new_query.
-
#recognized ⇒ Object
readonly
Returns the value of attribute recognized.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Instance Method Summary collapse
-
#initialize(text) ⇒ MySQLLogLine
constructor
A new instance of MySQLLogLine.
- #is_continuation ⇒ Object
- #is_duration_line ⇒ Object
- #parse_query_segment ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(text) ⇒ MySQLLogLine
Returns a new instance of MySQLLogLine.
122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/pqa.rb', line 122 def initialize(text) @recognized = true @is_new_query = false if DISCARD.match(text) != nil @recognized = false return end @text = text @is_new_query = START_QUERY.match(@text) != nil end |
Instance Attribute Details
#is_new_query ⇒ Object (readonly)
Returns the value of attribute is_new_query.
120 121 122 |
# File 'lib/pqa.rb', line 120 def is_new_query @is_new_query end |
#recognized ⇒ Object (readonly)
Returns the value of attribute recognized.
120 121 122 |
# File 'lib/pqa.rb', line 120 def recognized @recognized end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
120 121 122 |
# File 'lib/pqa.rb', line 120 def text @text end |
Instance Method Details
#is_continuation ⇒ Object
134 135 136 |
# File 'lib/pqa.rb', line 134 def is_continuation @recognized && !/^(\d{1,6})|(\s*)/.match(@text).nil? end |
#is_duration_line ⇒ Object
138 139 140 |
# File 'lib/pqa.rb', line 138 def is_duration_line false end |
#parse_query_segment ⇒ Object
142 143 144 145 146 147 148 149 |
# File 'lib/pqa.rb', line 142 def parse_query_segment if @is_new_query tmp = START_QUERY.match(@text.strip) raise StandardError.new("PQA identified a line as the start of a new query, but then was unable to match it with the START_QUERY Regex. #{BUG_URL_STRING}") if tmp == nil return tmp.post_match.strip end @text.strip.chomp end |
#to_s ⇒ Object
151 152 153 |
# File 'lib/pqa.rb', line 151 def to_s @text end |