function data_search_wipe in Data 7
Same name and namespace in other branches
- 8 data_search/data_search.module \data_search_wipe()
- 6 data_search/data_search.module \data_search_wipe()
Wipe all orphaned entries for given Data table. Use instead of search_wipe() if all items that have been deleted from table $table should be wiped. In this case, data_search_wipe() is faster than search_wipe().
Note: Like search_wipe(), this function does not reset the word counts in search_total.
Parameters
$table: DataTable object.
1 call to data_search_wipe()
- data_search_cron in data_search/
data_search.module - Implements hook_cron().
File
- data_search/
data_search.module, line 154
Code
function data_search_wipe($table) {
$schema = $table
->get('table_schema');
$name = db_escape_table($table
->get('name'));
$field = db_escape_string(current($schema['primary key']));
// TODO Please convert this statement to the D7 database API syntax.
db_query("DELETE s FROM {search_dataset} s LEFT JOIN {{$name}} t ON s.sid = t.{$field} WHERE s.type = '%s' AND t.{$field} IS NULL", $table
->get('name'));
// TODO Please convert this statement to the D7 database API syntax.
db_query("DELETE s FROM {search_index} s LEFT JOIN {{$name}} t ON s.sid = t.{$field} WHERE s.type = '%s' AND t.{$field} IS NULL", $table
->get('name'));
}