Class: DB::MariaDB::Native::Field
- Inherits:
-
FFI::Struct
- Object
- FFI::Struct
- DB::MariaDB::Native::Field
- Defined in:
- lib/db/mariadb/native/field.rb
Overview
A field (column) in a result set with metadata and type information.
Instance Method Summary collapse
-
#boolean? ⇒ Boolean
Check if this field represents a boolean type.
-
#inspect ⇒ Object
Generate a string representation of the field.
-
#name ⇒ Object
Get the field name.
-
#type ⇒ Object
Get the field type, with boolean detection.
Instance Method Details
#boolean? ⇒ Boolean
Check if this field represents a boolean type.
108 109 110 |
# File 'lib/db/mariadb/native/field.rb', line 108 def boolean? self[:length] == 1 && (self[:type] == :tiny || self[:type] == :long) end |
#inspect ⇒ Object
Generate a string representation of the field.
130 131 132 |
# File 'lib/db/mariadb/native/field.rb', line 130 def inspect "\#<#{self.class} name=#{self.name} type=#{self.type} length=#{self[:length]}>" end |
#name ⇒ Object
Get the field name.
114 115 116 |
# File 'lib/db/mariadb/native/field.rb', line 114 def name self[:name] end |
#type ⇒ Object
Get the field type, with boolean detection.
120 121 122 123 124 125 126 |
# File 'lib/db/mariadb/native/field.rb', line 120 def type if boolean? :boolean else self[:type] end end |