Class: MassInsert::Adapters::Mysql2Adapter
Instance Attribute Summary
#options, #values
Instance Method Summary
collapse
#initialize
Instance Method Details
#on_duplicate_key_update ⇒ Object
8
9
10
11
12
|
# File 'lib/mass_insert/adapters/mysql2_adapter.rb', line 8
def on_duplicate_key_update
if @options[:handle_duplication]
"ON DUPLICATE KEY UPDATE #{on_duplicate_key_update_values}"
end
end
|
#on_duplicate_key_update_values ⇒ Object
14
15
16
17
18
|
# File 'lib/mass_insert/adapters/mysql2_adapter.rb', line 14
def on_duplicate_key_update_values
quoted_columns.map do |quoted_column|
"#{quoted_column}=#{quoted_column}"
end.join(',')
end
|
#to_sql ⇒ Object
4
5
6
|
# File 'lib/mass_insert/adapters/mysql2_adapter.rb', line 4
def to_sql
"#{insert_sql} #{values_sql} #{on_duplicate_key_update};"
end
|