File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
1111 "github.com/sirupsen/logrus"
1212)
1313
14+ // Parser is the pârser object
1415type Parser struct {
1516 Source io.Reader
1617 StackSize int
@@ -76,9 +77,9 @@ func (p *Parser) scan() {
7677 for p .scanner .Scan () {
7778 line := p .scanner .Text ()
7879 // Drop useless lines
79- // if p.scanner.Text()[0] == '#' && strings.Contains(p.scanner.Text(), "Quit; ") {
80- // continue
81- // }
80+ if strings .Contains (p .scanner .Text (), "SET timestamp " ) {
81+ continue
82+ }
8283
8384 /*
8485 This big if/else statement detects if the curernt line in a header
@@ -134,7 +135,7 @@ func (p *Parser) consume() {
134135 if strings .HasPrefix (line , "#" ) {
135136 q .parseHeader (line )
136137 } else {
137- q .parseQuery ( line )
138+ q .Query = line
138139 }
139140 }
140141
@@ -173,12 +174,10 @@ func (q *Query) parseHeader(line string) {
173174 }
174175 } else if strings .Contains (part , "user@host" ) {
175176 items := re .FindAllString (line , - 1 )
176- q .User = items [0 ]
177- q .Host = items [1 ]
177+ // We remove first and last bytes of the strings because they are
178+ // square brackets
179+ q .User = items [0 ][1 : len (items [0 ])- 1 ]
180+ q .Host = items [1 ][1 : len (items [1 ])- 1 ]
178181 }
179182 }
180183}
181-
182- func (q * Query ) parseQuery (line string ) {
183- q .Query = q .Query + line
184- }
You can’t perform that action at this time.
0 commit comments