Class: ActiveRecord::ConnectionAdapters::SQLServer::Column
- Inherits:
-
ConnectionAdapters::Column
- Object
- ConnectionAdapters::Column
- ActiveRecord::ConnectionAdapters::SQLServer::Column
- Defined in:
- lib/active_record/connection_adapters/sqlserver_column.rb
Instance Method Summary collapse
- #==(other) ⇒ Object (also: #eql?)
- #case_sensitive? ⇒ Boolean
- #encode_with(coder) ⇒ Object
- #hash ⇒ Object
- #init_with(coder) ⇒ Object
-
#initialize(is_identity: nil, is_primary: nil, table_name: nil, ordinal_position: nil) ⇒ Column
constructor
A new instance of Column.
- #is_identity? ⇒ Boolean (also: #auto_incremented_by_db?)
- #is_primary? ⇒ Boolean
- #is_utf8? ⇒ Boolean
Constructor Details
#initialize(is_identity: nil, is_primary: nil, table_name: nil, ordinal_position: nil) ⇒ Column
Returns a new instance of Column.
9 10 11 12 13 14 15 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 9 def initialize(*, is_identity: nil, is_primary: nil, table_name: nil, ordinal_position: nil, **) super @is_identity = is_identity @is_primary = is_primary @table_name = table_name @ordinal_position = ordinal_position end |
Instance Method Details
#==(other) ⇒ Object Also known as: eql?
50 51 52 53 54 55 56 57 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 50 def ==(other) other.is_a?(Column) && super && is_identity? == other.is_identity? && is_primary? == other.is_primary? && table_name == other.table_name && ordinal_position == other.ordinal_position end |
#case_sensitive? ⇒ Boolean
30 31 32 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 30 def case_sensitive? collation && collation.match(/_CS/) end |
#encode_with(coder) ⇒ Object
42 43 44 45 46 47 48 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 42 def encode_with(coder) coder["is_identity"] = @is_identity coder["is_primary"] = @is_primary coder["table_name"] = @table_name coder["ordinal_position"] = @ordinal_position super end |
#hash ⇒ Object
60 61 62 63 64 65 66 67 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 60 def hash Column.hash ^ super.hash ^ is_identity?.hash ^ is_primary?.hash ^ table_name.hash ^ ordinal_position.hash end |
#init_with(coder) ⇒ Object
34 35 36 37 38 39 40 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 34 def init_with(coder) @is_identity = coder["is_identity"] @is_primary = coder["is_primary"] @table_name = coder["table_name"] @ordinal_position = coder["ordinal_position"] super end |
#is_identity? ⇒ Boolean Also known as: auto_incremented_by_db?
17 18 19 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 17 def is_identity? is_identity end |
#is_primary? ⇒ Boolean
22 23 24 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 22 def is_primary? is_primary end |
#is_utf8? ⇒ Boolean
26 27 28 |
# File 'lib/active_record/connection_adapters/sqlserver_column.rb', line 26 def is_utf8? sql_type =~ /nvarchar|ntext|nchar/i end |