You are here

function boost_db_multi_delete_in in Boost 6

Delete records from the database where IN(...).

NOTE Be aware of the servers max_packet_size variable.

Parameters

$table: The name of the table.

$field: field name to be compared to

$placeholder: db_query placeholders; like %d or '%s'

$data: array of values you wish to compare to

Return value

returns db_query() result.

1 call to boost_db_multi_delete_in()
boost_remove_db in ./boost.module
Removes info from database. Use on 404 or 403.

File

./boost.module, line 5536
Provides static file caching for Drupal text output. Pages, Feeds, ect...

Code

function boost_db_multi_delete_in($table, $field, $placeholder, $data) {

  // Get the number of rows that will be inserted
  $rows = count($data);

  // Create what goes in the IN ()
  $in = $placeholder;

  // Add the rest of the place holders
  for ($i = 1; $i < $rows; $i++) {
    $in .= ', ' . $placeholder;
  }

  // Build the query
  $query = "DELETE FROM {" . $table . "} WHERE {$field} IN ({$in})";

  // Run the query
  return db_query($query, $data);
}