You are here

function boost_db_multi_select_in in Boost 6

Select records in the database matching 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.

3 calls to boost_db_multi_select_in()
boost_cache_expire_by_db in ./boost.module
Expires the static file cache for the given paths via database.
boost_cache_kill_url in ./boost.module
Deletes cached page from file system & database.
boost_cron in ./boost.module
Implementation of hook_cron(). Performs periodic actions.

File

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

Code

function boost_db_multi_select_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 = "SELECT * FROM {" . $table . "} WHERE {$field} IN ({$in})";

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