proxysql_query_log-parser 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4966444a16781f8d1bd840ad809dcdd8f7a0252d1178769746ad0b96e7ec97d8
4
- data.tar.gz: 3e7e50eb10a369739003f91b2e93b172378618707fc8678c5cd91dd898c876f1
3
+ metadata.gz: 92a8e1aa363f5f9ceb7939acbc2c81d279d9c68727ccba49398a067942c6f8cd
4
+ data.tar.gz: d8d882f082e4ad02d7d89236aec57363b72f2c9ba087d5382a4761c4464d4a48
5
5
  SHA512:
6
- metadata.gz: a2fe520f18b3a260faeacf6c95a50f5274444383d3535e3a39b244ea6bc8b06e51ebdaa90297b2d170b514dc906796b391ba8933633454e1bc37d53a0ee0e644
7
- data.tar.gz: 5aa401aa0ab2dbe5e009138b3a249e3da58cb190f0cf89981bced105599ba0185f3b66caaae4b341acc555d109e261e1d1cf8c91f41a03b62f96382f5d1f18a6
6
+ metadata.gz: cfea8ec9fd34500d72d2cdfed032a20b60595afcf16a8f3ee6927e8c59dfb737df669b454ceaa35c3257fe69187aca1c3f8fc0eac73c3f53cf83c5bd633ed1b8
7
+ data.tar.gz: 1f20f70b26c24d3d3dd7afd347682990ef31461b4785817a3c3d87ce026bb81f6b69d9b1a1f350c093529dc021718b494a918d24024c1ccb47bb80cf541ef685
@@ -4,6 +4,8 @@ require 'proxysql_query_log/parser/parser'
4
4
  require 'proxysql_query_log/parser/query'
5
5
  require 'proxysql_query_log/parser/version'
6
6
 
7
+ UINT64_MAX = 18446744073709551615
8
+
7
9
  module ProxysqlQueryLog
8
10
 
9
11
  end
@@ -9,12 +9,9 @@ module ProxysqlQueryLog
9
9
  queries = []
10
10
 
11
11
  while true
12
- raw_total_bytes = io.read(1)
12
+ raw_total_bytes = io.read(8)
13
13
  break unless raw_total_bytes
14
- total_bytes = raw_total_bytes.unpack1('C')
15
- io.seek(7, IO::SEEK_CUR)
16
- raw = io.read(total_bytes)
17
- queries << parse(StringIO.new(raw, 'r+'))
14
+ queries << parse(io)
18
15
  end
19
16
  queries
20
17
  end
@@ -27,7 +24,9 @@ module ProxysqlQueryLog
27
24
  q.schema_name = parse_schema_name(io)
28
25
  q.client = parse_client(io)
29
26
  q.hid = parse_hid(io)
30
- q.server = parse_server(io)
27
+ unless q.hid == UINT64_MAX
28
+ q.server = parse_server(io)
29
+ end
31
30
  q.start_time = parse_start_time(io)
32
31
  q.end_time = parse_end_time(io)
33
32
  q.digest = parse_digest(io)
@@ -98,12 +97,20 @@ module ProxysqlQueryLog
98
97
  end
99
98
 
100
99
  def read_encoded_length(io)
101
- buf = io.read(1).unpack('C')
102
- len = mysql_decode_length(buf[0])
100
+ buf = io.read(1).unpack1('C')
101
+ len = mysql_decode_length(buf)
103
102
  unless len == 0
104
- buf2 = io.read(len-1).unpack('C*')
105
- buf.concat(buf2)
106
- return buf == 0 ? 0 : buf[0]
103
+ buf2 = case len
104
+ when 1
105
+ buf
106
+ when 3
107
+ (io.read(len-1) + ("\x00" * (9 - len))).unpack1('Q*')
108
+ when 4
109
+ (io.read(3) + ("\x00")).unpack1('l*')
110
+ when 9
111
+ io.read(8).unpack1('Q*')
112
+ end
113
+ return buf2
107
114
  end
108
115
  end
109
116
 
@@ -1,5 +1,5 @@
1
1
  module ProxysqlQueryLog
2
2
  class Parser
3
- VERSION = "0.0.2"
3
+ VERSION = "0.0.3"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: proxysql_query_log-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - r_takaishi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-05-29 00:00:00.000000000 Z
11
+ date: 2018-09-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler