Using multiple keys on multi row db_merge?

I am using db_merge (mysql) for getting jobs into my queues. I therefore have each task only once (the job is quite intensive and many things can trigger the task to be queued, so want to avoid multiple runs). I do this by using the data column as the key. This is from my custom queue class, and it works well:

$query = db_merge('queue')
->key(array('name' => $this->name, 'data' => $serial_data))
    'name' => $this->name,
    'data' => $serial_data,
    'created' => time(),

Now I want to merge many rows, something like this (but not inserting):

$columns = array(
$query = db_insert('queue')->fields($columns);

foreach ($products AS $product) {
    $value = Array();
    $value['name'] = 'stale_products_tasks';
    $value['data'] = serialize(array('prod_id' => $product['prod_id']));
    $value['created'] = time();



Is this possible? I don’t mind modifying this to use a non-drupal method if that’s the only option.

Go to Source of this post
Author Of this post: Paul
Title Of post: Using multiple keys on multi row db_merge?
Author Link: {authorlink}