Class: Vertica::Column
- Inherits:
-
Object
- Object
- Vertica::Column
- Defined in:
- lib/vertica/column.rb
Overview
Class representing a column in a result.
Instance Attribute Summary collapse
-
#attribute_number ⇒ Integer?
readonly
The attribute index in the table this column originates from.
-
#data_type ⇒ Vertica::DataType
readonly
The type of the values in this column.
-
#name ⇒ String
readonly
The name of the column.
-
#table_oid ⇒ Integer?
readonly
The OID of the table this column originates from.
Class Method Summary collapse
-
.build(name: nil, table_oid: nil, attribute_number: nil, data_format: 0, data_type_oid: nil, data_type_size: nil, data_type_modifier: nil) ⇒ Vertica::Column
Builds a new column instance based on the values provided by a Protocol::RowDescription message.
Instance Method Summary collapse
-
#eql?(other) ⇒ Boolean
(also: #==)
Returns true iff this record is equal to the other provided object.
-
#hash ⇒ Integer
Returns a hash digtest of this object.
-
#initialize(name: nil, data_type: nil, table_oid: nil, attribute_number: nil) ⇒ Column
constructor
Initializes a new Vertica::Column.
-
#inspect ⇒ String
Returns a user-consumable string representation of this column.
Constructor Details
#initialize(name: nil, data_type: nil, table_oid: nil, attribute_number: nil) ⇒ Column
Initializes a new Vertica::Column.
34 35 36 37 38 39 |
# 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 |
Instance Attribute Details
#attribute_number ⇒ Integer? (readonly)
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
12 13 14 |
# File 'lib/vertica/column.rb', line 12 def attribute_number @attribute_number end |
#data_type ⇒ Vertica::DataType (readonly)
The type of the values in this column.
12 13 14 |
# File 'lib/vertica/column.rb', line 12 def data_type @data_type end |
#name ⇒ String (readonly)
The name of the column
12 13 14 |
# File 'lib/vertica/column.rb', line 12 def name @name end |
#table_oid ⇒ Integer? (readonly)
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
12 13 14 |
# File 'lib/vertica/column.rb', line 12 def table_oid @table_oid end |
Class Method Details
.build(name: nil, table_oid: nil, attribute_number: nil, data_format: 0, data_type_oid: nil, data_type_size: nil, data_type_modifier: nil) ⇒ Vertica::Column
Builds a new column instance based on the values provided by a Protocol::RowDescription message.
25 26 27 28 |
# 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 |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
Returns true iff this record is equal to the other provided object
42 43 44 45 |
# 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 |
#hash ⇒ Integer
Returns a hash digtest of this object.
50 51 52 |
# File 'lib/vertica/column.rb', line 50 def hash [name, data_type, table_oid, attribute_number].hash end |
#inspect ⇒ String
Returns a user-consumable string representation of this column.
55 56 57 |
# File 'lib/vertica/column.rb', line 55 def inspect "#<#{self.class.name} name=#{name.inspect} data_type=#{data_type.inspect}>" end |