Class: Sequel::ADO::Access::AdoSchema::Column
- Defined in:
- lib/sequel/adapters/ado/access.rb
Constant Summary collapse
- DATA_TYPE =
{ 2 => "SMALLINT", 3 => "INTEGER", 4 => "REAL", 5 => "DOUBLE", 6 => "MONEY", 7 => "DATETIME", 11 => "BIT", 14 => "DECIMAL", 16 => "TINYINT", 17 => "BYTE", 72 => "GUID", 128 => "BINARY", 130 => "TEXT", 131 => "DECIMAL", 201 => "TEXT", 205 => "IMAGE" }.freeze
Instance Method Summary collapse
- #[](col) ⇒ Object
- #allow_null ⇒ Object
- #db_type ⇒ Object
- #default ⇒ Object
-
#initialize(row) ⇒ Column
constructor
A new instance of Column.
- #maximum_length ⇒ Object
- #precision ⇒ Object
- #scale ⇒ Object
Constructor Details
#initialize(row) ⇒ Column
Returns a new instance of Column.
48 49 50 |
# File 'lib/sequel/adapters/ado/access.rb', line 48 def initialize(row) @row = row end |
Instance Method Details
#[](col) ⇒ Object
52 53 54 |
# File 'lib/sequel/adapters/ado/access.rb', line 52 def [](col) @row[col] end |
#allow_null ⇒ Object
56 57 58 |
# File 'lib/sequel/adapters/ado/access.rb', line 56 def allow_null self["IS_NULLABLE"] end |
#db_type ⇒ Object
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/sequel/adapters/ado/access.rb', line 64 def db_type t = DATA_TYPE[self["DATA_TYPE"]] if t == "DECIMAL" && precision t + "(#{precision.to_i},#{(scale || 0).to_i})" elsif t == "TEXT" && maximum_length && maximum_length > 0 t + "(#{maximum_length.to_i})" else t end end |
#default ⇒ Object
60 61 62 |
# File 'lib/sequel/adapters/ado/access.rb', line 60 def default self["COLUMN_DEFAULT"] end |
#maximum_length ⇒ Object
83 84 85 |
# File 'lib/sequel/adapters/ado/access.rb', line 83 def maximum_length self["CHARACTER_MAXIMUM_LENGTH"] end |
#precision ⇒ Object
75 76 77 |
# File 'lib/sequel/adapters/ado/access.rb', line 75 def precision self["NUMERIC_PRECISION"] end |
#scale ⇒ Object
79 80 81 |
# File 'lib/sequel/adapters/ado/access.rb', line 79 def scale self["NUMERIC_SCALE"] end |