mysql_binlog 0.3.3 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d4cb94c1699fea0fcfb90ef92d1d09d15dadb5a5
4
- data.tar.gz: d6dcf06a12be0f42347344d250156f34a2ecf962
3
+ metadata.gz: a369e0a06cfbe3cd3d5f0fff501e0956e7138abc
4
+ data.tar.gz: 45dd1afcf6a14152aa63c03cc4d79175babab607
5
5
  SHA512:
6
- metadata.gz: 7920efabe0e87c67d041d6712afeb2d27cd72978504e314ab4b9ee78fdeeaff2895e363c896a45972d3c0eeabd6ad84495c8f591013e137ed65893762111291b
7
- data.tar.gz: c82e4f6b2fbf47de40505c70a310eca59e96f03c2cd85da4435cb69d582d80a3a597ea865ef43257547a927df83b03caa42b29bcc29f36b374b0e7a0f649b12c
6
+ metadata.gz: 3dd3c45cfa72070a7ac471d7c9ccf33c408f8103b697cf2cbf852be01f4fbc48f7f04095193603327b7ce2b1bfd50916eb6658c8b391659be5bc7ad650738545
7
+ data.tar.gz: bb698d2f9fd0865f137158b132381ad95eb8434f0d79efbe048399a52b528f38c4e94e508f198c1a99547f776b16b1468b729a1fd50e972c3dbae357cfaa1030
@@ -64,6 +64,11 @@ module MysqlBinlog
64
64
  reader.read(2).unpack("v").first
65
65
  end
66
66
 
67
+ # Read an unsigned 16-bit (2-byte) big-endian integer.
68
+ def read_uint16_be
69
+ reader.read(2).unpack("n").first
70
+ end
71
+
67
72
  # Read an unsigned 24-bit (3-byte) integer.
68
73
  def read_uint24
69
74
  a, b, c = reader.read(3).unpack("CCC")
@@ -407,9 +412,8 @@ module MysqlBinlog
407
412
  ]
408
413
  end
409
414
 
410
- def read_datetimef(decimals)
411
- int_part = read_uint40_be
412
- frac_part = case decimals
415
+ def read_frac_part(decimals)
416
+ case decimals
413
417
  when 0
414
418
  0
415
419
  when 1, 2
@@ -419,7 +423,14 @@ module MysqlBinlog
419
423
  when 5, 6
420
424
  read_uint24_be
421
425
  end
422
- convert_mysql_type_datetimef(int_part, frac_part)
426
+ end
427
+
428
+ def read_datetimef(decimals)
429
+ convert_mysql_type_datetimef(read_uint40_be, read_frac_part(decimals))
430
+ end
431
+
432
+ def read_timestamp2(decimals)
433
+ read_uint32_be + (read_frac_part(decimals) / 1000000)
423
434
  end
424
435
 
425
436
  # Read a single field, provided the MySQL column type as a symbol. Not all
@@ -449,6 +460,8 @@ module MysqlBinlog
449
460
  read_lpstring(metadata[:length_size])
450
461
  when :timestamp
451
462
  read_uint32
463
+ when :timestamp2
464
+ read_timestamp2(metadata[:decimals])
452
465
  when :year
453
466
  read_uint8 + 1900
454
467
  when :date
@@ -1,3 +1,3 @@
1
1
  module MysqlBinlog
2
- VERSION = "0.3.3"
2
+ VERSION = "0.3.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mysql_binlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeremy Cole
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-13 00:00:00.000000000 Z
11
+ date: 2019-08-06 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Library for parsing MySQL binary logs in Ruby
14
14
  email: jeremy@jcole.us
@@ -28,7 +28,8 @@ files:
28
28
  - lib/mysql_binlog/reader/debugging_reader.rb
29
29
  - lib/mysql_binlog/version.rb
30
30
  homepage: http://jcole.us/
31
- licenses: []
31
+ licenses:
32
+ - BSD-3-Clause
32
33
  metadata: {}
33
34
  post_install_message:
34
35
  rdoc_options: []