innodb_ruby 0.7.2 → 0.7.3

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.
data/lib/innodb/field.rb CHANGED
@@ -1,3 +1,6 @@
1
+ # A single field in an InnoDB record (within an INDEX page). This class
2
+ # provides essential information to parse records: the length of the fixed
3
+ # width portion of the field
1
4
  class Innodb::Field
2
5
  attr_reader :position, :nullable, :fixed_len, :variable_len
3
6
 
@@ -15,8 +18,10 @@ class Innodb::Field
15
18
  type = data_type.upcase.to_sym
16
19
  fixed_len = fixed_len_map[type]
17
20
  [type, fixed_len, 0]
18
- when /varchar\((\d+)\)$/i
21
+ when /^varchar\((\d+)\)$/i
19
22
  [:VARCHAR, 0, $1.to_i]
23
+ when /^char\((\d+)\)$/i
24
+ [:CHAR, $1.to_i, 0]
20
25
  else
21
26
  raise "Data type '#{data_type}' is not supported"
22
27
  end
@@ -60,7 +65,11 @@ class Innodb::Field
60
65
  symbol = @unsigned ? :get_uint_by_size : :get_i_sint_by_size
61
66
  cursor.send(symbol, @fixed_len)
62
67
  when :VARCHAR
63
- '\'' + cursor.get_bytes(get_variable_len(record)) + '\''
68
+ cursor.get_bytes(get_variable_len(record))
69
+ when :CHAR
70
+ # Fixed-width character fields will be space-padded up to their length,
71
+ # so SQL defines that trailing spaces should be removed.
72
+ cursor.get_bytes(fixed_len).sub(/[ ]+$/, "")
64
73
  end
65
74
  end
66
75
  end
data/lib/innodb/page.rb CHANGED
@@ -150,14 +150,14 @@ class Innodb::Page
150
150
  # the page buffer, since it's very large and mostly not interesting.
151
151
  def inspect
152
152
  if fil_header
153
- "#<%s: size=%i, space_id=%i, offset=%i, type=%s, prev=%i, next=%i>" % [
153
+ "#<%s: size=%i, space_id=%i, offset=%i, type=%s, prev=%s, next=%s>" % [
154
154
  self.class,
155
155
  size,
156
156
  fil_header[:space_id],
157
157
  fil_header[:offset],
158
158
  fil_header[:type],
159
- fil_header[:prev],
160
- fil_header[:next],
159
+ fil_header[:prev] || "nil",
160
+ fil_header[:next] || "nil",
161
161
  ]
162
162
  else
163
163
  "#<#{self.class}>"
@@ -239,7 +239,7 @@ class Innodb::Page::Index < Innodb::Page
239
239
  header[:min_rec] = (info & RECORD_INFO_MIN_REC_FLAG) != 0
240
240
  header[:deleted] = (info & RECORD_INFO_DELETED_FLAG) != 0
241
241
  case header[:type]
242
- when :conventional, :node_pointer:
242
+ when :conventional, :node_pointer
243
243
  # The variable-length part of the record header contains a
244
244
  # bit vector indicating NULL fields and the length of each
245
245
  # non-NULL variable-length field.
@@ -1,3 +1,3 @@
1
1
  module Innodb
2
- VERSION = "0.7.2"
2
+ VERSION = "0.7.3"
3
3
  end
metadata CHANGED
@@ -1,48 +1,35 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: innodb_ruby
3
- version: !ruby/object:Gem::Version
4
- hash: 7
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.3
5
5
  prerelease:
6
- segments:
7
- - 0
8
- - 7
9
- - 2
10
- version: 0.7.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Jeremy Cole
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-12-13 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-12-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: bindata
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: &70099335724160 !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
26
- - - ">="
27
- - !ruby/object:Gem::Version
28
- hash: 13
29
- segments:
30
- - 1
31
- - 4
32
- - 5
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
33
21
  version: 1.4.5
34
22
  type: :runtime
35
- version_requirements: *id001
23
+ prerelease: false
24
+ version_requirements: *70099335724160
36
25
  description: Library for parsing InnoDB data files in Ruby
37
26
  email: jeremy@jcole.us
38
- executables:
27
+ executables:
39
28
  - innodb_log
40
29
  - innodb_space
41
30
  extensions: []
42
-
43
31
  extra_rdoc_files: []
44
-
45
- files:
32
+ files:
46
33
  - README.md
47
34
  - lib/innodb.rb
48
35
  - lib/innodb/cursor.rb
@@ -65,37 +52,27 @@ files:
65
52
  - bin/innodb_space
66
53
  homepage: http://jcole.us/
67
54
  licenses: []
68
-
69
55
  post_install_message:
70
56
  rdoc_options: []
71
-
72
- require_paths:
57
+ require_paths:
73
58
  - lib
74
- required_ruby_version: !ruby/object:Gem::Requirement
59
+ required_ruby_version: !ruby/object:Gem::Requirement
75
60
  none: false
76
- requirements:
77
- - - ">="
78
- - !ruby/object:Gem::Version
79
- hash: 3
80
- segments:
81
- - 0
82
- version: "0"
83
- required_rubygems_version: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ! '>='
63
+ - !ruby/object:Gem::Version
64
+ version: '0'
65
+ required_rubygems_version: !ruby/object:Gem::Requirement
84
66
  none: false
85
- requirements:
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- hash: 3
89
- segments:
90
- - 0
91
- version: "0"
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
92
71
  requirements: []
93
-
94
72
  rubyforge_project:
95
- rubygems_version: 1.8.10
73
+ rubygems_version: 1.8.6
96
74
  signing_key:
97
75
  specification_version: 3
98
76
  summary: InnoDB data file parser
99
77
  test_files: []
100
-
101
78
  has_rdoc: