Class: DB::MariaDB::Native::Field

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/db/mariadb/native/field.rb

Instance Method Summary collapse

Instance Method Details

#boolean?Boolean



109
110
111
# File 'lib/db/mariadb/native/field.rb', line 109

def boolean?
  self[:length] == 1 and self[:type] == :tiny || self[:type] == :long
end

#inspectObject



125
126
127
# File 'lib/db/mariadb/native/field.rb', line 125

def inspect
  "\#<#{self.class} name=#{self.name} type=#{self.type} length=#{self[:length]}>"
end

#nameObject



113
114
115
# File 'lib/db/mariadb/native/field.rb', line 113

def name
  self[:name]
end

#typeObject



117
118
119
120
121
122
123
# File 'lib/db/mariadb/native/field.rb', line 117

def type
  if boolean?
    :boolean
  else
    self[:type]
  end
end