Class: TeradataCli::FieldType
- Inherits:
-
Object
- Object
- TeradataCli::FieldType
- Defined in:
- lib/teradata-cli/connection.rb
Overview
Unsupported Types: BLOB 400 BLOB_DEFERRED 404 BLOB_LOCATOR 408 CLOB 416 CLOB_DEFERRED 420 CLOB_LOCATOR 424 GRAPHIC_NN 468 GRAPHIC_N 469 LONG_VARBYTE_NN 696 LONG_VARBYTE_N 697 LONG_VARCHAR_NN 456 LONG_VARCHAR_N 457 LONG_VARGRAPHIC_NN 472 LONG_VARGRAPHIC_N 473 VARGRAPHIC_NN 464 VARGRAPHIC_N 465
Direct Known Subclasses
BigIntType, ByteIntType, DateType, DecimalType, FixStringType, FloatType, IntegerType, SmallIntType, VarStringType
Constant Summary collapse
- @@types =
{}
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#type_code ⇒ Object
readonly
Returns the value of attribute type_code.
-
#type_name ⇒ Object
readonly
Returns the value of attribute type_name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(type_name, type_code, len, name, format, title, extractor) ⇒ FieldType
constructor
A new instance of FieldType.
- #inspect ⇒ Object
- #to_s ⇒ Object
-
#unmarshal(f) ⇒ Object
default implementation: only read as string.
Constructor Details
#initialize(type_name, type_code, len, name, format, title, extractor) ⇒ FieldType
Returns a new instance of FieldType.
848 849 850 851 852 853 854 855 856 |
# File 'lib/teradata-cli/connection.rb', line 848 def initialize(type_name, type_code, len, name, format, title, extractor) @type_name = type_name @type_code = type_code @length = len @name = name @format = format @title = title @extractor = extractor end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
861 862 863 |
# File 'lib/teradata-cli/connection.rb', line 861 def format @format end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
860 861 862 |
# File 'lib/teradata-cli/connection.rb', line 860 def name @name end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
862 863 864 |
# File 'lib/teradata-cli/connection.rb', line 862 def title @title end |
#type_code ⇒ Object (readonly)
Returns the value of attribute type_code.
859 860 861 |
# File 'lib/teradata-cli/connection.rb', line 859 def type_code @type_code end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
858 859 860 |
# File 'lib/teradata-cli/connection.rb', line 858 def type_name @type_name end |
Class Method Details
.code_names ⇒ Object
844 845 846 |
# File 'lib/teradata-cli/connection.rb', line 844 def FieldType.code_names @@types.values.map {|name, c| name } end |
.codes ⇒ Object
840 841 842 |
# File 'lib/teradata-cli/connection.rb', line 840 def FieldType.codes @@types.keys end |
.create(code, len, name, format, title, extractor) ⇒ Object
834 835 836 837 838 |
# File 'lib/teradata-cli/connection.rb', line 834 def FieldType.create(code, len, name, format, title, extractor) type_name, type_class = @@types[code] raise MetaDataFormatError, "unknown type code: #{code}" unless name type_class.new(type_name, code, len, name, format, title, extractor) end |
Instance Method Details
#inspect ⇒ Object
868 869 870 |
# File 'lib/teradata-cli/connection.rb', line 868 def inspect "\#<FieldType #{@name} (#{@type_name}:#{@type_code})>" end |
#to_s ⇒ Object
864 865 866 |
# File 'lib/teradata-cli/connection.rb', line 864 def to_s "(#{@name} #{@type_name}:#{@type_code})" end |
#unmarshal(f) ⇒ Object
default implementation: only read as string.
873 874 875 |
# File 'lib/teradata-cli/connection.rb', line 873 def unmarshal(f) f.read(@length) end |