You are here

function rec_example_batch_insert in Recommender API 7.5

Same name and namespace in other branches
  1. 7.3 rec_example/rec_example.module \rec_example_batch_insert()
1 call to rec_example_batch_insert()
rec_example_load_file_small_ram in rec_example/rec_example.module

File

rec_example/rec_example.module, line 98

Code

function rec_example_batch_insert($values) {
  if (empty($values)) {
    return;
  }
  $query = db_insert('recommender_preference_staging')
    ->fields(array(
    'source_id',
    'target_id',
    'score',
    'updated',
  ));
  foreach ($values as $row) {
    $query
      ->values($row);
  }
  $query
    ->execute();
}