class Vertica::Column

Class representing a column in a result.

@attr_reader name [String] The name of the column @attr_reader table_oid [Integer, nil] The OID of the table this column originates from. This can

be nil if the volumn was computed, and was not soruced from a table

@attr_reader attribute_number [Integer, nil] The attribute index in the table this column originates from.

This can be nil if the volumn was computed, and was not soruced from a table

@attr_reader data_type [Vertica::DataType] The type of the values in this column.

@see Vertica::RowDescription @see Vertica::DataType

Attributes

attribute_number[R]
data_type[R]
name[R]
table_oid[R]

Public Class Methods

build(name: nil, table_oid: nil, attribute_number: nil, data_format: 0, data_type_oid: nil, data_type_size: nil, data_type_modifier: nil) click to toggle source

Builds a new column instance based on the values provided by a {Vertica::Protocol::RowDescription} message. @param name [String] The name of the column @param table_oid [Integer, nil] The OID of the table this column originates from. This can

be nil if the volumn was computed, and was not soruced from a table

@param attribute_number [Integer, nil] The attribute index in the table this column originates from.

This can be nil if the volumn was computed, and was not soruced from a table

@param data_type_oid [Integer] The object ID of the type. @param data_type_size [Integer] The size of the type. @param data_type_modifier [Integer] A modifier of the type. @param data_format [Integer] The serialization format of this type. @return [Vertica::Column]

# File lib/vertica/column.rb, line 25
def self.build(name: nil, table_oid: nil, attribute_number: nil, data_format: 0, data_type_oid: nil, data_type_size: nil, data_type_modifier: nil)
  data_type = Vertica::DataType.build(oid: data_type_oid, size: data_type_size, modifier: data_type_modifier, format: data_format)
  new(name: name, data_type: data_type, table_oid: table_oid, attribute_number: attribute_number)
end
new(name: nil, data_type: nil, table_oid: nil, attribute_number: nil) click to toggle source

Initializes a new Vertica::Column. @see .build

# File lib/vertica/column.rb, line 34
def initialize(name: nil, data_type: nil, table_oid: nil, attribute_number: nil)
  @name             = name
  @table_oid        = table_oid
  @attribute_number = attribute_number
  @data_type        = data_type
end

Public Instance Methods

==(other)
Alias for: eql?
eql?(other) click to toggle source

@return [Boolean] Returns true iff this record is equal to the other provided object

# File lib/vertica/column.rb, line 42
def eql?(other)
  self.class === other && other.name == name && other.data_type == data_type &&
    other.table_oid == table_oid && other.attribute_number == attribute_number
end
Also aliased as: ==
hash() click to toggle source

@return [Integer] Returns a hash digtest of this object.

# File lib/vertica/column.rb, line 50
def hash
  [name, data_type, table_oid, attribute_number].hash
end
inspect() click to toggle source

@return [String] Returns a user-consumable string representation of this column.

# File lib/vertica/column.rb, line 55
def inspect
  "#<#{self.class.name} name=#{name.inspect} data_type=#{data_type.inspect}>"
end