WordPress.org

Ready to get started?Download WordPress

Ideas

Allow $wpdb->insert() to add multiple rows in one query

  1. David Gard
    Member

    I recently came across a scenario where I had to place upwards of 300 rows at a time into a database table. Initially, I was using $wpdb->insert(), this was pretty slow as it ran a separate query to insert each row.

    It would be good to be able to pass an array of associative arrays to $wpdb->insert() (as they'd all have the required $field names required by the helper function), and let the function insert all of your rows in one go.

    Posted: 11 months ago #
  2. Arevico
    Member

    12345

    Good iea, actually SQL supports this too so i think it is a good plan to add support for it :
    http://stackoverflow.com/questions/2624713/how-do-i-insert-multiple-rows-without-repeating-the-insert-into-dbo-blah-part

    Posted: 11 months ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    3 Votes
  • Status

    This idea is under consideration