Module: AdapterExtensions::SQLServerAdapter

Included in:
ActiveRecord::ConnectionAdapters::SQLServerAdapter
Defined in:
lib/adapter_extensions/adapters/sqlserver_adapter.rb

Instance Method Summary collapse

Instance Method Details

#add_select_into_table(new_table_name, sql_query) ⇒ Object

Inserts an INTO table_name clause to the sql_query.



8
9
10
# File 'lib/adapter_extensions/adapters/sqlserver_adapter.rb', line 8

def add_select_into_table(new_table_name, sql_query)
  sql_query.sub(/FROM/i, "INTO #{new_table_name} FROM")
end

#copy_table(old_table_name, new_table_name) ⇒ Object

Copy the specified table.



13
14
15
# File 'lib/adapter_extensions/adapters/sqlserver_adapter.rb', line 13

def copy_table(old_table_name, new_table_name)
  execute add_select_into_table(new_table_name, "SELECT * FROM #{old_table_name}")
end

#support_select_into_table?Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/adapter_extensions/adapters/sqlserver_adapter.rb', line 3

def support_select_into_table?
  true
end