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