Class: ActiveRecord::ConnectionAdapters::IBM_DB2_LUW_COBRA
- Inherits:
-
IBM_DB2_LUW
- Object
- IBM_DataServer
- IBM_DB2
- IBM_DB2_LUW
- ActiveRecord::ConnectionAdapters::IBM_DB2_LUW_COBRA
- Defined in:
- lib/active_record/connection_adapters/ibm_db_adapter.rb
Overview
class IBM_DB2_LUW
Instance Method Summary collapse
-
#limit_not_supported_types ⇒ Object
Cobra supports parameterised timestamp, hence overriding following method to allow timestamp datatype to be parameterised.
-
#rename_column(table_name, column_name, new_column_name) ⇒ Object
Alter table column for renaming a column This feature is supported for against DB2 V97 and above only.
Methods inherited from IBM_DB2_LUW
Methods inherited from IBM_DB2
#change_column, #change_column_default, #change_column_null, #get_datetime_mapping, #get_double_mapping, #get_limit_offset_clauses, #get_time_mapping, #initialize, #last_generated_id, #primary_key_definition, #query_offset_limit, #query_offset_limit!, #set_binary_default, #set_binary_value, #set_case, #set_text_default
Methods inherited from IBM_DataServer
#change_column_default, #change_column_null, #check_reserved_words, #create_index_after_table, #execute, #get_datetime_mapping, #get_double_mapping, #get_limit_offset_clauses, #get_time_mapping, #initialize, #last_generated_id, #prepare, #query_offset_limit, #query_offset_limit!, #remove_column, #reorg_table, #select, #select_rows, #set_binary_default, #set_binary_value, #set_case, #set_schema, #set_text_default, #setup_for_lob_table
Constructor Details
This class inherits a constructor from ActiveRecord::ConnectionAdapters::IBM_DB2
Instance Method Details
#limit_not_supported_types ⇒ Object
Cobra supports parameterised timestamp, hence overriding following method to allow timestamp datatype to be parameterised
2582 2583 2584 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 2582 def limit_not_supported_types [:integer, :double, :date, :time, :xml, :bigint] end |
#rename_column(table_name, column_name, new_column_name) ⇒ Object
Alter table column for renaming a column This feature is supported for against DB2 V97 and above only
2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 |
# File 'lib/active_record/connection_adapters/ibm_db_adapter.rb', line 2588 def rename_column(table_name, column_name, new_column_name) _table_name = table_name.to_s _column_name = column_name.to_s _new_column_name = new_column_name.to_s nil_condition = _table_name.nil? || _column_name.nil? || _new_column_name.nil? empty_condition = _table_name.empty? || _column_name.empty? || _new_column_name.empty? unless nil_condition if nil_condition || empty_condition raise ArgumentError,"One of the arguments passed to rename_column is empty or nil" end begin rename_column_sql = "ALTER TABLE #{_table_name} RENAME COLUMN #{_column_name} \ TO #{_new_column_name}" unless stmt = execute(rename_column_sql) error_msg = IBM_DB.getErrormsg(@adapter.connection, IBM_DB::DB_CONN ) if error_msg && !error_msg.empty? raise "Rename column failed : #{error_msg}" else raise StandardError.new('An unexpected error occurred during renaming the column') end end reorg_table(_table_name) ensure IBM_DB.free_stmt(stmt) if stmt end #End of begin end |