[wp-trac] [WordPress Trac] #22196: add $wpdb->upsert function

WordPress Trac wp-trac at lists.automattic.com
Mon Oct 15 12:48:33 UTC 2012


#22196: add $wpdb->upsert function
-----------------------------+-------------------------
 Reporter:  thomask          |       Type:  enhancement
   Status:  new              |   Priority:  normal
Milestone:  Awaiting Review  |  Component:  Database
  Version:  3.4.2            |   Severity:  normal
 Keywords:                   |
-----------------------------+-------------------------
 If i read http://codex.wordpress.org/Class_Reference/wpdb right, we have
 only insert and update functions, but for many occations, if would be
 lovely, if we would have upsert function as well (using INSERT ... ON
 DUPLICATE KEY UPDATE http://dev.mysql.com/doc/refman/5.1/en/insert-on-
 duplicate.html).

 So when i am inserting e.g. posts using database function, i do not have
 to check if post with that id exist (good for some migration / importing
 tools etc.)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/22196>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list