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, DateTimeType, 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.
851 852 853 854 855 856 857 858 859 |
# File 'lib/teradata-cli/connection.rb', line 851 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.
864 865 866 |
# File 'lib/teradata-cli/connection.rb', line 864 def format @format end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
863 864 865 |
# File 'lib/teradata-cli/connection.rb', line 863 def name @name end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
865 866 867 |
# File 'lib/teradata-cli/connection.rb', line 865 def title @title end |
#type_code ⇒ Object (readonly)
Returns the value of attribute type_code.
862 863 864 |
# File 'lib/teradata-cli/connection.rb', line 862 def type_code @type_code end |
#type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
861 862 863 |
# File 'lib/teradata-cli/connection.rb', line 861 def type_name @type_name end |
Class Method Details
.code_names ⇒ Object
847 848 849 |
# File 'lib/teradata-cli/connection.rb', line 847 def FieldType.code_names @@types.values.map {|name, c| name } end |
.codes ⇒ Object
843 844 845 |
# File 'lib/teradata-cli/connection.rb', line 843 def FieldType.codes @@types.keys end |
.create(code, len, name, format, title, extractor) ⇒ Object
837 838 839 840 841 |
# File 'lib/teradata-cli/connection.rb', line 837 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
871 872 873 |
# File 'lib/teradata-cli/connection.rb', line 871 def inspect "\#<FieldType #{@name} (#{@type_name}:#{@type_code})>" end |
#to_s ⇒ Object
867 868 869 |
# File 'lib/teradata-cli/connection.rb', line 867 def to_s "(#{@name} #{@type_name}:#{@type_code})" end |
#unmarshal(f) ⇒ Object
default implementation: only read as string.
876 877 878 |
# File 'lib/teradata-cli/connection.rb', line 876 def unmarshal(f) f.read(@length).rstrip end |