In case anyone is following this thread, with Jeremy's help we've
added support for INSERT IGNORE and
INSERT ... ON DUPLICATE KEY UPDATE for mysql datasets.  Taken from the
inline documentation below.


===

      # Sets up the the multi_insert method to skips errors.
      # Useful if you have a unique key and want to just skip
      # inserting rows that violate the unique key restriction.
      #
      # Example:
      #
      # dataset.multi_insert_ignore.multi_insert([:name,:value],
      #   [['a',1],['b',2]])
      #
      # INSERT IGNORE INTO tablename (name, value) VALUES (a, 1), (b,
2)
      #

      # Sets up the multi_insert method to support ON DUPLICATE KEY
UPDATE
      # If you pass no arguments, ALL fields will be updated with the
new
      # values.  If you pass the fields you want then ONLY those
field
      # will be updated.
      #
      # Useful if you have a unique key and want to update
      # inserting rows that violate the unique key restriction.
      #
      # Examples:
      #
      # dataset.multi_insert_update.multi_insert([:name,:value],
      #   [['a',1],['b',2]])
      #
      # INSERT INTO tablename (name, value) VALUES (a, 1), (b, 2)
      # ON DUPLICATE KEY UPDATE name=VALUES(name), value=VALUES(value)
      #
      # dataset.multi_insert_update(:value).multi_insert
([:name,:value],
      #   [['a',1],['b',2]])
      #
      # INSERT INTO tablename (name, value) VALUES (a, 1), (b, 2)
      # ON DUPLICATE KEY UPDATE value=VALUES(value)
      #
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to