Method: Sequel::MySQL::DatasetMethods#insert_ignore
- Defined in:
- lib/sequel/adapters/shared/mysql.rb
#insert_ignore ⇒ Object
Sets up the insert methods to use INSERT IGNORE. Useful if you have a unique key and want to just skip inserting rows that violate the unique key restriction.
dataset.insert_ignore.multi_insert(
[{:name => 'a', :value => 1}, {:name => 'b', :value => 2}]
)
# INSERT IGNORE INTO tablename (name, value) VALUES (a, 1), (b, 2)
676 677 678 |
# File 'lib/sequel/adapters/shared/mysql.rb', line 676 def insert_ignore clone(:insert_ignore=>true) end |