Class: Innodb::FieldType::GenericType
- Inherits:
-
Object
- Object
- Innodb::FieldType::GenericType
- Defined in:
- lib/innodb/field_type.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#get_extern_field(cursor) ⇒ Object
Return an external reference field.
-
#initialize(type) ⇒ GenericType
constructor
A new instance of GenericType.
- #read(cursor, length) ⇒ Object
- #read_extern(cursor) ⇒ Object
Constructor Details
#initialize(type) ⇒ GenericType
Returns a new instance of GenericType.
6 7 8 |
# File 'lib/innodb/field_type.rb', line 6 def initialize(type) @type = type end |
Instance Attribute Details
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/innodb/field_type.rb', line 4 def type @type end |
Instance Method Details
#get_extern_field(cursor) ⇒ Object
Return an external reference field. An extern field contains the page address and the length of the externally stored part of the record data.
20 21 22 23 24 25 26 27 |
# File 'lib/innodb/field_type.rb', line 20 def get_extern_field(cursor) { :space_id => cursor.name("space_id") { cursor.get_uint32 }, :page_number => cursor.name("page_number") { cursor.get_uint32 }, :offset => cursor.name("offset") { cursor.get_uint32 }, :length => cursor.name("length") { cursor.get_uint64 & 0x3fffffff } } end |
#read(cursor, length) ⇒ Object
10 11 12 |
# File 'lib/innodb/field_type.rb', line 10 def read(cursor, length) cursor.get_bytes(length) end |
#read_extern(cursor) ⇒ Object
14 15 16 |
# File 'lib/innodb/field_type.rb', line 14 def read_extern(cursor) cursor.name("extern") { get_extern_field(cursor) } end |