app/models/hierarchy.rb
# There's no nice way to do this in Rails and can be super slow if you don't
# use the INSERT SELECT!
There's no nice way to do this in Rails and can be super slow if you don't
use the INSERT SELECT!
There ' s no nice way to do this in Rails and can be super slow if you don ' t use the INSERT SELECT!
def insert_dot_dohe_query(table)
    "INSERT IGNORE INTO data_objects_taxon_concepts (`taxon_concept_id`, "\
    "`data_object_id`) SELECT taxon_concepts.id, data_objects.id FROM "\
    "taxon_concepts JOIN hierarchy_entries ON (taxon_concepts.id = "\
    "hierarchy_entries.taxon_concept_id AND hierarchy_entries.hierarchy_id = "\
    "#{id}) JOIN #{table} ON "\
    "(#{table}.hierarchy_entry_id = hierarchy_entries.id) "\
    "JOIN data_objects ON (#{table}.data_object_id = "\
    "data_objects.id) WHERE (data_objects.published = 1 OR "\
    "#{table}.visibility_id != #{Visibility.get_visible.id})"
  end
def insert_dot_dohe_query ( table ) "INSERT IGNORE INTO data_objects_taxon_concepts (`taxon_concept_id`, " "`data_object_id`) SELECT taxon_concepts.id, data_objects.id FROM " "taxon_concepts JOIN hierarchy_entries ON (taxon_concepts.id = " "hierarchy_entries.taxon_concept_id AND hierarchy_entries.hierarchy_id = " "#{id}) JOIN #{table} ON " "(#{table}.hierarchy_entry_id = hierarchy_entries.id) " "JOIN data_objects ON (#{table}.data_object_id = " "data_objects.id) WHERE (data_objects.published = 1 OR " "#{table}.visibility_id != #{Visibility.get_visible.id})" end
There's no nice way to do this in Rails and can be super slow if you don't
use the INSERT SELECT!
There ' s no nice way to do this in Rails and can be super slow if you don ' t use the INSERT SELECT!
table
<not_specific>