Class: ActiveRecord::ConnectionAdapters::IBM_DBConstraint
- Inherits:
-
AbstractTableConstraint
- Object
- AbstractTableConstraint
- ActiveRecord::ConnectionAdapters::IBM_DBConstraint
- Defined in:
- lib/connection_adapters/ibm_db_adapter.rb
Constant Summary collapse
- ISERIES_PRIMARY_KEY_TYPE =
"P"
- ISERIES_FOREIGN_KEY_TYPE =
"F"
- ISERIES_UNIQUE_KEY_TYPE =
"U"
- ISERIES_CHECK_CONSTRAINT_TYPE =
"C"
Constants inherited from AbstractTableConstraint
AbstractTableConstraint::CHECK_CONSTRAINT_TYPE, AbstractTableConstraint::FOREIGN_KEY_TYPE, AbstractTableConstraint::PRIMARY_KEY_TYPE, AbstractTableConstraint::UNIQUE_KEY_TYPE
Instance Attribute Summary collapse
-
#delete_rule ⇒ Object
readonly
Returns the value of attribute delete_rule.
-
#referenced_constraint_name ⇒ Object
readonly
Returns the value of attribute referenced_constraint_name.
-
#update_rule ⇒ Object
readonly
Returns the value of attribute update_rule.
Attributes inherited from AbstractTableConstraint
#column_names, #constraint_name, #constraint_type, #referenced_column_names, #referenced_table_name, #table_name, #table_schema
Instance Method Summary collapse
- #foreign_key? ⇒ Boolean
-
#initialize(constraint_schema, constraint_name, constraint_type, table_name, column_name, referenced_constraint_name, referenced_table_name, referenced_column_names, delete_rule) ⇒ IBM_DBConstraint
constructor
A new instance of IBM_DBConstraint.
- #is_foreign_constraint?(table_name) ⇒ Boolean
- #primary_key? ⇒ Boolean
- #unique_key? ⇒ Boolean
Methods inherited from AbstractTableConstraint
#raise_subclass_responsibility_error
Constructor Details
#initialize(constraint_schema, constraint_name, constraint_type, table_name, column_name, referenced_constraint_name, referenced_table_name, referenced_column_names, delete_rule) ⇒ IBM_DBConstraint
Returns a new instance of IBM_DBConstraint.
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 26 def initialize(constraint_schema, constraint_name, constraint_type, table_name, column_name, referenced_constraint_name, referenced_table_name, referenced_column_names, delete_rule) @constraint_schema = constraint_schema @constraint_name = constraint_name @table_name = table_name @constraint_type = constraint_type @column_names = column_name.to_a if column_name @referenced_table_name = referenced_table_name @referenced_constraint_name = referenced_constraint_name @delete_rule = delete_rule @referenced_column_names = referenced_column_names if referenced_column_names end |
Instance Attribute Details
#delete_rule ⇒ Object (readonly)
Returns the value of attribute delete_rule.
19 20 21 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 19 def delete_rule @delete_rule end |
#referenced_constraint_name ⇒ Object (readonly)
Returns the value of attribute referenced_constraint_name.
19 20 21 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 19 def referenced_constraint_name @referenced_constraint_name end |
#update_rule ⇒ Object (readonly)
Returns the value of attribute update_rule.
19 20 21 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 19 def update_rule @update_rule end |
Instance Method Details
#foreign_key? ⇒ Boolean
43 44 45 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 43 def foreign_key? constraint_type == FOREIGN_KEY_TYPE || constraint_type == ISERIES_FOREIGN_KEY_TYPE end |
#is_foreign_constraint?(table_name) ⇒ Boolean
51 52 53 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 51 def is_foreign_constraint?(table_name) @table_name.upcase != table_name.upcase end |
#primary_key? ⇒ Boolean
39 40 41 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 39 def primary_key? constraint_type == PRIMARY_KEY_TYPE || constraint_type == ISERIES_PRIMARY_KEY_TYPE end |
#unique_key? ⇒ Boolean
47 48 49 |
# File 'lib/connection_adapters/ibm_db_adapter.rb', line 47 def unique_key? constraint_type == UNIQUE_KEY_TYPE || constraint_type == ISERIES_UNIQUE_KEY_TYPE end |